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

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

[复制链接]

160

主题

384

回帖

7382

积分

管理员

积分
7382
金钱
2118
贡献
4720
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
: B. Z3 _: n& y! |. G* Q9 o4 d7 T' Z. q/ f, Y! B3 i# d9 A
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
2 ^) G: N* u1 h4 \7 E* D/ N$ g3 `1 a- c9 k  H4 {
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    : N  c* s1 h% {# S
  2. //! S2 W$ U. V) @% d
  3. $ ?0 V& s. D% C$ J( ~; Y
  4. #include "stdafx.h"
    / I, E9 R7 ^- `: r7 S( T
  5. #include <iostream>
    / [5 p6 `0 v. p& O) x2 |. U
  6. #include <Windows.h>
    8 E7 ?+ }  M) A7 H
  7. #include <io.h>' C! g& G  n) V, q8 z( k' e/ s- O
  8. & p$ x1 t( H6 D! S
  9. 9 Z0 Y" A! |; w  d4 S) l) F) p
  10. int _tmain(int argc, _TCHAR* argv[])3 I0 Y! d0 [, `& _
  11. {8 h& H5 [( a7 O3 l' x/ g9 D( U$ k
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    + l$ a! }9 g  M6 W( n  _
  13. 5 j; u9 Z* V' K- ?) a1 N
  14.         //查看文件“DekaronServer.exe”是否存在$ Y: \% o. ]0 G/ J* E
  15.         if(_access("DekaronServer.exe", 0) == -1)8 y% z) l9 w: x) K
  16.         {" O6 M, u4 |& H" W* x
  17.                 printf("DekaronServer.exe not found!\n");
    , M. C, B) `4 m& Z  u
  18.                 printf("Program will close in 5seconds\n");) B' d5 @5 q+ o! t
  19.                 Sleep(5000);
    3 E4 J$ F/ ]6 d  j/ ~0 `
  20.         }
    ! u/ y3 B; f( e! ?2 i& ?# w
  21.         else. j  A& b8 @0 C  K- G
  22.         {: e. m/ O3 a$ @2 H' C4 k
  23.                 3 U/ e3 m4 l$ G; l8 G" C- j" r0 H
  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
    * J; u. p# }& D; G
  25.                 STARTUPINFO si;2 t3 o9 ~5 h5 v( V& E; q; \

  26. ! i& j( T9 ?3 N! x+ t3 _! }
  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: }' q7 @- b1 t% u
  28.                 PROCESS_INFORMATION pi;7 |9 V2 b0 U4 o; P, F

  29. # |) w2 ~9 T$ F  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).aspx1 }( q8 j  t5 r7 }  c
  31.                 DEBUG_EVENT dbge;& q9 M/ `! J# n, X

  32. + O8 N4 L/ l: ?- a! o
  33.                 //Commandline that will used at CreateProcess& f* A) q$ K7 d0 f' L6 J) s; ]  {
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));& u. o3 B3 z2 `/ x7 i  ]
  35. ' C8 O& ]2 Q. ]: v
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)2 X& V. m6 ]* S+ Z& z1 v' {
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    2 E( i9 R# q! g! ]
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)1 ?+ V! i/ _: w
  39. ' u  \- Z8 u, w5 E- `

  40. 7 X8 I/ Q& o8 C1 Z' u( k

  41. " L3 z1 P* s$ Q5 _; b9 j
  42.                 //Start DekaronServer.exe
    5 G: n) i3 ?/ X$ D4 n' x/ K
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx) V: C$ {) f( {) ]+ U7 F
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    / U' h/ Q3 f) x) f6 l0 u) H
  45.                         szCmdline,        // Command line
      f- P! H' Z3 O3 w. E
  46.                         NULL,           // Process handle not inheritable
    ) O8 L8 Y+ i) f: U6 U2 W
  47.                         NULL,           // Thread handle not inheritable9 `, M6 Q# J2 L" y
  48.                         FALSE,          // Set handle inheritance to FALSE/ L" l: r3 _  W, @
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    % r2 T9 d" `* U" m2 Y+ m
  50.                         NULL,           // Use parent's environment block
    : t5 H! z2 R5 E2 n' e5 u2 D/ J
  51.                         NULL,           // Use parent's starting directory 1 z6 L2 {! t# A- j/ g
  52.                         &si,            // Pointer to STARTUPINFO structure% \; X7 S: k9 p6 L! G. U/ A4 ?' z1 S
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    " a( {1 ~9 W* o3 e* C5 X# I& ]# I
  54.                 )
    * J) g# z$ E" L+ u- F. i6 J( [1 \
  55.                 {
    : v# X4 n) u6 P: a1 Y, z6 g/ C
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );1 u2 Y3 q  K/ ?4 }8 x$ V
  57.                         return 0;  s, B5 v. @& x
  58.                 }
    * ^' r* {9 N6 V) b- V
  59.                 //Creating Process was sucessful
    6 u5 ^& T3 i' _3 s
  60.                 else* z, f7 X# a* l
  61.                 {
    * V  y% F; I9 X
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    & b5 j8 j2 c1 C6 b9 @# n

  63. , T8 A/ E2 e' e. e
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    3 b' M! F1 i2 W8 B* |
  65.                         dbge.dwProcessId = pi.dwProcessId;
    0 w5 S) t6 D$ v0 J! O
  66.                         dbge.dwProcessId = pi.dwThreadId;( {0 J' C1 ~6 o; f
  67. ' s; ]2 |5 n" n4 A' u2 P9 v
  68.                         while(true) //infinite loop ("Debugger"). A9 @8 p0 L* p1 k1 i% W( T
  69.                         {  `2 r; |  h* e% ^9 K
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    5 {8 Z9 g9 y/ ~

  71. 3 n1 o. n% ?* l2 z' J
  72.                                 /*$ R6 g% d7 ^" d9 _& ~9 l  ~( }
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

( ~# v1 E& p: T: ^$ y
6 h: |  Y5 O& A1 f9 {5 k* ]: e, E& u
* x% y! Q. A9 l2 v( e# A: b- B% N& ~
商业服务端 登录器 网站 出售

15

主题

259

回帖

1275

积分

金牌会员

积分
1275
金钱
920
贡献
76
注册时间
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

主题

259

回帖

1275

积分

金牌会员

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

3

主题

102

回帖

7777

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-25 00:39 , Processed in 0.044748 second(s), 29 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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