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

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

[复制链接]

157

主题

364

回帖

6927

积分

管理员

积分
6927
金钱
1964
贡献
4442
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
. i4 [& B( c8 k0 i. ?2 [+ J3 r3 [
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。1 b) |5 c" T  a9 }) L- `
& P- U# V8 F  D; Y: l
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。8 n$ h5 K+ i$ D8 e3 G0 _8 T# q
  2. //
    - C6 j5 [- c& ]/ T2 [
  3. 9 q7 _# e7 O$ h2 M
  4. #include "stdafx.h"
    3 r% g2 P( h% D/ ~6 O5 Y$ y
  5. #include <iostream>
    0 g: H( I5 Z7 w% p
  6. #include <Windows.h>
    + S: J8 F1 z( {
  7. #include <io.h>& N  G1 P2 a+ r* W5 I3 _
  8. # Q: }/ b. `8 z# j* }$ r! X
  9. * F. M/ b* J, P- S, U! w6 ^. M% K
  10. int _tmain(int argc, _TCHAR* argv[])
    7 W4 l2 ?$ `5 k& o2 X2 h! ~
  11. {
    , c& `! v6 Q" \
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    0 p: A5 z7 n* f, g+ f( ?

  13. . I: `' w# J( V$ `  Z1 R. Q; x
  14.         //查看文件“DekaronServer.exe”是否存在- x/ @1 E# }% p! t, Z
  15.         if(_access("DekaronServer.exe", 0) == -1)
    ! G  b) i8 [+ \6 H, J6 F
  16.         {
    , R9 I3 ?9 @* E/ N% \) ]' Z
  17.                 printf("DekaronServer.exe not found!\n");
    * P4 q+ g  s' l
  18.                 printf("Program will close in 5seconds\n");
    $ J! l* A5 r  ]# x6 v
  19.                 Sleep(5000);/ J3 T; j% ^( G, A8 N# _
  20.         }3 X  d! B3 t. ?( B" S
  21.         else, m8 ?) ~, a& ^9 Q& x, w8 O$ B
  22.         {( u0 g0 z$ l0 Y/ l# o! ^4 x
  23.                
    1 f( i$ z0 q, h8 g* R: D& D0 j2 P
  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* r' ~% c/ e4 Q
  25.                 STARTUPINFO si;
    " i& I* [: ^1 b2 ]) W7 w- ~/ w/ H
  26. 7 v+ {6 G0 w% Y$ B! u. u- N
  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 U! H) _! j1 g* h/ a" @  }
  28.                 PROCESS_INFORMATION pi;8 i: }* k: A! R% v$ u& }2 y

  29. 2 W4 Y/ _+ `, 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).aspx
    " r& z+ c6 w, o1 V8 X
  31.                 DEBUG_EVENT dbge;
    0 M, |! \+ v. j0 }
  32. * A* E" V9 Z* A& P6 Z
  33.                 //Commandline that will used at CreateProcess
    4 \3 O2 v2 T9 O7 M" m6 Y, S
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
      g! p0 A9 o7 N( q4 h# M6 {  M

  35. . g5 D* A0 g1 Z; Y1 u/ V
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    9 @3 A1 L) L1 X4 [0 [, A' _
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    / q% }5 D/ C2 n' d
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    2 v, D/ X5 T6 V# U

  39. 9 k+ P3 h$ u: B- G

  40. - s8 A- \3 e2 i! d3 |" x

  41. , _% G% c' {/ I$ I$ r* j2 W0 ?
  42.                 //Start DekaronServer.exe
    . E- R8 K4 W3 W. c) j& ]% g& X
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    5 `. X/ _  T/ Y9 c
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)4 o4 M/ k! Q- X+ V0 e/ i( V  K
  45.                         szCmdline,        // Command line
    3 G8 ^5 F3 Z( Y. S- R, F; n+ g
  46.                         NULL,           // Process handle not inheritable
    ; z' s: s% ]3 l1 o" @  b
  47.                         NULL,           // Thread handle not inheritable
    6 s% l5 ^- l. f0 Z) D
  48.                         FALSE,          // Set handle inheritance to FALSE4 P2 F% ]6 B  v) _' u2 v/ p4 `2 B- s. G
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx1 p' U2 a" l& v. N. z
  50.                         NULL,           // Use parent's environment block0 {0 e& k! F9 J6 S0 q. A
  51.                         NULL,           // Use parent's starting directory ) K7 A! c3 p2 k: j. e, z& D) M
  52.                         &si,            // Pointer to STARTUPINFO structure
    1 b1 l( h& J4 N# N0 a2 O/ w
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    . I  ]+ U; S: N+ w
  54.                 ) " Y* x# ~# y# r* Y) S
  55.                 {6 _3 ?4 O" q9 K8 J5 \
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );0 t2 h. q: W- @" i, X& A2 a! [! t
  57.                         return 0;
    * j/ Y; T" Q  S. |
  58.                 }
    ; _" w( U/ j: {8 n( J+ J4 {
  59.                 //Creating Process was sucessful* X9 S" i: F, `8 C! j( e
  60.                 else
    " O, L. a, V1 B* i+ _
  61.                 {
    : o' T' L, c/ e6 X0 K, ]
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    3 J, B$ ]6 l7 m. q3 T) u/ c

  63. : I7 G: F4 A  G* h
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure* c7 o% A3 j. v
  65.                         dbge.dwProcessId = pi.dwProcessId;# _- M% J3 @. ?, U! i" ?0 U
  66.                         dbge.dwProcessId = pi.dwThreadId;
    4 E9 o, K7 ?6 w7 _

  67. : z) q/ K' F" b, P; D1 m+ u
  68.                         while(true) //infinite loop ("Debugger")
    0 H, ]/ |6 U6 _* x& L$ P
  69.                         {
    $ p5 Z2 X; x0 F  i. }
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    ! D( n1 M, d8 G9 N0 V; `* m
  71. 3 p* [( J* g/ E! |' @, \3 k3 y
  72.                                 /*' t8 u) l% b5 y0 a/ R. c+ ?
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

' k( p7 F7 o' P# L/ U. R  u& h' ?5 M+ ^7 K  }& C5 M

) q5 k2 o' N% r% f& o; n3 L$ }
商业服务端 登录器 网站 出售

15

主题

257

回帖

1226

积分

金牌会员

积分
1226
金钱
886
贡献
63
注册时间
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

回帖

1226

积分

金牌会员

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

3

主题

102

回帖

6699

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-27 00:33 , Processed in 0.055047 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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