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

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

[复制链接]

154

主题

335

回帖

5780

积分

管理员

积分
5780
金钱
1817
贡献
3474
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
: ]; p0 U/ `7 V7 r' L# e& C4 R5 u* y
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
+ k, D% O% g! n; P& m! T- v( g; E9 D" V
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。8 e4 V+ r1 W- V. j/ Z, c2 B5 l
  2. //. ~2 N( A) l  O: L8 T
  3. ' s9 B- L9 @: ^0 K% p& H7 A# P
  4. #include "stdafx.h"7 d, v; L+ Z, f- h! i0 b
  5. #include <iostream>
    , ]) V1 p. _) e. m
  6. #include <Windows.h>. G) q' `. Q. t9 s7 q4 k4 @3 b
  7. #include <io.h>) s# {5 q: Z7 T* @
  8. * P+ W5 Q' H8 U$ c$ i8 V
  9. 0 ^+ x; [) l; X
  10. int _tmain(int argc, _TCHAR* argv[])
    ! e: c2 i1 y# Q2 Q" [) E; S) X
  11. {
    - P6 O1 L% o0 n/ @, f
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    - u3 T8 F. p! f. w! M. b
  13. - z7 N% O$ c* S6 F
  14.         //查看文件“DekaronServer.exe”是否存在
    8 ~/ m6 _, P( L- K3 N
  15.         if(_access("DekaronServer.exe", 0) == -1), w1 i1 }% K! l8 G% U
  16.         {
    0 D; b3 `/ A% E/ i
  17.                 printf("DekaronServer.exe not found!\n");
    & Z% X( t) q& Q' x, B
  18.                 printf("Program will close in 5seconds\n");9 D9 Q" f) R6 b3 {
  19.                 Sleep(5000);; D( S+ Z6 B: d) C
  20.         }
    ' b) h& C4 P) r! Z( ?: a; w( ]
  21.         else
    , |/ f3 }  p4 f# Z
  22.         {* p, ^8 h7 b+ G) c, b
  23.                
    , z: v0 E/ w. ]7 K; q/ o) 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
    : `5 O( N" C, {4 S; ?, `7 Q
  25.                 STARTUPINFO si;- _, w5 f; C; e% l8 ]
  26. - v8 ]" E! d" c) }. q# K7 i7 _4 R
  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).aspx6 G' @5 M" |5 G: }! C
  28.                 PROCESS_INFORMATION pi;3 q& ?! ~8 @  N9 E. D$ s: q

  29. ( k& d  E( L# J; y/ ]8 }& ?+ U( `
  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
    " U* J4 i+ N/ F, T0 L4 _
  31.                 DEBUG_EVENT dbge;
    0 u9 R6 k% ^) n- o
  32. ( n$ Z9 Q9 N- Q, N% L
  33.                 //Commandline that will used at CreateProcess
    1 u4 E7 @7 L, _
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    7 @  Y0 b( ~: h# g
  35. ) f. ?. w. Y7 B' V
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)& G& k5 W1 P9 J0 X4 D& V$ Z2 ?2 y
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)0 k) c/ J1 _2 u' ]
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)& P* v; S; p: Q1 u/ J& B
  39. 3 W+ ?9 Z1 m& D  b$ j) c8 t

  40. 9 ]+ y) T: Z) j& o4 M2 Q

  41. ( S& B* ], J- b2 o7 {5 E9 h& y
  42.                 //Start DekaronServer.exe ) F" n+ T1 Z7 T4 d' K  e! T- f
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    ( y5 @7 R" W" W/ h, U& A+ O
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    ' I3 n1 B: Y# n
  45.                         szCmdline,        // Command line
    / O1 k* i  o$ @. h2 \. D7 Y
  46.                         NULL,           // Process handle not inheritable1 E% u0 A* U6 f0 k" _; L
  47.                         NULL,           // Thread handle not inheritable
    6 r6 y8 h/ r$ F- Z2 k  m3 }' l
  48.                         FALSE,          // Set handle inheritance to FALSE* K0 [& r( ?4 z5 u8 t3 R1 _
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    1 H- E0 |1 s- Y! u: c
  50.                         NULL,           // Use parent's environment block, W+ d! h; Q0 F3 C
  51.                         NULL,           // Use parent's starting directory
    2 @% }$ }% g1 L: D, G1 k
  52.                         &si,            // Pointer to STARTUPINFO structure
    % E( ~; M( o4 ^" ?
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    8 r' X% I7 R# g3 {. H
  54.                 )
    ' z+ O3 k6 n9 B! c
  55.                 {. Q2 S, K7 d, F3 B
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );3 k$ T- _; N" s, `2 ?0 m! g
  57.                         return 0;: ^6 j# I2 j1 }6 Q, x' t! }
  58.                 }
    5 O: j/ o, A" p3 V6 M
  59.                 //Creating Process was sucessful* B9 H/ T7 [9 a9 W/ I$ I2 E
  60.                 else8 [9 ]2 p& W* \- l( `( f
  61.                 {
    7 u! X1 n" d* E3 u% G7 E; m- J
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
      Y( u. V: Z) y6 B# j+ q

  63. ( X& }: Q4 T- x; R% E0 L
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure' U# f$ Z( x& ~2 z: U" a) N* @
  65.                         dbge.dwProcessId = pi.dwProcessId;, _& V" \0 H: y% u
  66.                         dbge.dwProcessId = pi.dwThreadId;! G8 ?* _' X! b. W

  67. 5 w* o" V6 f( N# N! Y' B. S( P
  68.                         while(true) //infinite loop ("Debugger")4 K/ J7 ~. L3 H, {5 ~! G$ q; V
  69.                         {
    . A3 k" d. I' h( P: b8 ~4 V
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx9 s) P3 X9 F! q1 g6 K

  71. , q9 W- G. ~& D" K. {5 }% w& \" x( ~
  72.                                 /*
    / t2 e5 q/ u" b6 \0 _
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

# I" B) k9 S4 N% e  ~
8 c0 W+ b+ o& m
& S1 ]4 }) G+ @5 N0 U% K3 N2 ^
商业服务端 登录器 网站 出售

13

主题

251

回帖

1243

积分

金牌会员

积分
1243
金钱
792
贡献
182
注册时间
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

主题

205

回帖

345

积分

中级会员

积分
345
金钱
136
贡献
4
注册时间
2024-5-14
发表于 2024-5-14 15:56:57 | 显示全部楼层
学习学习赞赞赞

13

主题

251

回帖

1243

积分

金牌会员

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

3

主题

99

回帖

5273

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-4 18:57 , Processed in 0.064459 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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