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

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

[复制链接]

156

主题

354

回帖

6511

积分

管理员

积分
6511
金钱
1908
贡献
4093
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) * C* Z# C! _8 K8 v0 Q8 S
2 d* h. c7 [6 t5 y
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
7 ]: q3 Q9 D, i9 A% y* n6 B  K
1 W" ^' R; Q/ h& y( S9 N6 k
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    1 v6 Q: D6 b) i
  2. //
    9 _6 A* U1 u  G: @

  3. 0 {1 i. l# P, W5 u* D9 w. ?
  4. #include "stdafx.h"
    + r# \% \' u% J2 R6 A5 d: u" q
  5. #include <iostream>+ u" \/ K1 H# D1 Z
  6. #include <Windows.h>
    5 Y# M- R$ l9 u- \9 O) t5 j9 _
  7. #include <io.h>
    5 _/ G0 ]: |/ o

  8. & j: T' A. a0 D, ^6 i2 @

  9. " h% B9 m5 T7 O0 R- k
  10. int _tmain(int argc, _TCHAR* argv[])
    * n; q. T8 e  t& W
  11. {8 O- H; M0 a! j6 V4 A
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    $ P5 ^. X3 N  ^; a

  13. : `- ]3 L% S5 ^4 Y0 I
  14.         //查看文件“DekaronServer.exe”是否存在
    2 ?" `+ R7 B0 j( ~: ^8 O# y# Y
  15.         if(_access("DekaronServer.exe", 0) == -1)
    ( |- H/ e" Z8 A& a2 b& G
  16.         {
    4 a) ~0 f& t0 y7 l2 \/ R) z& i
  17.                 printf("DekaronServer.exe not found!\n");- _: n5 P. |) y9 V( A
  18.                 printf("Program will close in 5seconds\n");
    ' Y7 J  ]5 n0 `1 k; K& ]
  19.                 Sleep(5000);
    4 V% ~' W& a4 [+ y: p
  20.         }+ F7 j1 u7 n, N0 i4 Y$ P
  21.         else7 n* M# ?0 ?% N9 E9 W6 ~
  22.         {+ n. |  P- E; e/ K0 ]5 z* W. ?
  23.                 $ }; \8 j+ p; e
  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% a( K- a; D+ p4 N3 K" e0 ]2 G: b
  25.                 STARTUPINFO si;6 A% i4 P3 ]  T8 c. Q/ t

  26. - U5 n  K8 Z. }, R
  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
    + r1 h* O. V: M; ]4 k' S
  28.                 PROCESS_INFORMATION pi;
    " r$ k  `* @4 e

  29. ' l' |7 m  q/ x0 q) 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
    + Y9 C$ ~  T2 n; J* v9 Q% `! K) |
  31.                 DEBUG_EVENT dbge;
    ' O* F* F# e* Z; j# ]

  32. " I8 X' N7 U+ r6 Y" }$ C
  33.                 //Commandline that will used at CreateProcess
    + ~/ \3 E2 ^& x8 S( Y2 r* _
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    ( ^5 K- d7 \8 A0 u

  35. / T. h* I0 I" k- f
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    % M) _9 D* ^, {1 Y6 ?
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)5 a! r% W& K9 ~
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)* [, r3 I4 J6 A) e9 Y; }8 ^4 [& {

  39. + o+ b+ e* \' n# ]7 k
  40. % n8 E/ w- k3 X) i0 e3 V
  41. 0 e9 Q5 t' j! K. D
  42.                 //Start DekaronServer.exe
    ) D3 u: b7 F7 a. g
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx) u2 z  F7 G2 m- T+ Y) w
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)2 V% V0 I8 D  T1 n0 [
  45.                         szCmdline,        // Command line
    2 z4 z% F, m4 w; l2 `* j( S
  46.                         NULL,           // Process handle not inheritable
    , G- m3 D1 m. D7 u
  47.                         NULL,           // Thread handle not inheritable
    9 Y. X2 e8 e  L1 n' u% q3 g; L
  48.                         FALSE,          // Set handle inheritance to FALSE
    / M0 D4 \( n3 m, d1 g
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx- _+ C0 A& c0 I5 M" L
  50.                         NULL,           // Use parent's environment block0 j9 n# J0 L) S8 P8 w6 f
  51.                         NULL,           // Use parent's starting directory * N) i' w- _6 V& S
  52.                         &si,            // Pointer to STARTUPINFO structure
    $ T. V5 X8 V3 x. ]
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    6 ~- X& x& w. l  n4 X% h% \2 g
  54.                 )
    % W5 N! m* g& n( b% f
  55.                 {/ H" I. l! T4 t* U
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );- j! K% z# T$ N- A4 r7 ^4 J
  57.                         return 0;
      n* F: [( }; H9 o
  58.                 }9 V7 @0 j& z1 N. i8 J! B( h
  59.                 //Creating Process was sucessful
    , U* L- J+ }. Z, [2 r7 ~
  60.                 else! }2 b+ e+ T1 X9 u; V
  61.                 {  H: V( Y1 q9 B( i1 K
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    - F; w: H' ^- ]
  63. 1 x/ O5 G0 }7 C6 s0 d6 T
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure% V% U) Z& x0 I6 u+ _$ g2 V
  65.                         dbge.dwProcessId = pi.dwProcessId;
    0 v# `) U6 P! z; D0 M7 O
  66.                         dbge.dwProcessId = pi.dwThreadId;5 ~6 P0 M8 S! r8 Q0 n. K2 G$ c

  67. " @- b8 y, l  k6 o5 Q
  68.                         while(true) //infinite loop ("Debugger")
    2 ^- Q, n+ Z  K" V4 R
  69.                         {
    , r6 w0 T+ ~# Q
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    & d4 W: K& p, `4 H! Y# U. x: M  l
  71. 7 Q7 r6 W) e8 l3 Y4 L3 V) B
  72.                                 /*8 ?; R* K; m  [5 j
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

: N( C8 \: K5 t8 K) t* _& G9 B( F

8 f/ K9 O5 h& U4 n. `" y
商业服务端 登录器 网站 出售

15

主题

256

回帖

1241

积分

金牌会员

积分
1241
金钱
853
贡献
112
注册时间
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

回帖

1241

积分

金牌会员

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

3

主题

102

回帖

6101

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-24 15:06 , Processed in 0.075794 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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