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

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

[复制链接]

159

主题

379

回帖

7308

积分

管理员

积分
7308
金钱
2103
贡献
4667
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 1 _% X6 i) w/ e. O( z. ~

6 F& W' Q/ A4 y; W虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
, N5 u# A$ w) k+ a- H& w$ A: @' m. `( `* c! F' K- N$ V8 f
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。3 b) L' m# X" L' \8 \) Z
  2. //
    9 `1 Y5 [" b$ D" g% g0 h' e

  3. 3 Z7 }5 v, i, I  H0 W/ j
  4. #include "stdafx.h"1 t, A0 B% w" |
  5. #include <iostream>
    $ P7 i, m! f4 H( E) C3 ]
  6. #include <Windows.h>
    6 z! p. B0 f  G2 a/ S
  7. #include <io.h>9 ]! ?  Z' ?" V4 O6 N
  8. / j( j: Y! d( u& `1 O( |
  9. * @3 u5 Q3 \% ~1 q6 p" L
  10. int _tmain(int argc, _TCHAR* argv[])* `% a  k0 D+ c3 X* G# A
  11. {1 i" m' J: o; t9 |$ n
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    & x/ ]; C/ v/ s1 C

  13. 7 J! @# R# w! c
  14.         //查看文件“DekaronServer.exe”是否存在
    ) }, u* O- A; s7 ~& P; g. u
  15.         if(_access("DekaronServer.exe", 0) == -1), O& P* b; s. h- _+ _/ F8 w
  16.         {
    6 e% s/ D+ K6 ]5 A% N
  17.                 printf("DekaronServer.exe not found!\n");* v9 e8 V* r  \4 l
  18.                 printf("Program will close in 5seconds\n");1 B- p# h: Q- u1 T- D5 [8 ?5 I
  19.                 Sleep(5000);0 U) }4 C3 B5 n. _
  20.         }
    * S; T. x5 Y9 B. d2 U( F/ |* v
  21.         else/ c/ }0 o8 l- D/ r4 v  E
  22.         {
    * k$ j2 W: O$ ]& I1 y; Z) y
  23.                
    - _5 y# {" a' U7 T" L  @
  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
    " H) y4 B5 y* y
  25.                 STARTUPINFO si;
    & z7 V: r' ]3 A( c% V

  26. / O6 h2 |) y) q5 j, S; 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
    ) \3 q# ~. F- N: i
  28.                 PROCESS_INFORMATION pi;
    % }: K" ]( ], q/ J! L
  29. % W4 w* H" t9 B0 ~# [9 M1 t
  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" X" S) b6 Q: g3 V7 t7 R5 L
  31.                 DEBUG_EVENT dbge;
    3 \& c& x/ N; U$ j2 b% h$ n: ^
  32. : n, X2 y( S# P) c0 o- j$ k
  33.                 //Commandline that will used at CreateProcess$ F# ?) g: b6 b
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));; k3 C" _, P3 z% u* o4 U

  35. 6 A$ K; G& B$ ]& ]! h
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    ; s) c1 t: o$ @4 g
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)) {) l" Z1 w1 t2 X( ?& w/ k
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    * p- d: n: m% n: f6 X1 h# i% u  _
  39. * w2 p% a5 f  m* t

  40.   }9 A9 |  m' q, G" B

  41. ) `( C0 N9 ^$ w: M1 u' Y1 L
  42.                 //Start DekaronServer.exe
    8 u* Z* N9 y# V: F' k, r( M
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx, r' U8 @# L$ ^. {5 y
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)& n8 q% o( t$ B4 F7 `
  45.                         szCmdline,        // Command line
    8 V4 N9 H) }$ b( w) T4 ]8 f
  46.                         NULL,           // Process handle not inheritable
    ) V1 f+ a2 G. }& B0 M
  47.                         NULL,           // Thread handle not inheritable
    1 f" P, p: A& p
  48.                         FALSE,          // Set handle inheritance to FALSE" P0 L! u$ |3 y0 A0 Z9 ~& i
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    8 ?4 I: H; I# b: x# X
  50.                         NULL,           // Use parent's environment block
    2 [! J* @% C$ r( f: I4 C, E
  51.                         NULL,           // Use parent's starting directory 3 \1 N7 y+ M5 Q# `
  52.                         &si,            // Pointer to STARTUPINFO structure
    ) R- S# A7 x. m, Y& b
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    % j! T$ m" p, L2 }9 B' C
  54.                 )
    1 P* k1 a% C- M# n0 l. q
  55.                 {
    7 h* \/ }) E! q: j1 s9 O
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );5 P8 V- j" T3 ~* R' A7 [4 l
  57.                         return 0;
    7 E- B: n- r, q4 V# e  f
  58.                 }
    7 G$ k# U" x6 m  |2 x1 D
  59.                 //Creating Process was sucessful4 F, W& i) F1 |  n0 w& |
  60.                 else
    ! V8 x! b- J( F
  61.                 {: c; o% {- v- c+ R* x* n" o5 A
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    & q0 {7 d. ^2 N
  63. ! ?" ?9 g; x. o/ s: D0 s5 x3 a
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure. d- ~" S6 c  g' `) d6 {) L% i
  65.                         dbge.dwProcessId = pi.dwProcessId;
    9 a6 }* b" ]) i& N- x- {; G+ z
  66.                         dbge.dwProcessId = pi.dwThreadId;( p" x& H2 y3 R$ T

  67. $ b3 q2 x4 b+ D. y! U* \# ?1 a) j
  68.                         while(true) //infinite loop ("Debugger")
    ! F' K; _1 `' G  _2 m- q( l+ f
  69.                         {
    - f( G" \6 }2 ^8 w& N
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    ! S2 G. o  P7 V! v9 @- X% Y6 G" [/ T
  71. * p+ o4 m/ Q) N/ n6 ^
  72.                                 /*
    / i# k% E: F% u+ l2 i0 x
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

- I' q! V- ^# P8 E+ Z/ y. ~% u9 J& q' x' g) [3 P
/ n$ t) l0 n; A. A2 `3 L
商业服务端 登录器 网站 出售

15

主题

258

回帖

1267

积分

金牌会员

积分
1267
金钱
915
贡献
74
注册时间
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

主题

258

回帖

1267

积分

金牌会员

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

3

主题

102

回帖

7657

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-19 11:16 , Processed in 0.040555 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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