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

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

[复制链接]

157

主题

361

回帖

6821

积分

管理员

积分
6821
金钱
1939
贡献
4364
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 0 M, x& @% }5 ^$ p# P: N5 F0 A2 N
4 B/ O4 A/ D# \5 X
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。3 r0 a' c" H! i! z7 |- _8 ^

2 G5 v5 T, Z5 Q7 T( a2 z5 {
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    5 O1 t# r, K7 _( N
  2. //
    3 \* P# l/ m( s7 X6 {: h
  3. / V; W- J+ S2 n, _! `9 D6 @
  4. #include "stdafx.h"/ q& P7 e) ~. b6 X# O& b3 J
  5. #include <iostream>
    8 Y7 \3 W$ ~3 y- e4 i3 Z! h1 e
  6. #include <Windows.h>
    ; I0 P$ i6 o8 E7 v
  7. #include <io.h>; O7 [- E: L) L; T' T  H  V; G
  8. " [4 i% ?! U; ?8 [) i5 R0 G9 ~* n
  9. 5 u; f, p3 e$ U' ^- n2 n3 W& }2 ~
  10. int _tmain(int argc, _TCHAR* argv[])0 g) w4 S& k9 P3 l/ z% Q
  11. {# H. ?1 o# c6 X) x5 _+ K0 l& [
  12.         printf("Dekaron-Server Launcher by Toasty\n");5 U& {* B/ b& t3 ]2 U7 g( K
  13. " I  D$ l/ H: z
  14.         //查看文件“DekaronServer.exe”是否存在
    , _. L& y3 S1 {# F
  15.         if(_access("DekaronServer.exe", 0) == -1)
    0 u$ N7 `2 q, ?" T( v% V
  16.         {) a6 z; [7 m  P% l4 O- a5 b7 H$ N
  17.                 printf("DekaronServer.exe not found!\n");
    8 Y" Y" _  i5 J! S$ g" P) @
  18.                 printf("Program will close in 5seconds\n");6 Y2 F! u  H3 n$ Y8 E8 c
  19.                 Sleep(5000);4 }9 [( n' k, Z. j4 d3 _9 F
  20.         }
    8 x) A2 t, u9 |: c" Y
  21.         else  V/ @8 J: j/ P0 _' e+ f
  22.         {9 z6 j0 v2 D) \1 Y8 M5 @( B
  23.                 $ X9 \9 m( Q! Q, \3 o
  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. k, s0 {  D3 ]8 S5 y) K# M7 ^* P
  25.                 STARTUPINFO si;: \  Y5 t# {% Z' O. e, x

  26. & ^: P/ P2 k+ S- L: e' 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
    9 R- O1 n+ ?7 ]+ z" r, y; w) S& U/ v
  28.                 PROCESS_INFORMATION pi;& `9 y7 n/ m; ]) E' X* G% D& h
  29. 9 s7 ^& i' _& K4 w
  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).aspx9 W/ b' @+ x) g5 q5 _
  31.                 DEBUG_EVENT dbge;
    " h' e% [* h1 U* E! f/ X; u' H
  32. $ ?6 F; s1 t' n5 Y7 K
  33.                 //Commandline that will used at CreateProcess- A1 q# o9 Q: c; f+ X
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));, f" a1 @! h: l  r, V6 Z5 N

  35. % R# ~4 u( \; u% V
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made): L) r0 E) \3 c. S
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)) ^5 u7 ^# Z) ^* b% [- ?# s* I
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made), v& ~7 @4 n* f6 w

  39. # J6 Q# p2 b+ {5 h4 ?  S

  40. 8 f/ N' ]/ h; _. F+ y% V$ }
  41. 0 x8 T% ?4 L% h& W: S+ _% C
  42.                 //Start DekaronServer.exe
    2 S2 {. `7 z) W; c) x' [
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx' |0 D1 P- ?8 n; Y8 G; V. G
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)7 A$ J. ]+ L7 H8 X5 i1 `1 ~8 M
  45.                         szCmdline,        // Command line
    & G) D' C; c6 x( X
  46.                         NULL,           // Process handle not inheritable
    - ^( b4 i! M( p& ^9 Z! \
  47.                         NULL,           // Thread handle not inheritable1 ^: x" ?. S4 _9 D; F2 L/ N
  48.                         FALSE,          // Set handle inheritance to FALSE% N( O+ }( Q, _, o1 ?# A0 q
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    1 T' v$ w$ y( l* M2 C
  50.                         NULL,           // Use parent's environment block4 Z: p( K% D9 j" g$ h
  51.                         NULL,           // Use parent's starting directory 9 C3 n% x  f5 s. e2 i
  52.                         &si,            // Pointer to STARTUPINFO structure: g6 o) v5 s2 s3 T- r2 U% T& A4 Y# Z
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure! i! m! x  V  k; n$ e
  54.                 )   z  r, Y8 b, Y' B# @* c7 n
  55.                 {# I/ {, y0 a& z' A! i" S
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    7 M4 ^& g/ q+ R. R1 e* y, H
  57.                         return 0;
    ! M( M% Z$ a/ V3 G
  58.                 }# ~) S: u& r, i7 H
  59.                 //Creating Process was sucessful
    ! _8 L% T- y$ L  J2 I7 O" i
  60.                 else9 o* q& o. z; H
  61.                 {
    4 I; V4 U! b: T
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    0 \3 W0 u, [  j) W: d& q  Y
  63. 2 V" U+ U( A; ~7 V' x
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure) |7 r% I* p/ Q4 T+ i! @' n
  65.                         dbge.dwProcessId = pi.dwProcessId;
    ) {) _# ]' \! \! j8 s
  66.                         dbge.dwProcessId = pi.dwThreadId;
    1 P, `+ h; U: \( f3 ?  W6 l4 j5 i
  67. 6 O; f$ w4 K! Z! J9 m( Q# o4 m7 E
  68.                         while(true) //infinite loop ("Debugger")
    ! M9 y: B" D2 X  |7 a$ R4 l
  69.                         {* x9 Z, a; l; 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# d- ]  @. l9 v2 Q3 D) }+ ?! |7 ]
  71. % L3 Z9 T9 {# o3 B6 A1 E
  72.                                 /*
      I9 A+ _- R6 j) l- M( ?6 g
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

! B; H8 ?3 r, k9 W: A1 z, F" j4 ~

* J5 W+ N* e7 g
商业服务端 登录器 网站 出售

15

主题

256

回帖

1268

积分

金牌会员

积分
1268
金钱
871
贡献
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

回帖

1268

积分

金牌会员

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

3

主题

102

回帖

6481

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-12 14:59 , Processed in 0.075132 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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