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

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

[复制链接]

154

主题

335

回帖

5769

积分

管理员

积分
5769
金钱
1815
贡献
3465
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
; F& F. Q* x) ^4 y- v( u" s" R9 G$ ?4 h: L
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
" Y* q4 @1 R# f7 c$ M9 X( i) y. P$ n5 g4 {0 B: ~( w
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    7 D! [8 M0 w( T7 W; ~, C
  2. //
    # \! o4 H8 @$ ]; v
  3. 3 \, v8 l; p3 U5 e$ k$ K+ w' e$ R6 J6 X
  4. #include "stdafx.h"
    ; @8 \: `) j+ d( Y
  5. #include <iostream>2 l6 s6 X8 r; r8 I' X" }
  6. #include <Windows.h>
    3 h. t% ]8 g" A% m- x
  7. #include <io.h>! Z4 ]9 M# A+ Q+ |
  8. : Q; s3 C- H3 k. ?5 I2 z0 C0 P/ Q

  9.   o0 E# _6 g# K" f3 Z) ]. ~
  10. int _tmain(int argc, _TCHAR* argv[])
    1 u+ J' [$ B1 J9 S& }
  11. {# C* G" m$ F# q$ [
  12.         printf("Dekaron-Server Launcher by Toasty\n");- }( k9 b4 u. M; e. Q( L, g
  13. # }2 k: L" r  \( l, V
  14.         //查看文件“DekaronServer.exe”是否存在2 v) w  {3 |6 E# L( W
  15.         if(_access("DekaronServer.exe", 0) == -1)9 S) P1 r5 i2 u! Q
  16.         {. S3 V5 y4 e' B. g# C9 W
  17.                 printf("DekaronServer.exe not found!\n");  E& i& m! p- D( A$ k
  18.                 printf("Program will close in 5seconds\n");
    3 B) J- y: R, V3 b
  19.                 Sleep(5000);
    4 J% N# ?+ G+ i) p
  20.         }, t2 x1 R9 f0 d" r
  21.         else
    ' ~# p0 B, P4 c$ q/ P& [# g) z
  22.         {( b9 a) O! V8 S4 O9 u+ B7 ~
  23.                
    1 h, J5 c- ?" O0 n# u  ?* W
  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
    8 D- z; U0 G% @# _
  25.                 STARTUPINFO si;& i1 x  m* R) [0 S( g2 O
  26. : m! @8 ~  n' l6 T! f' b% b2 ^
  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).aspx4 F  d' W4 H6 K% F* ]
  28.                 PROCESS_INFORMATION pi;
      ?9 P; N/ ]8 {6 ~; }+ l$ k
  29. ; a8 p5 y  ]; x* n
  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! ?8 y8 A; u" v. r3 |! l, i- N+ U8 H/ d
  31.                 DEBUG_EVENT dbge;0 Y8 w. J% P4 I, v
  32. " X# z$ H) \) Q* P
  33.                 //Commandline that will used at CreateProcess0 c# p2 k% J9 \! [3 w
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    5 u  N2 Z+ K" t6 a

  35. 5 i8 P, x! ^: Q/ ~$ ]3 V# ^
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    % x5 D7 M# x5 [; ?- ^8 a. W
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)) _$ n5 d( X* |* B) G! [
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)* j( d" |' g5 u6 W8 q7 R/ E( g1 ?

  39. 2 J6 }1 u; M$ ?/ |* g

  40. 1 u% A2 C; j/ A+ c

  41. 5 x- u7 k/ s. B" ^
  42.                 //Start DekaronServer.exe
    ) h; i6 T5 O. {3 ]
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    , a9 {# k- o6 v( I
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    . N, g/ K, M9 }. ^! I# _7 \
  45.                         szCmdline,        // Command line( I) H, I0 t. S) N7 G! E
  46.                         NULL,           // Process handle not inheritable$ D- v, _4 ^6 W5 O0 N
  47.                         NULL,           // Thread handle not inheritable( e' e( H1 E( g( f. |) Q4 ?
  48.                         FALSE,          // Set handle inheritance to FALSE( {/ i, y9 s8 \8 N% ^2 G
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx3 _$ |  |5 y* |( u" ^" s
  50.                         NULL,           // Use parent's environment block; u# B0 H: T& x& y4 v- R. h' Z
  51.                         NULL,           // Use parent's starting directory
    ! O' M2 u+ ]1 b( d- ]; j) ^% i1 b: X8 W
  52.                         &si,            // Pointer to STARTUPINFO structure
    : g3 b, Q. J* m* [: v( R
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    5 }, j6 d- W9 r- D, {- B5 E' r
  54.                 )
    , q2 t, f& [; D) d; e  A- }" |
  55.                 {
    6 F% I( V# a" C# W
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );, i& q% A9 \6 P$ n* ?
  57.                         return 0;
    : w* ^4 X& c9 w+ }+ p
  58.                 }
    . n: A+ @+ i) _! t0 _% Y# o" h
  59.                 //Creating Process was sucessful- c$ s8 F4 H; `" T9 ]9 f
  60.                 else
    . O; a) ]# d# b& }
  61.                 {( M* J) e+ `9 l/ f3 J$ W2 V
  62.                         printf("Sucessfully launched DekaronServer.exe\n");8 d) b# E5 Z5 z) ?' |+ m, _& g0 }
  63. + R6 t: y5 b7 b. h, ?9 x0 N
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    / J: [: f  Q9 S. @  B9 a
  65.                         dbge.dwProcessId = pi.dwProcessId;+ o- j7 i) X6 S5 }+ B3 w
  66.                         dbge.dwProcessId = pi.dwThreadId;3 w: @' p* F! ^

  67.   i0 E- s5 U) J- K. B1 Y, S
  68.                         while(true) //infinite loop ("Debugger")) r2 I! r: Z7 }$ A3 a
  69.                         {5 P7 `7 u- \( F: F0 M0 l, D
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx* u, I6 k7 {) r& Q6 f1 u

  71. " |/ K0 b3 p. z" h9 r. h( o% {
  72.                                 /*
    - n0 f7 E, U1 z
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

9 n# p. S. W- l5 n0 d8 {9 J+ U
, Y% V& G* y0 A4 ^+ m/ S4 K$ q3 o: \6 |' a6 J& l
商业服务端 登录器 网站 出售

13

主题

250

回帖

1232

积分

金牌会员

积分
1232
金钱
787
贡献
177
注册时间
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

主题

250

回帖

1232

积分

金牌会员

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

3

主题

99

回帖

5213

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-1 17:53 , Processed in 0.080656 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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