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

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

[复制链接]

154

主题

335

回帖

5773

积分

管理员

积分
5773
金钱
1815
贡献
3469
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) : O! L1 K4 q/ f; s  X8 l
9 T* [, m, v0 ^- z8 x! E
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
& S# y( x" J, X3 {/ c' R5 b$ [: e, p4 o2 J' N
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。: A5 s  S$ q( f, a0 k3 n3 G
  2. //
    ! E2 a, \) c6 p

  3. 2 ~4 d' t+ q& I" |# l
  4. #include "stdafx.h"' O$ s' ?2 _. z2 @
  5. #include <iostream>3 q& y. E- r# D7 }  g4 Q
  6. #include <Windows.h>" p% d0 A3 Y3 {
  7. #include <io.h>
    $ x& k! D; y: Z$ [
  8. ' |" u  m9 u! J& |

  9. $ R" @2 l6 c, m6 P3 D
  10. int _tmain(int argc, _TCHAR* argv[]), D% o: s$ T( r3 J8 F& V
  11. {/ F, G( x# S% G* Q% e
  12.         printf("Dekaron-Server Launcher by Toasty\n");  W4 z& h( U0 |

  13. 8 g# A2 ]% z) h; C  Y. L7 U2 {
  14.         //查看文件“DekaronServer.exe”是否存在
    0 w$ d0 [4 T, z- O$ U
  15.         if(_access("DekaronServer.exe", 0) == -1)& T9 \# Z' N, s2 g6 g# G
  16.         {
    4 x- D2 ]; U: P- H
  17.                 printf("DekaronServer.exe not found!\n");
    # t  ?2 `" D1 S5 i9 B
  18.                 printf("Program will close in 5seconds\n");
    $ q" Z( A# b. }/ S+ I# P
  19.                 Sleep(5000);3 g+ @! p" d, e  U% A( F5 _
  20.         }
    * j' i$ i- J; s4 M- ]5 m/ I
  21.         else8 ~  ^7 B: D% R" `) D2 G4 A
  22.         {
    ! [# R; R8 T+ c. J
  23.                 # o& U; A# r$ b
  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) n4 I- V. ]8 @% ~2 h3 k7 t
  25.                 STARTUPINFO si;; d4 [$ U- _: N
  26. $ t; }2 ]! `0 v, `/ S
  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
    7 u4 J0 ?! f1 k
  28.                 PROCESS_INFORMATION pi;
    - j4 M( G1 h& H5 x# P  m* ^
  29. 5 d5 O: N5 D6 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
    - G$ q; }9 s$ U5 y  Z* S5 q2 S
  31.                 DEBUG_EVENT dbge;
    ) A0 Z# X% p1 w# l3 M6 n
  32. " f) t. a% Q  S" x
  33.                 //Commandline that will used at CreateProcess
    % `: J  m- H' i! K  k( L
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));+ l# c. O9 e8 a' H9 s# V
  35. ( R! m. P: ~. |+ M3 l8 k9 B+ B- D
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made), F# F+ _6 l; M& j/ y
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    7 y* Q1 _5 }' j2 S: R
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)- w0 F3 N( ]( T# A% Y

  39. * F; i/ E4 \# e- R5 P; K
  40. 1 l; w9 q+ o& V4 W
  41. 6 R) {) C1 {5 d$ h5 a1 k6 k5 E
  42.                 //Start DekaronServer.exe % f/ x9 v9 c; K; y8 M
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx) s7 {4 O, z: p: \5 \6 n- }; w
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    2 |: U2 m# ?. k& M. U: i) v
  45.                         szCmdline,        // Command line
    5 z" u8 x2 x1 P5 M( ^' Y* o) l
  46.                         NULL,           // Process handle not inheritable) m4 K( {2 R% {5 Q+ T
  47.                         NULL,           // Thread handle not inheritable
    1 F# i, C  s, E0 I. K
  48.                         FALSE,          // Set handle inheritance to FALSE
    8 a5 l1 t5 B2 v& D) K
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx+ T! A9 F5 v7 t* I0 x
  50.                         NULL,           // Use parent's environment block7 @! Z5 \7 [9 d$ P1 p" C! F8 Q  X
  51.                         NULL,           // Use parent's starting directory
    ' w( w3 W0 r) w& G! ]4 }0 t9 V# V
  52.                         &si,            // Pointer to STARTUPINFO structure; w9 q) R; o7 ^. @8 [& c
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure3 H; i, K- r. k/ d' l) d* n3 T( H( x
  54.                 )
    4 f. e2 }2 E+ s: w. w+ C
  55.                 {
    & Z3 A% B* r+ S5 p& P9 P
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    ( `/ \: O  w- O0 e. i- v$ W
  57.                         return 0;; \$ [( \' u8 c7 C
  58.                 }
    5 F8 D- v6 q9 o9 k/ D0 X/ I
  59.                 //Creating Process was sucessful
    ) I* @# z/ D2 v/ ]! n9 T* A) v3 N
  60.                 else
    1 i0 H8 h) k. P7 c) y, A7 O1 R# ]( J
  61.                 {" \8 u$ E1 I  T% p
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    * n( |2 Z1 P+ \$ U
  63. % v5 q7 x: t$ @9 X% v& P* h5 F
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    & N" E9 R- l, }, @; e( ]1 A5 e' w3 ^; |
  65.                         dbge.dwProcessId = pi.dwProcessId;  C* g6 c( Y5 N3 L4 |
  66.                         dbge.dwProcessId = pi.dwThreadId;
    & c9 P$ f  z( H2 p0 l# Y
  67. $ K+ o& D5 z2 l  ~
  68.                         while(true) //infinite loop ("Debugger")5 W/ \: y% p3 P3 I' u* k7 C
  69.                         {
    ' f- H. S& |8 h7 q
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx% S. G, o0 ~( k* k
  71. 1 c- c$ K- G* K. Q6 Y7 e/ w& G
  72.                                 /*& G( d- ?2 E# j; S& g) j
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

- V, n2 f$ b3 J: ^6 d
, ?2 Z) i& a3 p. I2 M
3 k' A# n) `3 B; [7 u% d
商业服务端 登录器 网站 出售

13

主题

250

回帖

1232

积分

金牌会员

积分
1232
金钱
787
贡献
177
注册时间
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

主题

250

回帖

1232

积分

金牌会员

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

3

主题

99

回帖

5233

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-2 16:43 , Processed in 0.079257 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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