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

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

[复制链接]

154

主题

343

回帖

5868

积分

管理员

积分
5868
金钱
1839
贡献
3532
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
# S+ P5 J2 q& z8 v+ P  r; p; u0 s1 t. m. @1 C8 Z# O
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。* {! }5 V! l4 R# n& S  b( _

( ^6 w/ X9 \; R& q, ]6 p7 `
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    * Z& s+ Q1 W+ F% I/ Q
  2. //
    # k9 ?1 r+ @, x2 F9 M8 j2 s, r2 k

  3. 1 x) j6 D% l2 t& Y  P6 P) z. J8 d
  4. #include "stdafx.h"" }! O3 b" x1 [0 ^6 X$ L! |+ E
  5. #include <iostream>
    : d3 t+ V- J  V0 N
  6. #include <Windows.h>
    ( {" A! y( C+ _7 ~0 Y! J( x! C& _/ t
  7. #include <io.h>
    8 Y/ g+ w# S) y( u$ d

  8. - x: W9 y- a- ~* m3 k$ s9 v# i
  9. # Z# F* `/ x8 V  _9 F
  10. int _tmain(int argc, _TCHAR* argv[])
    - t8 L9 e  j5 L  f4 A) ~
  11. {( w2 g6 L# U3 A/ }
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    - Z& B$ i; w" }8 @( f
  13. ' |( N$ W( ~' K; V2 c5 @  S0 G% J
  14.         //查看文件“DekaronServer.exe”是否存在+ B: e3 ~9 p0 `$ \6 f0 o. x3 v6 v
  15.         if(_access("DekaronServer.exe", 0) == -1), t# V. K' U0 o
  16.         {$ u( X' ]  q) _# J/ g
  17.                 printf("DekaronServer.exe not found!\n");8 X3 g  o3 y8 I" S6 y
  18.                 printf("Program will close in 5seconds\n");
    4 S9 m5 Q* G3 \! S! [* C
  19.                 Sleep(5000);2 O4 ~* S" b  F  c; M
  20.         }
    ( {  R, m4 V5 b( e' @* v
  21.         else
    / ~- D: `* u: [( [) Y' _
  22.         {1 o2 N3 q  e- U2 E; c
  23.                 ( i) ]6 n( `+ T7 z) E4 z. \  t
  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$ D) |7 t5 b: O+ U
  25.                 STARTUPINFO si;
    7 s% a4 R0 i  w8 m- U# ^
  26. . M( R* a" c8 s
  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& a) G$ X2 O! n1 Q  _
  28.                 PROCESS_INFORMATION pi;
    ; ?5 i) Y/ M3 N3 C  B
  29. 1 W4 c( K: @2 L- K, w
  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! T! y' X: f) ~
  31.                 DEBUG_EVENT dbge;) m" S& u8 h8 s+ m) n; g! j' t4 x% x
  32. 0 g& I! r, I( b& ?8 X  q
  33.                 //Commandline that will used at CreateProcess
    3 r8 x0 x* Z- j; h% e
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));. c3 S! R4 ?# W0 l3 j
  35. 0 G- |. [3 `1 }
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)# |" U3 T7 m2 O
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    " M, ^3 v2 x) a+ J
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    & ?4 N; h# V1 W% G. L( I
  39. $ K" H1 X  J: C

  40. - Z' Q( I3 l9 q1 [- Q
  41. & Z) w; b  y; ~, X
  42.                 //Start DekaronServer.exe
    + c6 @; U3 i0 L, M7 U: A' i
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx' s) `1 f6 V: |2 q: p( t# y1 t: g2 e
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    3 \3 h' h4 [$ q
  45.                         szCmdline,        // Command line, J1 @7 V0 t& z
  46.                         NULL,           // Process handle not inheritable& {+ y) [% }3 M; y1 a5 y
  47.                         NULL,           // Thread handle not inheritable
    0 W2 u8 v# _- h0 z9 y8 ]: L% e
  48.                         FALSE,          // Set handle inheritance to FALSE0 ?/ I  Q7 f% O5 `
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    4 f9 P+ g5 O) x
  50.                         NULL,           // Use parent's environment block
    5 h7 f1 R- ], E  |; F7 X
  51.                         NULL,           // Use parent's starting directory
    . P- z" ?9 R$ w) |
  52.                         &si,            // Pointer to STARTUPINFO structure
    ) ^' H9 N: W. O0 c3 U4 n1 M
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure: H0 j9 r- i4 i$ d" j: V
  54.                 ) 9 L) M2 N/ V/ `- R3 \( [' w
  55.                 {( b9 L- l3 A/ {5 |
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    2 `* T" ^# w& \3 d1 H
  57.                         return 0;
    % p& [( X2 M( V' v1 \8 I
  58.                 }
    ) U9 M8 l% s9 n
  59.                 //Creating Process was sucessful' w+ ?. O6 Q% k* x0 A
  60.                 else
    , i( ]" {6 L9 }) S9 e9 A$ l. V+ M
  61.                 {! `# ^+ O; t- Q  k
  62.                         printf("Sucessfully launched DekaronServer.exe\n");( @+ t8 I+ m& G" ]6 Y  c+ s

  63. : L4 T  {" C0 _4 w$ d
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    - s. Q: Q% [& E0 u
  65.                         dbge.dwProcessId = pi.dwProcessId;
    * f% }+ c0 K! ?. @7 W) N% R5 i
  66.                         dbge.dwProcessId = pi.dwThreadId;
    5 m' r- J$ H1 P$ h+ L8 f
  67. 6 M- N& S9 b  u- ]. X% F: o
  68.                         while(true) //infinite loop ("Debugger")
    8 r/ x4 X. z; A0 `  K+ {
  69.                         {
    2 i% p2 X4 o* n! W, p! z: c% T  X4 j
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx1 y; U. i) F0 D
  71. 2 d/ h8 G! C+ g. O3 Y
  72.                                 /*' r7 W8 Y. H! ?4 o& X7 q7 y
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

+ r2 T3 A# ^  R( h, }' v
, b+ B% z! z4 B. j' A0 x4 O& X8 e. ~6 U& a! K5 c0 s
商业服务端 登录器 网站 出售

13

主题

251

回帖

1258

积分

金牌会员

积分
1258
金钱
802
贡献
187
注册时间
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

回帖

1258

积分

金牌会员

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

3

主题

99

回帖

5493

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-15 16:05 , Processed in 0.068225 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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