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

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

[复制链接]

157

主题

364

回帖

6952

积分

管理员

积分
6952
金钱
1984
贡献
4447
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) : x( r- I" _/ K: c7 v7 V
$ w7 V$ N; M6 t: j4 p* Z
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。( b8 L$ x# \0 g7 Q+ o

8 \* ]7 [( }9 X# Q2 d+ w& ~7 A
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    3 y9 {, F; z8 ~* E7 i
  2. //
    / g+ \  d1 l  g% v( n! k
  3. # ?2 d. t7 p6 B0 ~! |. ?
  4. #include "stdafx.h"4 H. m. f  E: [; |" ]! Y4 v
  5. #include <iostream>. ~3 z+ x# |! j" o, B6 u( O
  6. #include <Windows.h>
    3 f6 ?7 l( }9 T( p
  7. #include <io.h>
    0 h& _" c9 g) _# V1 y) `+ _( ~

  8. ( W/ `, O$ N$ {/ B3 ]+ q% V- w
  9. * V5 K' b5 U* m& _
  10. int _tmain(int argc, _TCHAR* argv[])
    ! y2 g$ o# T' I; P
  11. {
    ( S( v! [$ b4 d+ K9 v' ?' t
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    / ?: X" N6 |8 b$ Y2 P7 N9 e

  13. ! K; F! j5 @! Y
  14.         //查看文件“DekaronServer.exe”是否存在" N6 g( |% \- A9 ]  r. D
  15.         if(_access("DekaronServer.exe", 0) == -1)( s1 W& g0 V/ G4 V
  16.         {2 w6 {, S6 \2 S( S+ u8 N3 ?% C. |
  17.                 printf("DekaronServer.exe not found!\n");
    5 T0 b5 r0 p. y5 T: {
  18.                 printf("Program will close in 5seconds\n");
    % u4 ?, h  H6 |) y. Y' l
  19.                 Sleep(5000);$ t8 j+ e5 y6 \/ v$ Q
  20.         }
    1 C8 _8 K" e( e7 C
  21.         else9 ^& x& u/ r7 }' E
  22.         {2 a* X* ^5 b3 e- H/ p
  23.                
    ! ^$ g" p. ?) t! 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).aspx1 m, t$ V; u4 O6 x/ N4 b1 e
  25.                 STARTUPINFO si;
    % o2 e7 U' w- v7 [2 ^
  26. " Z7 h- i$ P0 f
  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% s! @# f3 d" [0 @- x
  28.                 PROCESS_INFORMATION pi;
    ! a9 K) Y3 f* A) m9 d- \$ b3 s
  29. & s3 K- G8 X! x" K. u
  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 L* S7 t, P2 W6 p7 t4 O9 j
  31.                 DEBUG_EVENT dbge;
    , I2 |3 Q" r1 }. h! x7 c! C, v% _
  32. , x/ M3 r) N# Q: W; F
  33.                 //Commandline that will used at CreateProcess
    & Q. F  ?5 l8 S* T' x% E0 F- z
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    " W' P, Q) J7 E8 t5 x/ D
  35. , o/ w# |0 R' G6 ?% K
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)7 P3 l4 ?# a: ^: j2 F  E2 S2 C( e0 V
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)+ _# z% T5 y1 M. j5 E% n) u
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)2 j/ ?/ L3 f7 S. w* ~

  39. 5 N5 i$ `0 e5 x$ x) W0 r, b9 f

  40. 7 U; A5 X+ R/ o
  41. 1 {+ S# x  v" n9 R- F0 E2 M1 x
  42.                 //Start DekaronServer.exe 5 l+ s. }2 F( Z- Z1 M- O7 g2 J( _
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    3 M3 d: F0 t7 [4 o
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)" A) x" A6 `/ Y: G2 D' T
  45.                         szCmdline,        // Command line7 G& x% }+ _9 o% K& u8 S
  46.                         NULL,           // Process handle not inheritable
    2 l8 G# n/ U$ r2 W, |! D: I
  47.                         NULL,           // Thread handle not inheritable/ Q% x4 `. |# N& t0 h/ G
  48.                         FALSE,          // Set handle inheritance to FALSE
    ! v, C4 @' l3 @8 n" K7 M4 T5 o( M
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    8 A- u, P0 |7 c6 v' ]# ?2 A2 C
  50.                         NULL,           // Use parent's environment block
    . g* O. m2 x  v5 q$ r
  51.                         NULL,           // Use parent's starting directory * W6 x0 Q. y: N' p. `* }
  52.                         &si,            // Pointer to STARTUPINFO structure
    5 o2 U$ A+ |6 N8 Y* C: y" [
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure  J2 p7 y% n1 |4 @0 Z4 z+ j  k
  54.                 )
    : R) e% m' I2 C5 M& S1 n
  55.                 {2 B+ C5 H! w  q& y- h) g- ?% G, E
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    : g. u, j" H: k2 t( Z
  57.                         return 0;. X. P" B+ _5 |4 T0 b( J
  58.                 }
    - T1 X% {, k- a4 P( W7 m: {
  59.                 //Creating Process was sucessful' _/ n( A/ p+ n5 m1 K
  60.                 else
    ' d/ p' L/ K/ [' R* _" \
  61.                 {
    ! c0 d7 o6 D& e8 N( \
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    4 F1 C% s. D: h  I! `

  63. 1 f6 ^! ?9 O, s) {6 |" R* C
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure" x. N- l) M4 K! S+ Z# z4 x, L* h* O
  65.                         dbge.dwProcessId = pi.dwProcessId;
    ) T, M# h7 C+ w
  66.                         dbge.dwProcessId = pi.dwThreadId;
    , [5 Q5 p* F8 E
  67. 9 |1 q  h9 p. V# q
  68.                         while(true) //infinite loop ("Debugger")
    / K# d" k% C) D/ e! F. E. t  }
  69.                         {
    , i3 y- H3 M$ {& d) v
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx7 J( S) W/ ?/ E9 L+ D
  71. 8 R/ N$ E4 Z8 {1 R1 `5 i3 r* q* X
  72.                                 /*% P. X6 N: a4 T- M
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

0 l/ t4 ]  l0 n8 S5 ]$ ?. Z
6 a, o6 R5 o. E" l( K  R8 X" y
) w0 [4 a5 t. P' w
商业服务端 登录器 网站 出售

15

主题

257

回帖

1228

积分

金牌会员

积分
1228
金钱
892
贡献
59
注册时间
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

主题

257

回帖

1228

积分

金牌会员

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

3

主题

102

回帖

6897

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-3-12 00:41 , Processed in 0.038526 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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