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

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

[复制链接]

154

主题

343

回帖

5865

积分

管理员

积分
5865
金钱
1837
贡献
3531
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
+ @, p/ |" h6 |1 j* Z$ Q% b
1 i5 T; f! R9 L$ O- u( D. C虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
' \6 I  l4 ]: Q: Z' r# [6 t: u. [" |, Y* w7 e- b' r, D3 r; L9 F+ D! l
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。0 W$ L5 D6 f. ~) z8 f8 c2 P
  2. //1 [+ F4 p6 c& ?) S( y, g$ A

  3. ! w% S/ K! I9 |$ K( U
  4. #include "stdafx.h"
    - R6 F- [, u: i2 Z' ~5 r, P
  5. #include <iostream>4 A' U+ C, K* q6 k0 t0 g) D1 e) t
  6. #include <Windows.h>+ l" _# J6 V* F" }( r
  7. #include <io.h>
    ; a9 J: u. ?: h9 V

  8. 1 `& r4 F' E1 a6 Y" ]1 o
  9. $ F& L- E) a1 q# o- Y2 C4 v6 \
  10. int _tmain(int argc, _TCHAR* argv[])2 T( o+ i1 g, l) t& T
  11. {
    . M/ F3 t, w, K, h1 a* |) x$ C
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    7 B0 K) T0 m8 `. Q6 U

  13. 6 P! b* Q4 C/ v* H1 k" {6 \1 d
  14.         //查看文件“DekaronServer.exe”是否存在8 e! D! M0 E# f: x
  15.         if(_access("DekaronServer.exe", 0) == -1)6 T( ^1 a( n, B; ?
  16.         {
    ( u' V! \9 j- l# w  _
  17.                 printf("DekaronServer.exe not found!\n");
    , Z( Z3 v/ @& l0 n; k
  18.                 printf("Program will close in 5seconds\n");
    6 W6 j( }5 i5 U; Z
  19.                 Sleep(5000);4 i) i: X% g# {
  20.         }9 B  K0 Q3 W  Q" A) h* @/ F
  21.         else$ i. e2 t) |* w2 [& Z- d0 _
  22.         {# S1 s- z& E3 g" f. Z: ?8 P
  23.                 ) U7 [2 F- c3 P# R, _% j
  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" ~! Y! N, e; O- w/ U
  25.                 STARTUPINFO si;, I3 R+ W3 k8 Y5 B- Y
  26. * h& L0 T5 ]7 O1 f' v1 e# c! ?
  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
    . ~' c- B- k9 Q5 W
  28.                 PROCESS_INFORMATION pi;1 J5 P) Y% Y3 ?+ x# ~$ p

  29. ; p: \  E8 \) I) G% ^
  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
    ) i3 q2 k& E7 r; h# {0 m# c
  31.                 DEBUG_EVENT dbge;
    1 h9 i: ~" _! c: ~2 }
  32. 9 ?: u" E" |6 m8 ]
  33.                 //Commandline that will used at CreateProcess
    " o& {" V% W. K2 Q! [+ A
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    # c1 L0 y; g" X% C; Y# d( r; b

  35. ' o% v( @7 U+ [, Y+ e
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    ! f$ N- \1 b8 a. m& {( ~3 V
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    - N$ ^3 v/ _2 S% V& A1 j) m$ X% A
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)$ J& {/ X# |8 ~

  39. + J$ E4 z' ^2 i( S  j" }+ h0 k* I4 x

  40. . l4 `: L: D$ ^: B' r  B; r
  41. % C9 `" H! d$ g( m- r' ?4 \6 q
  42.                 //Start DekaronServer.exe 8 s" |  h7 X2 F$ i; [' V3 s
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    # N" @0 k9 h0 X# f! j* m) o
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)4 x! [7 }8 f+ V* b4 P$ a
  45.                         szCmdline,        // Command line
    / U" k# n  P+ f1 _8 x- S
  46.                         NULL,           // Process handle not inheritable7 u) H: s- d4 ?) z! V$ h! x/ d& P
  47.                         NULL,           // Thread handle not inheritable
    - D& S. w4 c8 f$ R
  48.                         FALSE,          // Set handle inheritance to FALSE
    4 W0 O5 N' v- Q' j# z
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx6 Y+ ~; ?4 I' g3 o
  50.                         NULL,           // Use parent's environment block
    $ S5 i. V: ?6 f9 Y+ ^: @+ V, N
  51.                         NULL,           // Use parent's starting directory
    . l6 o/ |) t- b- B! S" M1 s6 k
  52.                         &si,            // Pointer to STARTUPINFO structure& o% ^6 b; B9 o+ s8 B& G
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    & e5 h9 J+ S# K) T4 N' Z5 p
  54.                 ) & x* V+ @5 Q$ u9 L4 m! U
  55.                 {
    ) X6 d) U7 d7 k+ q7 j
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );/ }. W% B' j, P( z3 o; t5 J4 s* e
  57.                         return 0;$ ]/ x# Y! P1 s8 p, {
  58.                 }0 r8 q: W, o1 I. z1 q- m& q- J
  59.                 //Creating Process was sucessful
    & K' h5 K0 Z! i$ Z- \
  60.                 else
    6 {! t% g: g+ Y" k
  61.                 {, i* X6 P' b: X9 P
  62.                         printf("Sucessfully launched DekaronServer.exe\n");8 ?1 `- Q) d& k8 O' c3 i( P3 n
  63. $ a/ e6 r4 s6 \- @$ I% m8 a: ?
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure5 n' m+ e9 e8 d" ]) ~
  65.                         dbge.dwProcessId = pi.dwProcessId;
    ! v8 T3 X5 c. W# C* P( H" a' E
  66.                         dbge.dwProcessId = pi.dwThreadId;- _: ~+ x6 @* K' p4 R) _( ]

  67. 0 v7 G/ N4 M1 C: z6 N
  68.                         while(true) //infinite loop ("Debugger")& M* X# Z, l/ f/ R. F& Q
  69.                         {1 g6 `, V) o7 C: H/ H& n* x; M) B# R
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx; A+ N# e2 e- d; T$ ^3 I2 r; y

  71. 3 l. u- ^' k1 [& H$ Z: v
  72.                                 /*
    $ z: L6 {; f( x+ v
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
, Z' V" j  d/ P8 w
4 j7 v7 x7 e' H
# W6 k9 G0 V3 `/ u" k6 P- u
商业服务端 登录器 网站 出售

13

主题

251

回帖

1255

积分

金牌会员

积分
1255
金钱
800
贡献
186
注册时间
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

回帖

1255

积分

金牌会员

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

3

主题

99

回帖

5413

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-12 08:15 , Processed in 0.067693 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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