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

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

[复制链接]

156

主题

354

回帖

6593

积分

管理员

积分
6593
金钱
1912
贡献
4171
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 5 M# G# ~: _9 v1 l& h  `
2 v/ p+ B$ h8 z$ @5 R9 X
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。4 B# n2 g' k+ M

* p  `7 {/ ~/ F( V
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。; o, c4 K+ }8 G/ F' c4 h
  2. //7 A* e; V9 M) l3 h7 E
  3. . _- l% s5 y' S: u
  4. #include "stdafx.h"
    4 n" O/ E( S* u' w* Q/ r/ ]4 g
  5. #include <iostream>9 Q5 p4 s. z0 m( [; O) e/ B# V
  6. #include <Windows.h>
    - i. a& T$ h& B! X" _" D
  7. #include <io.h>
    & E  p8 u2 U# @7 d- D( r0 s
  8. : I4 @2 |" p0 k! n

  9. . ]/ G4 l4 D5 i6 Y& D: i* K
  10. int _tmain(int argc, _TCHAR* argv[])
    , C& o  F1 M8 P1 M
  11. {
    / m+ f$ k" D  K: b
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    ' T( U1 t) P) }, N; S9 a
  13. ) E! D4 U) f3 I( y9 C$ |2 j
  14.         //查看文件“DekaronServer.exe”是否存在+ U/ _" G$ t' G" W, R, f
  15.         if(_access("DekaronServer.exe", 0) == -1)
    ) k5 R; B2 d5 c: m/ o8 I
  16.         {1 q! e4 d- Z9 J: t
  17.                 printf("DekaronServer.exe not found!\n");
    4 E/ z# X# E! Y9 [+ t4 G- A3 T
  18.                 printf("Program will close in 5seconds\n");3 Q$ z  z3 S2 K& E7 _% y4 @
  19.                 Sleep(5000);  m3 ]  h( |0 @2 K" y/ M0 a
  20.         }( ?  T( v8 _7 _- P1 D5 n
  21.         else
    9 x+ ?1 N4 ^0 ^; C2 m4 a* j
  22.         {, m6 ~  u$ y; h9 u3 P/ @
  23.                 1 D: d' E2 @: q  I$ ~! C9 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
    ' O! r# k0 A: @: [5 f
  25.                 STARTUPINFO si;4 L  Q' Y8 _: v" \1 r6 _
  26. ! ?: I4 ^6 Y. K0 Y: T4 R$ U! u' ]- P) l
  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
      t$ D' o3 F8 |4 o1 k
  28.                 PROCESS_INFORMATION pi;
    4 C9 }2 z$ h% h

  29. ( s9 F7 z6 J  `" M4 b0 \# L
  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
    / E0 V( k1 \7 n# X- m" i% d# ~0 h
  31.                 DEBUG_EVENT dbge;' L+ p) h0 y& r* b& |
  32. % c5 k# P& ?& d# Z5 D+ i
  33.                 //Commandline that will used at CreateProcess
    $ H/ W2 E% |9 t8 |) k
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));- h4 k5 I. {3 e% V" A

  35. % P' |5 J4 h, N7 b  _* W, g
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    : p# J; m' q7 }1 r% }5 U7 A9 M0 h
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)4 W& E) m9 g! b5 S. `
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)0 T3 X: Z8 G: p! d! A0 J

  39. 5 e0 O- o& i3 H
  40. & W; W# \  X* A

  41. + ^  X6 u0 N! e3 P
  42.                 //Start DekaronServer.exe
    4 C. @: N( M: m; C8 u8 o- o
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    ! C+ a+ ^7 N9 x  D7 h0 _8 M/ }& C+ z
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)* [* d5 j% B" k+ Q  ~, _5 a- Y" q
  45.                         szCmdline,        // Command line
    7 U  h* d6 @9 J
  46.                         NULL,           // Process handle not inheritable
    ! Z3 z/ J# j: V4 g) O7 g
  47.                         NULL,           // Thread handle not inheritable
    , O* O' V4 r) e
  48.                         FALSE,          // Set handle inheritance to FALSE
    1 E8 ]9 S) ^* e- v+ L
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx6 Z0 T8 g7 m, _$ M& s$ Y+ k. F
  50.                         NULL,           // Use parent's environment block: h$ t- Z. b* V! K$ l& A
  51.                         NULL,           // Use parent's starting directory 8 }) _& [' h  p5 I4 Z' D! k: e
  52.                         &si,            // Pointer to STARTUPINFO structure
    ' \4 f6 }# E# P, Z! ?
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure2 q# L1 W  h% _* l
  54.                 )
    5 Y: }" g1 o" H- \7 b% b: n1 [
  55.                 {
    ' c, t: `( O9 ]7 P  f# E
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    , X. A% g( z  F. X4 Q6 f
  57.                         return 0;
    9 V9 A; c  I: [  m. U- T" J# J
  58.                 }
    , J3 y+ L( x! ?2 \/ H
  59.                 //Creating Process was sucessful
    : t1 ~8 P' u- Y" ^1 K' B/ x5 H, R) b
  60.                 else
    3 B2 L; d4 |3 o; T( k6 V3 g# I
  61.                 {" [8 y: B- b6 o8 t
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    ) K8 y' q& S4 @1 b& q
  63. 4 [( P( ]+ f1 n4 S
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure8 i0 e8 \( M: K0 W# K: q
  65.                         dbge.dwProcessId = pi.dwProcessId;
    % Q" y8 P7 P. A1 S9 \* p: F
  66.                         dbge.dwProcessId = pi.dwThreadId;
    ( b2 ^0 q" X8 S' J' l) W8 E
  67. 9 I7 D9 c- e" C% Z0 s! C
  68.                         while(true) //infinite loop ("Debugger")4 s! s2 ^6 J" i0 n( R6 E
  69.                         {
    4 S5 U2 H& F% ?3 l7 D
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx2 U- Z; d. }' h
  71. & h9 Z3 l/ ]2 f: R) M
  72.                                 /*/ Z. Q: u7 p& ]/ Q- q
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

  l5 ?; F* H4 O9 h
" ?' y4 u* r" g$ d% r
) n6 J7 f8 v$ y7 f4 e8 R  j  F
商业服务端 登录器 网站 出售

15

主题

256

回帖

1250

积分

金牌会员

积分
1250
金钱
859
贡献
115
注册时间
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

回帖

1250

积分

金牌会员

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

3

主题

102

回帖

6181

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-28 22:14 , Processed in 0.060009 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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