找回密码
 立即注册
查看: 5503|回复: 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 贡献)
) n! }! p* H4 ~4 C' j# _
) n& I5 R7 E( u8 K# `1 c( S虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
& }( g( J; o  n) g( `
& K# l: Y- f: O( L
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。/ n* P; r0 ?! o/ V4 Z( e. K1 I# {
  2. //
    . m7 @0 z$ @* g2 h# \9 S8 w( ~
  3. 8 F7 n; U5 H, {: |4 Q$ D$ M$ _
  4. #include "stdafx.h") A# e( ], f- r
  5. #include <iostream>$ I4 @$ Y6 z6 \( A; u
  6. #include <Windows.h>( W, `2 R% W3 v4 u; s
  7. #include <io.h>
    , X6 @% \" |$ F' J0 e, ]2 e3 c& r3 P
  8. / }7 G; L" j) }$ b8 ]: j9 C* ~
  9.   h# Y% r) F. ]3 D( ], R
  10. int _tmain(int argc, _TCHAR* argv[])" o, D4 d: B+ Q7 Z
  11. {
    ! n# M5 Y% ~) v, B% C% V
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    % H  x7 D4 O6 w

  13. ' J% O9 \$ k& @
  14.         //查看文件“DekaronServer.exe”是否存在- c! s# I. g$ H
  15.         if(_access("DekaronServer.exe", 0) == -1)
    / y4 }) O2 j5 D+ y
  16.         {1 N7 r( `6 y2 X+ h
  17.                 printf("DekaronServer.exe not found!\n");
    % Q5 P) P* z$ g$ g* L: }% {
  18.                 printf("Program will close in 5seconds\n");
    * g( Q) a8 r( N
  19.                 Sleep(5000);
    3 g- n1 ]4 t5 b& w0 ~
  20.         }& L" I0 l- Z) M, O5 h
  21.         else
    * e5 }; Q4 K3 K% ~" y  E9 Z% k
  22.         {2 n9 E! y, b" L9 d" s/ l
  23.                 . x0 W0 Y% ], T
  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
    2 v# }4 m7 k" B7 ]
  25.                 STARTUPINFO si;& X& |3 y* t. E8 R
  26. + P* s$ X- d8 d- C
  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
    " E! J- h2 y) N( i# ^6 B+ {
  28.                 PROCESS_INFORMATION pi;& \/ Z8 k: z. F4 C! P
  29. $ ~( P& N, U9 r* F
  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+ j- L/ C/ ^/ x  }. U' }
  31.                 DEBUG_EVENT dbge;
    , g/ F* i" D2 A% y2 c: a& Y- v

  32. : J$ b4 F' Q6 H; `* ~$ X( c1 w
  33.                 //Commandline that will used at CreateProcess
    . z8 {. z' t+ G0 E
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    . V! z$ U6 p) k4 G, _! G- g4 _. Z

  35. # ?; Z( E! w' M, {+ y5 g  y
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    5 }6 x- E9 ]# F9 Q6 y
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    7 a) e1 f2 P0 d# ?+ v6 G+ K& U1 b/ @
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)4 k$ @5 r+ y& s- f

  39. . R) a- {; H3 T1 ?) u# `3 Q7 W
  40. + F/ o$ z7 ~& d( \$ Z7 N. h

  41. 7 ^( ~) ?- m6 d+ Y; b
  42.                 //Start DekaronServer.exe
    3 \( }* _. U% F  l: h
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    1 y3 W7 ^# c( Q6 W
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)6 v: I; s# V) R
  45.                         szCmdline,        // Command line; ^9 o1 I) j, e
  46.                         NULL,           // Process handle not inheritable& b% @0 x$ ~* S( Z2 W7 h
  47.                         NULL,           // Thread handle not inheritable! _: W( f1 Z: a! A/ I/ b+ S
  48.                         FALSE,          // Set handle inheritance to FALSE
    : c) O" U0 h  B
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    ; C. a  s  f, E! n1 r
  50.                         NULL,           // Use parent's environment block
    # h4 V" K) G4 W; t% D, l
  51.                         NULL,           // Use parent's starting directory
    , G- b& {: j9 q3 b
  52.                         &si,            // Pointer to STARTUPINFO structure
    ) k2 R- j( B% A# z( O; X  y
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    9 m, V7 e+ ~, d4 c) K6 j5 X4 @3 c
  54.                 ) 5 h9 z; w6 u% z; ?& N% d$ W, o  e$ K& U
  55.                 {
    3 _2 `+ k" h: R$ E
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    $ G6 [, J3 Q/ e9 b# N+ N7 u
  57.                         return 0;
    6 M0 y; h  W" Q/ J1 h) s! C3 u
  58.                 }
    - A4 U! k1 t9 J6 b# P2 Z
  59.                 //Creating Process was sucessful" c* n% {( p, ~/ B5 d1 {$ t, x
  60.                 else
    * c, u- N" J; ]0 a1 z' P( ^- p2 x
  61.                 {
    - W- V/ @0 V+ ~4 F# g% q
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    # Z5 k9 U1 d8 f6 J. f" o, A
  63. ( I# H' u  \* A1 p6 z
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    ( J8 i5 @( j& P4 ~1 d0 q
  65.                         dbge.dwProcessId = pi.dwProcessId;
    # k, Y7 x) q( ^/ ~9 p3 n
  66.                         dbge.dwProcessId = pi.dwThreadId;
    4 C/ [" w) t5 H+ I7 t

  67. . {5 t9 i1 y1 n3 o$ d) D
  68.                         while(true) //infinite loop ("Debugger")
    ! `4 w' i! V3 C( s8 }$ O' V
  69.                         {
    1 [2 p' x5 B6 @% o
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx3 Q$ r" K' |' m6 j% p! |" W2 J

  71. , ]5 i( V  r, ]. J% x- D
  72.                                 /*3 x4 T" f8 s2 ^8 T0 }) H, `9 r
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
; {' y) t- t! r6 ?! u/ v

0 O+ j, {4 d; W  Z/ A
% g% [& H% ?- b. l6 U
商业服务端 登录器 网站 出售

15

主题

256

回帖

1277

积分

金牌会员

积分
1277
金钱
879
贡献
122
注册时间
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

回帖

1277

积分

金牌会员

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

3

主题

102

回帖

6620

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-22 04:06 , Processed in 0.056210 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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