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

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

[复制链接]

155

主题

348

回帖

5970

积分

管理员

积分
5970
金钱
1862
贡献
3605
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 1 Y' X) p+ O2 @5 C7 @; h

' y, U7 U: A5 o! r0 m虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。3 d& G# n, m  \( Z7 e
/ @& D! b' A2 k7 D4 E8 v- u9 C
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    % {$ R( |0 ~0 k; i  R: j( c5 g- K
  2. //3 }& M, |% V1 u

  3. . _$ C% C5 a8 Y* _6 `0 v
  4. #include "stdafx.h"( @# z. k5 C" f
  5. #include <iostream>
    ) A- S) `# g3 |* @+ l4 C2 b
  6. #include <Windows.h>
    9 X0 }" _# c, T5 W& w
  7. #include <io.h>7 N% i$ L9 l$ q" y, W) S
  8. & c4 I* P6 R9 Y' H# `/ b- s7 O
  9. . p% b& X- T7 E* ?3 ^/ d, N
  10. int _tmain(int argc, _TCHAR* argv[])0 ~# ]) T/ O/ P; `' {& l6 ?3 D8 d0 e
  11. {9 q( _4 a8 r- a" b6 ~1 {  j
  12.         printf("Dekaron-Server Launcher by Toasty\n");# \  @, f  t1 |
  13. $ [% \0 \$ C- y  G
  14.         //查看文件“DekaronServer.exe”是否存在' y6 ~- n0 O& X  J0 {
  15.         if(_access("DekaronServer.exe", 0) == -1)
    1 C3 D9 Q% u) {" H/ G: J( V
  16.         {
    1 `* U+ I/ z2 T; y" `, e
  17.                 printf("DekaronServer.exe not found!\n");, a6 f0 b/ _$ R3 s9 l5 z+ T, A
  18.                 printf("Program will close in 5seconds\n");
    3 K( z) ?4 A9 q3 P& r2 V+ `
  19.                 Sleep(5000);1 @6 Q: B$ I7 d2 i& x9 Z
  20.         }
    7 r& i" ~9 P+ Q- X! L4 Y& J
  21.         else
    ! q/ ~, A6 K" k' y" |: q  ]* D( ?
  22.         {& R  V. R/ r4 z5 c
  23.                
    - `: _0 m* v3 J3 d
  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
    / V0 f' B  [6 K2 ]7 R
  25.                 STARTUPINFO si;, Q  k  g. b8 r$ q5 s
  26. , S! u; ~' {# `# O* c+ f8 I
  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" b0 x: H; C3 V, b$ i
  28.                 PROCESS_INFORMATION pi;* z5 y$ R+ d, w0 G

  29. 4 c5 s7 I9 D$ d% o' H4 I, s
  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
    + O: g6 l' o! T3 v
  31.                 DEBUG_EVENT dbge;) E" A5 E- B3 e; s2 R
  32. 3 r, F& K( x3 s( M7 D
  33.                 //Commandline that will used at CreateProcess9 n- v/ ?2 R" I0 w# X. q1 c" w
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    6 n9 C* r; U/ o0 f) q) I

  35. - p( n3 a. Y$ Q
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)" ?5 }1 g% m0 h4 f
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)8 Z* P* W/ K, t/ J( e" J
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    " M6 Q  ~# z1 A9 N  |- G5 }/ Q4 q

  39. 9 P& H2 O  Y2 ^: {; G' f+ b  _
  40. " l7 J4 K" ]9 \7 w, q+ z

  41.   A. d/ p& ?8 i. L8 ^
  42.                 //Start DekaronServer.exe
    8 H4 @1 ]- d1 E# ?
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx) `9 J( P3 w. h) }; Y* g% ]
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    ' m  k9 i1 @3 b' o
  45.                         szCmdline,        // Command line
    % [2 U- _. g: r
  46.                         NULL,           // Process handle not inheritable3 g7 `0 c' ]! i2 r: `0 B
  47.                         NULL,           // Thread handle not inheritable
    ; R% o7 b1 u! y2 }) h5 l
  48.                         FALSE,          // Set handle inheritance to FALSE+ s+ u3 @8 d( w% g/ s, y! y
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    ; @' H! i& J  A8 v- P
  50.                         NULL,           // Use parent's environment block4 l+ O& r! S  {/ q9 P: K  t
  51.                         NULL,           // Use parent's starting directory ( C- i' e; b) \2 @* f0 }) A
  52.                         &si,            // Pointer to STARTUPINFO structure
      O8 f! b6 Y% E( u7 {4 V
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    ; Z  @' }  I+ t3 J0 K, K
  54.                 ) 0 A: a$ n$ l) ]( m: L, s3 ~
  55.                 {' W1 c- ^* T% q* E8 n. {
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    % e$ f% G' l$ U5 ?  d; R
  57.                         return 0;' Z$ i" P3 Z/ i  `6 {* m4 E" F
  58.                 }% p$ U3 C3 w  P
  59.                 //Creating Process was sucessful
    & F5 z4 ?$ d/ e) p. f
  60.                 else
    ) w, e3 X5 L; r# l+ O
  61.                 {+ u; V- \  T6 h, I* G
  62.                         printf("Sucessfully launched DekaronServer.exe\n");: B7 C8 \$ \1 i  N, G

  63. - U, L4 q) Y* i) _" Q
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    9 Y6 l; M$ s+ _7 M9 x
  65.                         dbge.dwProcessId = pi.dwProcessId;* d- V( H" ~! ]: _, F3 l+ U% n
  66.                         dbge.dwProcessId = pi.dwThreadId;
    % d) k/ K$ u3 r+ T; U( c, F
  67. ( n# T3 f8 L7 k$ d* A+ F4 f
  68.                         while(true) //infinite loop ("Debugger")9 ]  V, @0 G. C
  69.                         {
    % U/ ^1 }" r3 Z4 W
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx' J. F4 u8 B8 r2 x8 A0 O
  71. 4 S/ b  m" ]  w4 H9 V5 m
  72.                                 /*; ~# Y1 k# T& C
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

& K! I- N3 r  Z( P# C: }& q
4 Q% h1 d; X) y) {% X! t& e0 |) U2 p" B1 T" g- Y
商业服务端 登录器 网站 出售

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

主题

99

回帖

5733

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-27 19:30 , Processed in 0.081678 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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