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

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

[复制链接]

157

主题

366

回帖

7070

积分

管理员

积分
7070
金钱
2012
贡献
4535
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) / {/ a! j) L+ R
+ d. \) h; \7 N# V- I* P- _
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
& d( u3 R8 ]) X1 _. ]
  h- Q, m: T, g  ^7 {
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。  I2 H. z  B' Z6 I
  2. //
    1 n* A* O/ x& d/ ~- k

  3. * ~- m5 ^) L, z0 j
  4. #include "stdafx.h"( ^0 R: _% P: U8 M3 T/ s7 c0 I# J
  5. #include <iostream>' I2 x4 H& T* i4 j" G1 A8 m
  6. #include <Windows.h>+ h, E6 ?; y8 B' S# u, `, P9 a
  7. #include <io.h>
    # W# @0 y8 d  }7 i% `
  8. , f! U* X7 S' r$ M" T, i# w
  9. & L0 e; R, |7 P: x! K/ l3 C7 H8 y
  10. int _tmain(int argc, _TCHAR* argv[])6 _. M9 @+ B3 c' q- [& L# R
  11. {0 @% J. O% _+ W' p
  12.         printf("Dekaron-Server Launcher by Toasty\n");$ a* m& P& w9 v/ K

  13. * e4 n& @4 t% r2 B
  14.         //查看文件“DekaronServer.exe”是否存在2 Y( p. K8 w' o* E
  15.         if(_access("DekaronServer.exe", 0) == -1)/ K/ B: P( x9 X. t7 p( i4 N
  16.         {
    ) X1 y7 g, ?! N
  17.                 printf("DekaronServer.exe not found!\n");1 E1 P5 x) v: {) t0 B% P( Y3 r
  18.                 printf("Program will close in 5seconds\n");
    7 l1 M' k! A5 u
  19.                 Sleep(5000);" C$ S9 s+ G% C# l( I: {8 u
  20.         }
    + l+ y' _2 G' Z7 _  d/ ^) t
  21.         else
    ; n2 b) o# Z' _1 s( {2 \5 |: q
  22.         {/ }. q) i3 q- d1 o6 V
  23.                 / A9 V: e4 B& ?2 a0 k
  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 L* K- S/ _$ m" ^" d2 F3 @
  25.                 STARTUPINFO si;
    7 n7 u. U3 F; v' W: ]9 Z# f

  26. 1 ^+ {8 L. _( J, r& 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/ p3 i' \7 [3 O6 Q
  28.                 PROCESS_INFORMATION pi;  f' E$ O# z% U1 m5 w! w

  29.   ]% a$ P% ~1 H4 T) D8 P
  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+ i4 t2 Y, T/ |: q. s1 ~( q. |3 ]' z
  31.                 DEBUG_EVENT dbge;  g- W- n! r$ T9 o4 S3 w4 r: v; M
  32. : [& R8 @8 C0 @  @5 m7 ?/ s
  33.                 //Commandline that will used at CreateProcess; w; D7 x) l, c9 K, ]! f0 P5 v
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    / T: J+ F) H1 k! e& P5 I6 Z

  35. / ?2 T+ y5 j; }0 s
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    0 F2 u* a: C9 m! ~: B2 h
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)+ [* w5 U& m  |; `
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)& ?5 C6 @9 Q- |8 {. |, ]/ `

  39. 9 k- T: D- g0 ~& |4 x
  40. 8 b0 s0 J7 A3 K& c1 z5 ~
  41. ' t1 d' l% ?6 G( ^
  42.                 //Start DekaronServer.exe & _1 ~# j" B# [7 D) Y+ }6 q
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx3 O, e  R: R8 ?  T
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    6 R1 X% c3 W& `/ Y, j1 v5 Q- w
  45.                         szCmdline,        // Command line
    7 }% i0 k3 Y' K' t  q0 R1 f
  46.                         NULL,           // Process handle not inheritable6 N5 S6 N# K$ Q# i1 D% `
  47.                         NULL,           // Thread handle not inheritable6 L) w  O& Q, ?2 L
  48.                         FALSE,          // Set handle inheritance to FALSE7 m" u. p5 q1 C! G$ C5 [  u
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    8 ~/ P- n/ _; L" v/ u
  50.                         NULL,           // Use parent's environment block
    # V5 y$ q% ?% ]  }( P
  51.                         NULL,           // Use parent's starting directory
    % |1 d( ^% t% F
  52.                         &si,            // Pointer to STARTUPINFO structure
    7 `- C; J3 I5 A4 S
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure) A+ X- j2 ?& N; M$ D+ X6 ]/ ^
  54.                 )
    $ r& N& @+ A7 h# {2 G7 z
  55.                 {
    + E( o5 A* O( M. ~# k# o
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    ' Q$ ?# i+ m1 X, j% L
  57.                         return 0;
    , X+ W+ G7 J% ?+ b: u% E' \
  58.                 }; b$ Z. A' J, K- h/ z, q
  59.                 //Creating Process was sucessful( y, V$ g. p9 z$ `8 Y: O
  60.                 else
    ) C+ S6 t) X5 ?# w
  61.                 {
    * w' b) }, k" H6 M  O2 p% d" i
  62.                         printf("Sucessfully launched DekaronServer.exe\n");2 Q3 r' l: n: ?$ W$ S; M$ Y

  63. " h9 K$ r5 l2 q5 G" q8 ?
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure6 P* H2 M( U% u5 X
  65.                         dbge.dwProcessId = pi.dwProcessId;4 E8 k4 O; e" t* j# ~4 p1 A; G
  66.                         dbge.dwProcessId = pi.dwThreadId;
    * z5 h) J8 i( @" S7 m! p" A

  67. : G6 C: V. J# }) K( O$ |) f
  68.                         while(true) //infinite loop ("Debugger")
    ' p" X* j' |, A+ F% C
  69.                         {1 W9 r% x6 P% [  W5 n7 P# p: c
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx* M: J2 b% N- w' L: y3 {2 q" v+ O+ |

  71.   J4 b( R2 X7 l! ]8 @4 D2 C8 T
  72.                                 /*
    ' r5 K, Q/ b: ]  R- r6 T. ^: V$ |- P% `2 q
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

  K9 Y; m; @+ ~  K3 e8 [/ }. A; n6 d

) p% P' u: J4 K1 n, `
商业服务端 登录器 网站 出售

15

主题

257

回帖

1234

积分

金牌会员

积分
1234
金钱
896
贡献
61
注册时间
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

主题

257

回帖

1234

积分

金牌会员

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

3

主题

102

回帖

7197

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-3-26 16:38 , Processed in 0.034699 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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