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

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

[复制链接]

151

主题

321

回帖

5508

积分

管理员

积分
5508
金钱
1753
贡献
3283
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
) C& L' z+ @4 U* u0 ]1 a! K' |
* a* r3 p8 @( x1 }$ j9 d2 g虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。. ~' E5 k) z4 O; p5 E
3 Q8 \# I: G; ?$ J1 Y
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。1 p$ D0 r! {$ f- U
  2. //( b  L  V# B) c' b# Z

  3. 6 Z+ T: S& a' F
  4. #include "stdafx.h"( c& r% l- w0 O
  5. #include <iostream>7 U2 R( G" q% s
  6. #include <Windows.h>/ ?" z0 N  `! I+ x/ N0 {
  7. #include <io.h>8 \! c' ^' \9 ]& }9 n; [8 |
  8. # [* f8 {$ c! b1 f2 M) Y9 N  N

  9. & S' g: i- E* {, a$ x. u! d6 w
  10. int _tmain(int argc, _TCHAR* argv[])
    $ N# V# T, c1 f, Q- Q
  11. {
    # N& x3 s; B+ i; A
  12.         printf("Dekaron-Server Launcher by Toasty\n");% X6 a: X4 {5 N, X  V: L4 W6 ?

  13. : C: V0 l+ v% G7 I  d) F6 v1 K" y
  14.         //查看文件“DekaronServer.exe”是否存在
    5 _' k: e+ m0 S+ `3 F* B
  15.         if(_access("DekaronServer.exe", 0) == -1)/ p1 u+ Y7 s, b; r0 W* m8 I4 \
  16.         {/ ~* ?* g) j3 E; x+ b
  17.                 printf("DekaronServer.exe not found!\n");
    ; T! E% `# c* H/ U, a% h
  18.                 printf("Program will close in 5seconds\n");
    2 \* ]0 x0 S+ X, I4 Y8 ?  |
  19.                 Sleep(5000);
    ( S3 p; G. O" }- z
  20.         }2 A  R& a" h1 R) m8 e  E7 X/ }+ W
  21.         else
    8 G/ f/ K/ H* l7 M2 J" j* v. p
  22.         {$ ]+ v! }! g" B! ^8 w
  23.                
    4 o7 G+ H$ F5 V9 l. o9 O  s7 E$ M
  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).aspx5 z, ~6 \4 Y, s5 {. u0 \
  25.                 STARTUPINFO si;, s& P- B9 ?/ I+ I
  26. & l0 @9 ^$ n- _6 u) B# M/ O3 U
  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
    5 J! d. |5 s9 x2 ~# ?  y
  28.                 PROCESS_INFORMATION pi;
    + m) M* @$ K+ z6 ^; A  B

  29. 6 {5 i! K6 r* h8 @
  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
    " h! i" N: Q; i  _
  31.                 DEBUG_EVENT dbge;
    3 ^5 [% V/ b) U* d( X1 J, Y9 Y
  32. 1 v# t. z  K8 E. m8 {1 `9 M2 L
  33.                 //Commandline that will used at CreateProcess1 i5 T  Y/ |( O6 ^. a4 Z* a) _
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    : ?% E; J1 z: u; m1 q! s& M
  35. 4 F5 Y* q: k1 h6 E4 [
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)$ e3 D) H0 w6 E" J: L, @3 p7 p
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    ) P- m0 l$ ~, P5 P4 u3 u
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)$ ~1 g, `! F/ x! n- J2 c% \; u
  39. # f: C( I. c9 d  O
  40. 8 B  _' ^3 V, p- E+ f) @% O$ G4 ?1 i
  41. . l$ x+ Z$ p$ I4 C
  42.                 //Start DekaronServer.exe
    ) L' T( ~, }. ~
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    % w# a; Z* O) g$ |  N& J8 u
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)- X0 @& C: O0 m, z. z( v5 b( W) C9 e
  45.                         szCmdline,        // Command line
    . p- h  g3 v) V& U0 q  @
  46.                         NULL,           // Process handle not inheritable( `" a( N3 Y" n; V! M/ ?9 X! ?, s
  47.                         NULL,           // Thread handle not inheritable
    $ ]% ]3 F3 s- k, x4 m) J( c
  48.                         FALSE,          // Set handle inheritance to FALSE
    . W$ ]9 c3 t6 ?0 w4 Q4 @# o
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    * D% R% F. r1 E. F1 d
  50.                         NULL,           // Use parent's environment block/ a* z$ f% W* s# r( p0 D7 k1 l
  51.                         NULL,           // Use parent's starting directory
    ! h" D, g" M3 M- y; p  C4 z+ ]
  52.                         &si,            // Pointer to STARTUPINFO structure
    % q4 }; ~; P. [2 N% a* u. X
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    ( q9 N* N. j( ]0 w' }" r. Y
  54.                 )
    ) ]: N/ @# f' S6 k
  55.                 {
    . Q6 h8 P4 E& G! d1 X
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );2 Q" X3 m$ {" k" X$ [
  57.                         return 0;4 {& K4 h6 K2 L5 |+ K
  58.                 }
    / e  `) x+ m+ M) V* C* \% Q8 k& g
  59.                 //Creating Process was sucessful
    ! J" [5 W+ n$ O8 Y2 {
  60.                 else
    # N- T, Y$ \$ ]/ e( t; v& o
  61.                 {# O/ n% O4 u5 ~2 g' C
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    ! g( I) s' t, n) W

  63. ! ~% m5 F5 H, q. x. n1 }$ h
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure, ^( L# D# G# D
  65.                         dbge.dwProcessId = pi.dwProcessId;
    % N% c/ @4 k- b& i* [6 i. c/ A# w" l
  66.                         dbge.dwProcessId = pi.dwThreadId;
    2 e* o  w& N+ h- }
  67. 9 p" ^/ c! P& v2 B5 ~  Q
  68.                         while(true) //infinite loop ("Debugger")# z6 q, N" I& G- X
  69.                         {
    4 g4 `& R3 T0 t2 K& n
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx5 f8 q9 t4 z; V8 V! ?
  71. 8 }/ k. s# [6 Y, x
  72.                                 /*
    + u4 Y$ i, z6 g; C' H) x
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
" w& N# r3 F$ h, ]- @4 c7 ~
+ J' ~' D: q1 c$ o+ T: L

" _9 H% w  N1 j- E
商业服务端 登录器 网站 出售

13

主题

250

回帖

1189

积分

高级会员

积分
1189
金钱
757
贡献
164
注册时间
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

回帖

1189

积分

高级会员

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

3

主题

97

回帖

4551

积分

金牌会员

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-10-27 11:40 , Processed in 0.078459 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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