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

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

[复制链接]

157

主题

362

回帖

6846

积分

管理员

积分
6846
金钱
1946
贡献
4381
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) , K( n$ L; k" }: }
7 u  ]" p$ r4 H" H
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
* H3 R# z9 T8 @% o2 j: t
- b- t4 F+ ~# H& a  D* {( x, b8 q' r5 W
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    ! {: {# S' q9 v" Z
  2. //
    5 c4 A8 @  Y- L# j0 i/ W; S8 ~

  3. ! S; y2 p! F/ [0 U4 i
  4. #include "stdafx.h"
    2 b7 }' f* d& ]( s
  5. #include <iostream>
    ! h# \) W3 m* P2 s- v4 C4 W
  6. #include <Windows.h>
    . p' [$ j" K5 w
  7. #include <io.h>
    - ]# e& r* R; T% v
  8. ; g5 ^  E% _) ], F2 Z) y) A. j, d8 D
  9.   h, ?4 i7 n7 J3 T0 D
  10. int _tmain(int argc, _TCHAR* argv[])
    7 E' q, k1 a% ?8 B0 g
  11. {) s" M1 Q7 N! b- r3 T* {
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    / Q. ^8 ~1 G' @

  13. , i  I9 U$ R5 r2 T/ z
  14.         //查看文件“DekaronServer.exe”是否存在
    ' i0 w  ]! k& L6 t8 s
  15.         if(_access("DekaronServer.exe", 0) == -1)4 R+ t6 R5 Y! J
  16.         {
    ) \9 T/ Q. `7 I# w' X3 x
  17.                 printf("DekaronServer.exe not found!\n");* v' ~, m" x# V5 b& y
  18.                 printf("Program will close in 5seconds\n");
    2 N9 V' j4 D5 i0 _5 o/ T% W* N
  19.                 Sleep(5000);
    % A- a, k9 y$ O4 s" P  m  \+ q6 f
  20.         }& W0 }/ D2 h$ Y! ?5 C
  21.         else
    * {; C8 j9 i' a- O; S6 j
  22.         {! f! u  H* \: B! k! g  O8 R
  23.                
    ; A& Y$ W/ a1 c2 Y" x. Y9 X
  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).aspx0 n. p3 L: K! ~- V
  25.                 STARTUPINFO si;& L1 F$ `$ a% a% g
  26. ) H; u0 D: C" I" Q! w8 `! h5 W
  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
    + E7 }' I/ j0 R( M7 b
  28.                 PROCESS_INFORMATION pi;0 N: _* H! c# c5 [
  29. 0 v" T: s# C, f( B3 T" E8 o
  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).aspx4 H4 V8 T7 [- d  b5 f, {, q
  31.                 DEBUG_EVENT dbge;
    2 W. f9 s' o# c/ v3 K

  32. 0 M& i$ o) T8 H  E" a
  33.                 //Commandline that will used at CreateProcess  K4 C4 c6 `( {8 y! o: F; S! s! s
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    ! G  _! G' z1 [& c1 n) L5 w2 D+ B2 o
  35. # a+ _% \4 c0 u  @& s+ G
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)2 m, ?- a; [, M0 k: `. E8 ^+ f# a
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)' [$ t, l7 N! S5 Z& B( p/ L) F
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)# u* X& s- }  {5 F

  39. ( P$ b' k% ~- Z0 s5 v$ Y

  40. 0 U2 U/ ?" d! y
  41. . P, j' U. P- ?) H# a+ `, R' A
  42.                 //Start DekaronServer.exe
    - w- O; G- @% |% l8 C! p8 Y. C
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx; {6 e9 v' o3 K  _! t2 o
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)# f1 R- J5 q. K: e' V
  45.                         szCmdline,        // Command line! q5 p: q* W0 b9 O/ u7 I
  46.                         NULL,           // Process handle not inheritable. }5 d# B: M6 d  K. }/ l+ u
  47.                         NULL,           // Thread handle not inheritable
    3 g: z' a$ C7 I; I7 Z
  48.                         FALSE,          // Set handle inheritance to FALSE
    ' @5 H0 c% f  P# L0 h; [/ e
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx1 E. ?$ b$ `1 X) |# L& t
  50.                         NULL,           // Use parent's environment block+ B) q, @# c$ v. {
  51.                         NULL,           // Use parent's starting directory 8 C" B2 y+ p/ O% F5 _; s& Y8 j
  52.                         &si,            // Pointer to STARTUPINFO structure3 `: ]- a5 Z: P- `) p- C2 z. u! t# V
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    & I8 S8 S; v$ P0 l. \4 ^( s
  54.                 )
    7 B2 s- C  V+ z2 H: a/ i0 x. Y4 m
  55.                 {& w6 g* v" y  ^* w* G/ J; k: R
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    / z# j8 c3 r# b: u+ R6 i8 y
  57.                         return 0;# K2 Z! V2 g6 Q4 U" I9 E
  58.                 }
      q2 C, @4 j. V( b# b$ U1 G
  59.                 //Creating Process was sucessful' B* S( I0 h! ?2 b4 j$ i& v! y
  60.                 else7 _+ C7 u. K9 `" ]2 _7 r4 V
  61.                 {
    " V) [4 ?9 }4 W/ W8 Z( \# l! q
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    ' w' V& C# j5 C: E

  63.   ~* z% q1 d1 c: j# N
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    2 Y) u/ [: ^2 X8 m
  65.                         dbge.dwProcessId = pi.dwProcessId;
    , Y5 k' w4 e5 Q0 Z; Q- ]+ E5 ~
  66.                         dbge.dwProcessId = pi.dwThreadId;
    % I* S0 C6 B; j# ?( T; @: H

  67. 4 F, O; m- ^; i: U' N( _
  68.                         while(true) //infinite loop ("Debugger")
    . h5 t8 ^5 r4 M6 q6 D+ g" D
  69.                         {
    . h' s  }  I4 q3 N3 U
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    3 `# {( V- Q) B1 @, A
  71. 2 D  W: {: [  J: C5 n" c
  72.                                 /*3 |. K" q7 ~( u6 \& t9 }/ _
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

" W' t- m5 e' ^7 i7 Q  i
6 ?7 S! ^0 p: ]1 x# r. c
7 \. j* \: [8 Z2 A) E( X6 f
商业服务端 登录器 网站 出售

15

主题

256

回帖

1274

积分

金牌会员

积分
1274
金钱
877
贡献
121
注册时间
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

主题

207

回帖

352

积分

中级会员

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

15

主题

256

回帖

1274

积分

金牌会员

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

3

主题

102

回帖

6594

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-20 11:33 , Processed in 0.058589 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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