找回密码
 立即注册
查看: 5490|回复: 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 贡献) ; R7 \) ?6 i& F% l: v

, C3 |& a. h9 d9 T1 T' S虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。/ H, w' L$ C  V1 c! [6 O

* w7 E+ f* P4 a
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。' c: j  o5 u, W" M. k
  2. //8 z1 F9 h8 Y, O  Y
  3. 0 i& a* X* @2 g0 I2 s
  4. #include "stdafx.h"
    8 ?  ^: W5 ^2 E$ p. u4 K2 j
  5. #include <iostream>( }( o3 v8 \) U$ l9 y
  6. #include <Windows.h>! U2 _1 Z8 H; c$ P
  7. #include <io.h>
    ) d) V8 S: v% ~: x
  8. 7 V3 [) Y( K! Q7 J

  9. $ W: D% j; v) }
  10. int _tmain(int argc, _TCHAR* argv[])" Q, U4 d) k& z9 A1 ?
  11. {# p) |% h( h: b! T# s
  12.         printf("Dekaron-Server Launcher by Toasty\n");% j, O* q% s6 u7 E* J8 q% {

  13. 6 _' s% ]# m* [" x. [- F1 U
  14.         //查看文件“DekaronServer.exe”是否存在
    9 s8 P; T5 L  X2 r/ g8 I
  15.         if(_access("DekaronServer.exe", 0) == -1)
    . f- d! g8 p% x" r: N" ~& \6 T
  16.         {9 i: U& J) U" r5 D; ^: F/ V: A# l
  17.                 printf("DekaronServer.exe not found!\n");2 B! g" t$ h' ?% ]( T5 ~
  18.                 printf("Program will close in 5seconds\n");5 U4 i* o; C! t3 p) q& v  Z
  19.                 Sleep(5000);
    " V! S2 k- X1 ^# |) q4 ^+ h
  20.         }
    ' g  K/ r! N) G6 J- i+ ^5 j
  21.         else
    ! E# o+ i. V( e6 C
  22.         {# @, o) E4 w: h3 k
  23.                
    2 C! H2 N9 C4 y6 a
  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! T) C- \* B! k5 c: G& x
  25.                 STARTUPINFO si;
    # z, z6 m* @, o/ D* a2 `5 ~% g

  26. + q5 g7 k. m$ X9 p2 V
  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
    ; w1 |! O( ], G
  28.                 PROCESS_INFORMATION pi;# z3 D; u2 T) q9 n, ~- t+ Z

  29. 0 q; i( v$ ]3 c+ x% n; _
  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% v; x4 w* E$ H' O0 T" ?" f) p8 c( p
  31.                 DEBUG_EVENT dbge;
    0 t) T& v  q0 U+ B1 ~

  32. 4 X3 ^2 ?- X3 u
  33.                 //Commandline that will used at CreateProcess- u% b9 c1 q" @+ Y7 \/ \. V
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));, f3 K5 N: y# B8 E: t
  35. . R, z4 v: W- K! {, n" o, A9 z8 V; I
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    & J* O6 t7 _1 c; ?
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    " Q/ h" N6 g  o7 I5 v
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made), H- ~0 e+ I$ x+ r9 m
  39. ; ^, ?4 [0 N! [) h* x+ i6 i
  40. 5 l8 A& h8 R! T0 ?
  41. 0 ]7 t* }; o/ @9 z& Q% h/ m
  42.                 //Start DekaronServer.exe ! X4 f- Z! P& k0 J/ [
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    ) Y& z  e* m$ R9 l1 E! V3 q2 k
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)/ |2 X' x9 G% K& P
  45.                         szCmdline,        // Command line
    % K: m& Z- P( [: b9 y( N
  46.                         NULL,           // Process handle not inheritable
    5 O6 K0 M" V+ y
  47.                         NULL,           // Thread handle not inheritable/ G2 v1 Z) m  {' E8 q
  48.                         FALSE,          // Set handle inheritance to FALSE3 [# l& S* |* F3 F6 f+ y; h( U
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx  n2 X" e+ C( B
  50.                         NULL,           // Use parent's environment block5 T  [/ E' m9 q3 g) Z
  51.                         NULL,           // Use parent's starting directory
    4 c! W1 n' t; Z; v3 c+ `6 r" K+ b
  52.                         &si,            // Pointer to STARTUPINFO structure8 T* r2 ^- ?! W. f- t
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    ( V: b; F- c: g
  54.                 ) 3 ^4 L- V, g% }( x9 B% P
  55.                 {$ u( O0 Y% m/ `7 B
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );  ]0 P% |$ z  |# l3 I
  57.                         return 0;
    - D3 H/ P, ?( H' ~- Q5 ]+ R2 j$ Y& T
  58.                 }
    & I5 O! _7 Z7 V
  59.                 //Creating Process was sucessful
    5 m6 x/ B8 }! r, z5 ^
  60.                 else" P& }/ V5 |2 m6 Y
  61.                 {
    2 |3 y9 H- Y0 B- a' x( h% e
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    : z/ y7 L9 v/ ^  G" I
  63. : _3 G% u5 @7 u0 ?* G( x4 m
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure+ s- ]2 s9 _# T1 e
  65.                         dbge.dwProcessId = pi.dwProcessId;$ C8 x8 u7 ~' g8 g* Q" g* F9 b5 m: g
  66.                         dbge.dwProcessId = pi.dwThreadId;
    9 [- [8 o$ T. Q2 U4 r) s; b

  67. , w" s0 w1 ~. y8 R! _: t
  68.                         while(true) //infinite loop ("Debugger")
    $ N; L8 Z9 b% S% t7 d; @+ ?0 q
  69.                         {
    % p: M( w3 ~5 p2 O
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx0 u9 ^) h$ K) z" y* D  x
  71. ; N7 [& p2 i  j  T& x) a! U3 m$ p" `
  72.                                 /*
    ' H' g% C: J# @* h2 N1 K
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
4 v1 h+ r6 S6 n6 i* t# K  \

4 J* [0 Z5 Z( a
' l* k  Z" O; j8 ^7 @; u1 h
商业服务端 登录器 网站 出售

15

主题

256

回帖

1274

积分

金牌会员

积分
1274
金钱
877
贡献
121
注册时间
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

回帖

1274

积分

金牌会员

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

3

主题

102

回帖

6607

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-21 06:00 , Processed in 0.057246 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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