找回密码
 立即注册
查看: 5447|回复: 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 贡献)
( p5 B% h5 y- J7 ~% k
$ p: x8 d- B, G- l虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
$ B' E6 c7 L+ ?! e- k. k  F
( R4 P$ [) m- o% F2 W8 a% J4 s9 h5 q
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
      E! I& t8 s- y$ I3 ^) \6 t* t7 N6 B9 C
  2. //
    5 b4 T1 L- A# G! ^9 b+ n" S6 f- `

  3. , a" F# Z6 P- B; Z3 R. p$ Q
  4. #include "stdafx.h"5 N% E) u+ N- I: D2 ?+ Y9 L
  5. #include <iostream>
    ; p7 S" U; w+ D5 c
  6. #include <Windows.h>
    2 C# i" T0 `3 L  p  t/ m6 N
  7. #include <io.h>
    5 J! ?1 _4 u0 }* J5 K$ C
  8. ! z& @0 q6 M1 v+ W( e% W0 R7 d
  9. ' _7 B' O: R, [/ R( L  H; E
  10. int _tmain(int argc, _TCHAR* argv[])0 P, ?) c. U; p9 H; D
  11. {2 ^  `' K4 y5 a/ q) k  O- z0 J- A
  12.         printf("Dekaron-Server Launcher by Toasty\n");7 J- {: c; N9 f. \$ R3 L3 J

  13. + Y; @% @7 U7 j( C0 n! ~
  14.         //查看文件“DekaronServer.exe”是否存在; c& Y: \: \# Y2 E- |8 z
  15.         if(_access("DekaronServer.exe", 0) == -1)
    ; d  G! l5 [0 n  _
  16.         {/ `) ]5 O8 g& p* H; {$ {' K/ h
  17.                 printf("DekaronServer.exe not found!\n");
    7 u) l- L7 V' b
  18.                 printf("Program will close in 5seconds\n");2 b, @2 d5 C! ~) I( ~# w' G" }
  19.                 Sleep(5000);
    3 E' a* ?2 U0 }" `
  20.         }  c  X1 R0 S9 M1 J. B( b( l% Y
  21.         else
    & m& J1 F/ Z0 `5 O% T1 g4 M$ I( q
  22.         {
    + K6 X1 @$ I3 g! o* I
  23.                 7 G+ @) l! Z7 M! p# i9 H' b  H- 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
    / r" J( [7 T' X8 K: R; L
  25.                 STARTUPINFO si;
    , e, M$ ?% ^4 P) B8 z* @

  26. , C$ ~5 Z& p7 |. w- @, T4 C, F% m
  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) c0 h; @" w' M( p% A) a- Y
  28.                 PROCESS_INFORMATION pi;# y' J( q0 F+ f4 J! {3 z# o, e
  29. * P* z+ {! Y$ K4 D9 r
  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! D; K# \# X% k
  31.                 DEBUG_EVENT dbge;  A  n! }2 f; I) M7 ?6 ^

  32. ! f1 G& F7 _0 i1 }' s4 F7 P- j
  33.                 //Commandline that will used at CreateProcess$ W, _" E  h0 ?
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    - ^- P- q. p& S; N( m$ b5 E

  35.   h1 l) }9 p9 K5 ~1 k  n
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)" O9 R6 h  s4 B& w+ S; `3 W; U
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn): R8 \+ V4 {: r
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made). B3 K% F& ^# D& k5 n1 v* d: m$ w

  39. % F1 O* M3 O: I: C

  40. * z) Z3 z8 Z5 h( R5 w2 s5 i

  41. # ^) B' ^" b% l0 \
  42.                 //Start DekaronServer.exe , X( ^# }6 n! E
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx8 N0 h- Y2 M, B3 u' ?0 D6 V- J
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
      O* I& B$ G2 ?+ I
  45.                         szCmdline,        // Command line
    # \* i0 N% S! T9 f
  46.                         NULL,           // Process handle not inheritable- P/ x, N9 ~; o: u
  47.                         NULL,           // Thread handle not inheritable1 [* q4 \4 ~& q
  48.                         FALSE,          // Set handle inheritance to FALSE
    / m# d5 B7 O; @
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx" g$ ^, ]/ A+ F% Y
  50.                         NULL,           // Use parent's environment block" X# D0 {# i1 |& M: {
  51.                         NULL,           // Use parent's starting directory   [1 D0 `- n2 `( Q" O% {+ v; |- S- D3 v
  52.                         &si,            // Pointer to STARTUPINFO structure
    - e, k  D' Y1 ?* B, n' o, A! C
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    ( h: N+ n; c( L, h  j+ v1 U; r
  54.                 )
    % A% U2 i8 v9 ?6 v1 a3 I
  55.                 {
    4 Q: W2 ]. D/ J. k0 {
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    # O# _( f/ i2 H0 Y7 R
  57.                         return 0;, V0 d1 D0 y% q. X& G. G
  58.                 }
    + y% ~$ S  q. E0 Q) }) C$ b
  59.                 //Creating Process was sucessful2 B$ |+ c' ~& m( j! `$ s
  60.                 else
    1 |1 ~$ [3 q7 x3 t. m  C
  61.                 {
    : p5 z- p: f  p0 k) h
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    & z& p* Q; C1 S& v
  63. 4 m4 }& F2 M/ B2 V
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    9 P" w; r3 ^/ ]6 ?1 c( L8 e
  65.                         dbge.dwProcessId = pi.dwProcessId;
    / h( _# s2 @# g
  66.                         dbge.dwProcessId = pi.dwThreadId;
    5 N  U1 ?2 Z2 F% I* l# i
  67. 9 E) {& X# a9 C0 O# m
  68.                         while(true) //infinite loop ("Debugger")
    . H1 K* v+ A* M. ^/ y, e
  69.                         {4 o$ o6 l) A: w0 l+ i5 O8 S
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    , \( Q0 y2 @6 Z6 i8 ]! v# s: d

  71. / m& v  n, m. O$ `/ v8 F, _
  72.                                 /*! N. K) y3 `4 o7 c
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
( R0 D# D1 j% M# i, I1 ?! h

3 W1 ]3 k) J0 Y1 _$ s9 c1 B' g. f7 T
商业服务端 登录器 网站 出售

15

主题

256

回帖

1271

积分

金牌会员

积分
1271
金钱
875
贡献
120
注册时间
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

回帖

1271

积分

金牌会员

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

3

主题

102

回帖

6581

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-18 19:19 , Processed in 0.065911 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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