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

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

[复制链接]

157

主题

361

回帖

6692

积分

管理员

积分
6692
金钱
1933
贡献
4241
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) ; d2 }$ e. P# ]1 e+ U

6 C7 t2 y2 I8 P2 L1 W$ Y. g虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
& p( m5 L! c$ L& F% C- h3 v+ {6 G. ]! J/ a: N! s
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    # W- L+ Q% X  w
  2. /// h7 z& k- {" w# o

  3. . A" h: V9 E4 o, }, C% H$ L
  4. #include "stdafx.h"
    % P4 [' X2 ?  d1 G: L; E
  5. #include <iostream>
    " S& R' `% e/ Z7 h' _1 z" {
  6. #include <Windows.h>7 B- w0 T' d" [% J5 U
  7. #include <io.h># q9 N* t3 K( R% r& v8 X
  8. + e1 l* o/ l- @+ \6 d
  9. ; y0 x7 w/ \5 l) G$ f5 M
  10. int _tmain(int argc, _TCHAR* argv[])
    & F$ ^! y9 W6 L# c- h+ H& T1 ^$ v
  11. {1 h" @8 {5 |3 y5 c3 J
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    7 m* T4 L7 X/ M
  13. ; v4 [8 V% }; X# Z$ Q
  14.         //查看文件“DekaronServer.exe”是否存在% e+ V' f6 b7 ~
  15.         if(_access("DekaronServer.exe", 0) == -1)
    3 t! P8 ?$ m2 E. D0 e' D
  16.         {) q2 d4 {3 }4 X( l9 y
  17.                 printf("DekaronServer.exe not found!\n");0 k* I; W' }; x4 ?
  18.                 printf("Program will close in 5seconds\n");
    * a: b7 y& P* W: O, @# e( D/ _; c
  19.                 Sleep(5000);1 N- {$ P' D& ]4 h* y% T8 M8 Y
  20.         }
    9 C4 ~$ D- g8 @& o
  21.         else
    % {9 M& R9 x- O7 d5 `
  22.         {% c7 k: M) G' ]) p: X0 Z% \
  23.                 3 P! K! v( Q2 O! ]. P
  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).aspx3 u: ~6 e) r7 R
  25.                 STARTUPINFO si;
      T" D; n% t3 E0 X  n, I& b

  26. ! U1 D  H. ^* x
  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
    . s8 E3 P& g7 n/ N- Y7 R. e
  28.                 PROCESS_INFORMATION pi;0 C! s7 W- F8 \: h1 X6 J3 a

  29. 3 h- z. `: I/ ?
  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).aspx8 Z8 p) j2 i5 H3 K$ s
  31.                 DEBUG_EVENT dbge;- E3 I" J. ]8 l; x
  32. 9 z6 I7 ^* {1 ?1 [: {. H' y6 P9 y) J
  33.                 //Commandline that will used at CreateProcess
    : X7 b" v* O& `7 h. ?, T! ?. ?
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    1 ^: g0 T$ Y! g; n. E8 l" \

  35. + |, ^7 J% P' ?! ~; f* E7 {" K5 T
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made), C6 u7 G+ o/ M( Y" C+ U0 \% Y
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    7 L! L; y5 G" F2 f4 Q
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    5 a0 Y# F) a/ d5 s6 V

  39. " |1 T2 n/ ^0 S" J5 d% C
  40. ( ?. G6 f& v) b7 {$ e( w6 v
  41. , N' f- L1 o. {2 ~0 c; F
  42.                 //Start DekaronServer.exe
    4 c5 V7 Y$ S+ b8 ~" F, ~5 L: t- X
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx# ~% x1 a* y0 f+ X# ~6 X
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    - g0 F* V5 P- c" c' ^" @! {
  45.                         szCmdline,        // Command line5 y. R5 L8 j9 m% d; u8 T4 k
  46.                         NULL,           // Process handle not inheritable; _& L, g9 @# Z4 L0 {5 s
  47.                         NULL,           // Thread handle not inheritable! f0 J, W) g+ p% ]$ k5 o7 @4 J
  48.                         FALSE,          // Set handle inheritance to FALSE
    0 n4 i6 v$ i5 e/ k
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx) h- |' f$ R# I  Y1 j' f
  50.                         NULL,           // Use parent's environment block* _( Z) C; ~! @: P  C' z$ e* y) R
  51.                         NULL,           // Use parent's starting directory + V! H, X. D7 }. c: k2 o$ Z
  52.                         &si,            // Pointer to STARTUPINFO structure2 ]7 W7 m. o. `0 ]+ [
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure) ~* E# U6 h# I, \' O
  54.                 )
    ) T9 _" U5 B& P+ a, M: O- A
  55.                 {
    $ z( N4 K7 _+ H7 V) F
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );, w4 X5 Q3 i( c4 \9 t' e+ N
  57.                         return 0;
    * [3 q" `! w; n+ B
  58.                 }1 y; U  ?5 Y8 |1 H, x' V1 J
  59.                 //Creating Process was sucessful
    4 h8 Z) D6 C+ r, ]  R" s# |1 @
  60.                 else) ]+ P' z$ A6 m) u& v8 j  H) o
  61.                 {) j8 d9 v9 y; q0 L
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    9 ?* C: Q2 }' x( x" ]; o

  63. ' H; ^" |7 r# U
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    " ^+ C6 t4 D" H4 N! `! r# d  @# P- ~
  65.                         dbge.dwProcessId = pi.dwProcessId;' r/ u& K; ]( z% v2 `8 o
  66.                         dbge.dwProcessId = pi.dwThreadId;& s9 C4 @* l1 Z& O

  67. $ O, x2 _- b3 M$ v% u
  68.                         while(true) //infinite loop ("Debugger")
    . L; Z: |" z* `( T- n
  69.                         {
    ! c4 ]: n; [6 F
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx- x2 v# K, E! J1 A1 P8 _
  71. 2 l& D7 D4 k5 n7 s6 U4 u
  72.                                 /*5 T) F5 ~$ k  ?
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

. E2 J  T3 b( d
# N4 ?* y/ ^2 O6 x( O" ^. g1 X( C5 i: d/ A3 K- j% q  ^
商业服务端 登录器 网站 出售

15

主题

256

回帖

1259

积分

金牌会员

积分
1259
金钱
865
贡献
118
注册时间
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

回帖

1259

积分

金牌会员

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

3

主题

102

回帖

6361

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-7 12:27 , Processed in 0.060880 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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