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

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

[复制链接]

157

主题

362

回帖

6843

积分

管理员

积分
6843
金钱
1944
贡献
4380
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
7 g% V) J2 p& R) t: B- L/ F6 R# V& F7 ?
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
9 s# u/ W- E& X6 A2 W8 u! }4 k& _) U+ Q" u8 X7 e. V
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    6 |& Z! y0 \: t* G# B- i
  2. //( `/ y$ V- R. r
  3. . ^/ I; y# n6 d& u+ Y
  4. #include "stdafx.h"8 e+ Z- h7 [, x$ j) D
  5. #include <iostream>" @5 i; ~* M) _0 _
  6. #include <Windows.h>2 }" ?- Y& N" ^& b" ^
  7. #include <io.h>
    - y1 v! y; I$ G6 T

  8. ! X8 ]6 c- M; J
  9. & x- A  B% X! t
  10. int _tmain(int argc, _TCHAR* argv[])
    . v! G9 H- z$ ]0 L3 L& z  t
  11. {
    1 q" I) Z5 m. I
  12.         printf("Dekaron-Server Launcher by Toasty\n");7 e* V7 ]3 w- N1 c* ~( L! Q0 K
  13. : l4 |3 n& }  [) h7 v5 O
  14.         //查看文件“DekaronServer.exe”是否存在& W/ m0 H/ K$ o/ L* k* h
  15.         if(_access("DekaronServer.exe", 0) == -1): G" e6 q$ O# ]5 S% H' i
  16.         {8 d' n+ m5 w, `5 r8 n* T0 n3 A( q! C
  17.                 printf("DekaronServer.exe not found!\n");+ d' ~" S! M% \2 X; v8 d
  18.                 printf("Program will close in 5seconds\n");+ N( w0 P, v% U* t. \! c& T& r
  19.                 Sleep(5000);
    2 {$ M- n+ r3 R9 U( O/ K
  20.         }
    : p  Z3 P0 G! J2 G
  21.         else
    . a0 q: k8 B7 @+ `9 q, [
  22.         {  k1 k5 y% T, K1 W% Y$ ]$ {3 X
  23.                
    ' c6 D- y: P! S; e4 \3 }- J& {: t- c3 u
  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. o0 h! u! g" l$ g; F6 i
  25.                 STARTUPINFO si;# z5 `3 X& M9 Q* C1 n

  26. - C2 R7 J& H3 t% {
  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).aspx1 o& q# M5 p9 K0 {3 g/ e
  28.                 PROCESS_INFORMATION pi;
    ; d# u7 s5 h! f- c) b% A: ]7 F
  29. 9 C. y$ o4 m0 z
  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
    5 T6 [8 P. z7 U8 x. `
  31.                 DEBUG_EVENT dbge;
    6 }1 Q! u7 Z* Y

  32. 2 u- k/ C6 s' ?7 N) T- {
  33.                 //Commandline that will used at CreateProcess
    : `0 ?: ?' t: b5 b' i  g
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    6 Z! G$ a  K2 o# J8 N' @
  35. 5 [0 V; Q2 E: b1 h1 r
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)6 c  p& v' z$ u# g3 k$ B$ u4 i
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    4 n$ A% R% X' Z! v+ |+ ]  h9 ?: L
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
      T: X% G$ C: [0 w: g4 |
  39. / }7 K7 Z3 ^4 U9 R+ }* |
  40. 1 q6 G8 M5 N0 \
  41. + y/ j, X/ d$ U2 n. {8 `
  42.                 //Start DekaronServer.exe + X- J0 S  W+ W% N9 [
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    # V6 P3 ^2 R/ Q3 |! R
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    ; o) A, |  Y3 L
  45.                         szCmdline,        // Command line$ D" d% Z# _' N& [8 u
  46.                         NULL,           // Process handle not inheritable& C  S/ b; ]4 W( {0 P" x3 A
  47.                         NULL,           // Thread handle not inheritable
    . \' {( H4 X% U; T! {- `* r
  48.                         FALSE,          // Set handle inheritance to FALSE' j/ m# S$ O7 x8 P4 G& }; W
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx7 K) h% y4 Z5 a' c
  50.                         NULL,           // Use parent's environment block& t1 U% e8 f7 P+ w8 r' r
  51.                         NULL,           // Use parent's starting directory 3 r& D7 v* T9 b% w) Q
  52.                         &si,            // Pointer to STARTUPINFO structure
    % \9 e  j* u, Z) Q) m
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure7 u$ l" t3 X; `6 z8 |; E9 e  z8 |
  54.                 )
    4 L$ R' z$ T% J8 c  G
  55.                 {# Z6 b( E! D7 T) K
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );9 X  O8 ?2 W/ p# X5 p. x
  57.                         return 0;1 t! Y. v- U. l7 h6 Z8 {: p
  58.                 }
    4 i) I- K" n/ u! Q3 k7 M6 I2 M
  59.                 //Creating Process was sucessful9 D+ k0 r! s5 S! f
  60.                 else
    % M' r8 D1 v9 H: i: m' D6 n
  61.                 {
      C* e$ D" D, U6 n0 F$ i
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
      t3 R& s7 E) R- O' R5 W' q6 y, L( I
  63. 4 a# {! N4 F8 _( h) g
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure, X6 o7 ?3 D3 X  |" h/ @
  65.                         dbge.dwProcessId = pi.dwProcessId;
    1 I( E3 _9 N. a7 J) K4 `9 o% I5 J% f2 S
  66.                         dbge.dwProcessId = pi.dwThreadId;( B, w0 t: w& R3 o% w
  67.   v  f3 E4 ]* Z* F5 W( ^
  68.                         while(true) //infinite loop ("Debugger")
    ) f* I/ T% y& M  {# W
  69.                         {
    2 G/ P8 B0 O( l5 c* z
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx% M! k1 I. f' \

  71. * w2 W6 I& C# X) G' ~9 \4 J, ~
  72.                                 /*. Z" J" z8 t4 V3 R" O$ U5 {
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
8 A, }: d) l% r- {  M' v* o# c# G

2 N3 D4 w. n" H
" d& `2 w  ]3 F/ w% q
商业服务端 登录器 网站 出售

15

主题

256

回帖

1271

积分

金牌会员

积分
1271
金钱
873
贡献
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

回帖

1271

积分

金牌会员

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

3

主题

102

回帖

6541

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-16 09:59 , Processed in 0.060260 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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