找回密码
 立即注册
查看: 4839|回复: 5

[技术文章] Dekaron-用于Win7 / Win2k8R2的服务器启动器

[复制链接]

155

主题

348

回帖

5989

积分

管理员

积分
5989
金钱
1864
贡献
3622
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 2 L- f$ w% x$ V* [# a

+ Y9 ^  b. f: W. A虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
" _0 ^' I4 a: C' y, j7 z  q2 U  N! I' u6 I5 a3 a
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。" V  L" w' [8 {- a
  2. //1 A  R/ c6 A) z; t" ]
  3. ; ^% Q0 T. R+ _# }  M/ }8 v2 ?1 X8 ]
  4. #include "stdafx.h"
    8 ]$ N0 @) t. G! [+ B- f# D$ a
  5. #include <iostream>
    5 r# x) y7 f9 h! Q; N
  6. #include <Windows.h>2 i' ^+ a; F2 Y; j3 _" a
  7. #include <io.h>
    : c6 u1 Q4 W& s: z0 f4 o

  8. $ Q. ?. D' [" k% {9 _% e. n
  9. 9 j9 m2 K* O/ x* H' ^! m9 G3 h1 q
  10. int _tmain(int argc, _TCHAR* argv[])
    1 i% J5 s' n8 E7 c
  11. {
    # l) {" `8 p9 Z* r4 f6 h
  12.         printf("Dekaron-Server Launcher by Toasty\n");& V' n& o1 p& Q5 u- O: B0 D4 h  w

  13. & ~# {; D2 z3 x1 q) ^$ a* l
  14.         //查看文件“DekaronServer.exe”是否存在
    ; ~9 D. K/ [3 ^/ e1 p4 p
  15.         if(_access("DekaronServer.exe", 0) == -1)3 x6 w0 J) A5 t" l' ?# L
  16.         {
    & E. ?1 {' K. @0 {! [
  17.                 printf("DekaronServer.exe not found!\n");
    ; t. ]$ Z- S/ O9 o; g2 G5 `
  18.                 printf("Program will close in 5seconds\n");
    6 m& I; m$ s% R) h, Y0 D
  19.                 Sleep(5000);4 M2 q9 B$ y1 W) X2 Q& I
  20.         }$ k( S4 |: J, Q: ]) e
  21.         else
    ; W% e- ]4 }) ?# |- ]( U
  22.         {
    - f/ w& @- }3 r. [; g+ ?
  23.                 3 j2 R$ R: W6 M
  24.                 //Only needed for the CreateProcess function below, no more use in this programm. More info at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms686331(v=vs.85).aspx- ]& g/ ^( R! t; W6 \+ r
  25.                 STARTUPINFO si;9 W+ k% W0 _) o  J4 W( P. Y
  26. + p4 E% z. W: b' w# Q2 b
  27.                 //Structure where the CreateProcess function will write the ProcessID and ThreadID of the created Process. More info at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms684873(v=vs.85).aspx
    " c3 }, v) l# k, M9 R7 W) U
  28.                 PROCESS_INFORMATION pi;
    ; Y- M. @3 p' _8 W9 x* T! h

  29. 3 E# L5 n/ a8 e+ N' [4 h( I* a
  30.                 //Debug event structure, needed for WaitForDebugEvent and ContinueDebugEvent. More info at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms679308(v=vs.85).aspx
    * E' a2 J  H. G" P
  31.                 DEBUG_EVENT dbge;! h2 T9 D' U; z1 c& |2 r

  32. 8 d& J" d' o* g. f
  33.                 //Commandline that will used at CreateProcess# A! W; K+ v( Z
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));  G0 v; V: l4 b

  35. - W4 q. R6 a8 A" ]
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)$ n" ]% L1 o9 y: G) U+ {, c
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    + y# }1 |; j( Q" r9 E
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    8 J2 ?6 g/ U2 }* I: [( d/ c+ P0 K

  39. ' P/ U% ^6 i9 J1 b% x% ?
  40. ' j7 M  k. X5 e; h/ e

  41. 2 M0 v# M8 p' \# e/ ?
  42.                 //Start DekaronServer.exe ( }- O6 K" F4 Z" y  Q
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx# Z3 S. q" F! U4 J6 n5 j8 q' a
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    ; g/ v. E8 A: F. x
  45.                         szCmdline,        // Command line
    & e9 j$ i, V, F3 ^
  46.                         NULL,           // Process handle not inheritable
    ' B; d  g5 ^8 ^( v
  47.                         NULL,           // Thread handle not inheritable
    : }8 p) V. A- O0 h% q/ _
  48.                         FALSE,          // Set handle inheritance to FALSE/ ?/ U" m& c' O% _& x8 ?4 T( \, N
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    ! l5 |) S2 f  F1 l
  50.                         NULL,           // Use parent's environment block
    : b/ |' f1 o9 I
  51.                         NULL,           // Use parent's starting directory , z' H% Q: Z# }6 c! X  T7 T
  52.                         &si,            // Pointer to STARTUPINFO structure
    - }" b* T( C# H4 ^/ F2 x
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    & J6 p  C; q8 }0 r3 Z
  54.                 )
    $ P, M$ Q! }( z/ a1 R; z  H" Y
  55.                 {) P6 v* s0 I- o) f: V
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    ' \( G" S8 _1 }  M& X! V9 Q
  57.                         return 0;
    0 w0 q( {6 t5 q" _9 Z4 |  U2 t& m7 b9 b' U
  58.                 }
    5 \8 O& u0 `& ~  W! `
  59.                 //Creating Process was sucessful! D: q3 v5 D4 p7 a
  60.                 else% m1 t* D( F* o) B
  61.                 {  a; e6 C9 Z0 X) o1 x
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    2 H0 N: k) S) ?' I  w* ?! X
  63. - s9 `$ g; p, o7 g% G8 |3 ^
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    ; h  Q0 |. y0 T0 |! U2 N$ s
  65.                         dbge.dwProcessId = pi.dwProcessId;$ P5 K% u9 P6 n) L) V( v
  66.                         dbge.dwProcessId = pi.dwThreadId;
      z( }2 z, P/ ~9 d2 E& T# |

  67. 9 e$ x) R, M# b; @& V. s
  68.                         while(true) //infinite loop ("Debugger")7 A6 [$ e& }) ~+ |* v9 U9 ]2 m3 o, Y
  69.                         {
      b) g# [% Q% |; o9 h
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx" r; ~) ?5 K, L8 L* N" t- c
  71. 6 h( [- E/ N( e! z
  72.                                 /*
    ! @* p8 u9 W. M* I, Z* c5 ^) y
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

; ~. l  L0 Y3 k- }6 K. n7 ^. N7 _' ^4 Q( P1 `. A( `; N3 ^

$ o1 ], L$ M# v( ]+ n' g
商业服务端 登录器 网站 出售

13

主题

251

回帖

1242

积分

金牌会员

积分
1242
金钱
814
贡献
159
注册时间
2023-11-10
发表于 2023-12-18 20:34:07 | 显示全部楼层
我是来学习的!

21

主题

378

回帖

1013

积分

高级会员

积分
1013
金钱
445
贡献
169
注册时间
2024-1-20
发表于 2024-1-21 13:37:44 | 显示全部楼层
感谢楼主分享,我是来学习的

0

主题

205

回帖

345

积分

中级会员

积分
345
金钱
136
贡献
4
注册时间
2024-5-14
发表于 2024-5-14 15:56:57 | 显示全部楼层
学习学习赞赞赞

13

主题

251

回帖

1242

积分

金牌会员

积分
1242
金钱
814
贡献
159
注册时间
2023-11-10
发表于 2024-5-25 11:48:57 | 显示全部楼层
每天报道一次!

3

主题

100

回帖

5713

积分

论坛元老

积分
5713
金钱
5540
贡献
70
注册时间
2023-11-15
QQ
发表于 2024-6-5 17:06:28 | 显示全部楼层
学些大神分享,受用了
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-30 22:19 , Processed in 0.096543 second(s), 26 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表