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

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

[复制链接]

157

主题

366

回帖

7097

积分

管理员

积分
7097
金钱
2028
贡献
4546
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 6 D* U1 X* q8 x
( x- p6 l9 S$ C% o% d9 A& G: H
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。- M$ J/ k$ v9 O+ ~
" \) I+ }: X! K6 i6 C
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。9 o, [0 b2 Y" X
  2. //
    % |5 g- j& d! L& {& _2 Y. O: \6 `
  3. % ]( G! \5 V7 J5 Q: N. k! @, s# B
  4. #include "stdafx.h"  J/ n0 f( H! n9 p0 R3 t, \8 i) [! ?
  5. #include <iostream># D4 m2 h* k: g
  6. #include <Windows.h>
    . k$ x/ X. A% q- l3 U
  7. #include <io.h>' O, {5 b; Q2 c

  8. " f; M, d2 P+ T
  9. " C) \' b: {  U: o
  10. int _tmain(int argc, _TCHAR* argv[])
    : ?  H+ u8 j& m1 ]8 g
  11. {  [& o5 ]+ g. Y3 s
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    8 F0 P; b8 `/ }* ~

  13. 7 [2 |% [- X+ T: `; ^2 p
  14.         //查看文件“DekaronServer.exe”是否存在1 V: ~6 c! x3 E
  15.         if(_access("DekaronServer.exe", 0) == -1)
    & k4 K% I- ]; @0 H& ]* ~% i) p1 C
  16.         {
    ; m5 R1 y& Z5 Z) g% {! {. d! ]
  17.                 printf("DekaronServer.exe not found!\n");
    : E0 ]6 s6 d' I& Q- ~/ @. r
  18.                 printf("Program will close in 5seconds\n");
    . P7 g; Z) ^2 m  X% x2 q* `2 I
  19.                 Sleep(5000);
    ! H  C- I/ x6 G7 u3 X) E0 M  `/ T' o
  20.         }( A6 t9 `$ u1 B, o4 [$ ~$ W* m
  21.         else1 J- r0 G( D$ N, b0 E
  22.         {
    2 H: Y" ]; f# C% _  N' G" z
  23.                 ! v4 N* ]* P8 j" {: S2 q
  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" p5 n) \9 e# v: j; a$ c  f
  25.                 STARTUPINFO si;
    " B  e7 e/ j  }) m
  26. - b( [9 p! h) ~3 G& V3 u& O5 Y" H
  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( b. q. p  ^2 Q. s6 F( O
  28.                 PROCESS_INFORMATION pi;
    3 {5 c, Y( \6 J

  29. ' \$ o& Z) o/ ]& v
  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) o- U/ D! ^! `, b4 O8 e( u
  31.                 DEBUG_EVENT dbge;
    4 e! R! x/ o. G% L

  32. 6 V) ^- H6 f9 Q+ X) L
  33.                 //Commandline that will used at CreateProcess; m/ F0 {* S2 y: y
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));8 S, ?8 P6 k, \

  35. : X' `6 m$ g7 @) B( y
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made), O( t1 X9 X4 M$ ?* ~. w& B& W
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)% E3 B( ]9 ]4 w6 g
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    - j) q9 h: |, f0 v# i- a$ I+ v

  39. ! l; f) \. H) R- J

  40. # e1 Z7 v. O0 q+ I4 {$ b2 o" b1 x

  41. 8 K9 Y/ y1 ^: t& q7 i% O& W
  42.                 //Start DekaronServer.exe / {" M$ @+ l7 q, p" \& u
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx5 O. S  U8 N- S; h, h: p
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    6 p) |& g# B( W$ d6 [
  45.                         szCmdline,        // Command line
    6 L/ W1 D4 ?+ y1 r
  46.                         NULL,           // Process handle not inheritable3 I  f$ Q) N$ S- ?; h  z, R
  47.                         NULL,           // Thread handle not inheritable
    6 Y* v7 Y5 ?7 @  `& W$ M" n1 I7 s
  48.                         FALSE,          // Set handle inheritance to FALSE7 B' d5 x" p# T" W
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx  `& J7 F% i# H. V
  50.                         NULL,           // Use parent's environment block. y2 w6 b: K  l( L# E7 k' v
  51.                         NULL,           // Use parent's starting directory
    ! W; f* o8 A% E! \4 C6 c7 e
  52.                         &si,            // Pointer to STARTUPINFO structure4 P8 ^* k4 T! I7 E/ W8 |
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    ! X( t+ g( L: l4 e7 y, C
  54.                 ) 9 C0 G) j* w% b) k
  55.                 {
    / q+ i, {8 z. k' R. _6 }) `$ Q8 |( P7 T
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );3 J2 F$ k$ D1 {
  57.                         return 0;
    , Q+ m9 t6 ?  A) v4 A: `& a
  58.                 }
    / A; r4 ~5 l! s" }9 G, B- F
  59.                 //Creating Process was sucessful3 p7 @" g+ C, O1 ^4 H) t
  60.                 else. {$ z! ]4 E4 O2 z! S# t# Z% u
  61.                 {
    6 P( c9 |* M/ C: Q' p5 G
  62.                         printf("Sucessfully launched DekaronServer.exe\n");* J) r8 x' e% b1 _& y4 [: F

  63. " X4 K' \$ h& f
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    ! h8 s: ^% c! H/ i9 p
  65.                         dbge.dwProcessId = pi.dwProcessId;
    6 @+ F4 f5 ?/ s" T! _' }
  66.                         dbge.dwProcessId = pi.dwThreadId;( L- X; o# E) N1 s$ B) T! ?5 ?
  67. 2 b7 I9 r! i% A# N
  68.                         while(true) //infinite loop ("Debugger")
    / S3 C& `5 ?. S5 g7 G8 a
  69.                         {& F0 W6 }, r; }  l
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    + {/ U% X# u3 k+ b( |1 H" W
  71. 8 ~  `% q# W. I6 t% K6 z
  72.                                 /*
    7 L9 J/ |0 \4 W2 f% Q
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
& o! M0 Y, m/ U4 N9 A' N
1 T! D6 P4 w0 D0 J9 c3 f, `
5 o) f% `2 I0 k6 F( }4 w' q+ ^
商业服务端 登录器 网站 出售

15

主题

257

回帖

1234

积分

金牌会员

积分
1234
金钱
896
贡献
61
注册时间
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

主题

257

回帖

1234

积分

金牌会员

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

3

主题

102

回帖

7277

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-3-30 17:42 , Processed in 0.050616 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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