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

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

[复制链接]

157

主题

358

回帖

6630

积分

管理员

积分
6630
金钱
1922
贡献
4193
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) $ P( m& {3 A) w$ y

6 g3 a5 |  o2 }2 K  r  |' `2 }虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。+ A; Y2 R+ d6 G  ?( Q  j* F  K

$ C) Q/ w9 I  O7 `; Z+ ?
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。# X8 B' ~2 ^+ X6 H8 e
  2. //
      t7 ^: l9 h+ {" c( F3 D, W; y+ A

  3. + l- ]7 E7 n6 }
  4. #include "stdafx.h"
    " Z* N+ M! K, O- F  d( I8 ~7 b
  5. #include <iostream>
    + \, V6 N0 P, ~- Q: i6 H% m
  6. #include <Windows.h>
    ! Y/ z* {7 ^/ q5 g/ h
  7. #include <io.h>
    " Y9 H" B9 v7 q  {: C) S

  8. , d* u- D6 d( h' }# F& j5 p
  9. ( B0 L- w; h. P- j9 g
  10. int _tmain(int argc, _TCHAR* argv[])) ^/ H2 }3 P; f* l2 H8 m& N
  11. {' m- e# y9 I, v( N9 d% q* {+ N
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    4 D  X; d) S2 h8 x- K; {2 l; s$ |  p0 _
  13. 8 C6 ?' G4 F" X" ]# b( h# |0 E
  14.         //查看文件“DekaronServer.exe”是否存在/ w8 a( X3 v% B3 ~5 {8 ]
  15.         if(_access("DekaronServer.exe", 0) == -1)
    2 v* |  v% `$ M4 t9 a
  16.         {: |: I8 F0 \. y4 x! z( ~1 L3 K
  17.                 printf("DekaronServer.exe not found!\n");2 [# s4 T; Z. I6 c
  18.                 printf("Program will close in 5seconds\n");
    0 O8 M7 L% ^- I- u& J
  19.                 Sleep(5000);
    5 c$ v7 }9 `3 c6 K! f2 e4 I
  20.         }" @5 m  q* T  _" j
  21.         else( L& U1 W9 R2 a% \& k
  22.         {
    . I) m' ~8 F3 A. T
  23.                
    3 `% g5 y. B& D5 z7 m
  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).aspx0 b9 l/ k) ]+ e' h. B
  25.                 STARTUPINFO si;- Q  u6 t, L4 u6 d* O. u- ?8 ~
  26. ! _0 I/ v. k# A
  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- c! l; _3 H) o% p
  28.                 PROCESS_INFORMATION pi;- I9 F* @7 X/ q( f& f* c
  29. 0 T/ }, y, D$ q7 c+ M7 W* M
  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
    * }" R* J) c6 d! K2 \( [$ g
  31.                 DEBUG_EVENT dbge;
    2 v9 x$ I& ^/ Z' _6 G5 x
  32. 8 ~/ i- X$ \' w$ ]
  33.                 //Commandline that will used at CreateProcess
    / i; ?3 ?+ W2 p# B: i. U
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    ) z8 V2 g0 E# k9 t% E

  35. : m' c4 q, n" ]  c5 f; K# e" G
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    ! O) W6 H. a6 V3 w( e( g# d& {
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)- \- u, ]+ a! [: F; t9 p6 y
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    $ G: _( @" y/ h; ~# }. G
  39. 2 q7 i. \% C. J0 ?

  40. - Z: q* ?: ]& o6 Q% U

  41.   U, I& e( H, J2 C$ M! A) ?+ I/ g
  42.                 //Start DekaronServer.exe ; c/ W( y  ]3 S: {
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    " Z" O5 Y% z* l! R4 v+ Q) I
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)4 J% b& j+ n& @# o5 S' T
  45.                         szCmdline,        // Command line7 J; ~0 }. l/ m
  46.                         NULL,           // Process handle not inheritable7 t5 Z) ]1 m8 P8 n, d
  47.                         NULL,           // Thread handle not inheritable
    % B- y- \- w  V. R2 s
  48.                         FALSE,          // Set handle inheritance to FALSE( z* k' Q: t( B) Q9 M6 S
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    - p0 _2 O; p4 y4 q; e' s
  50.                         NULL,           // Use parent's environment block* M+ [" j: [; \) N2 D/ A7 \+ |0 J( c
  51.                         NULL,           // Use parent's starting directory
    ! _6 G; ^2 v9 n* t: [$ ?' s5 ~) B
  52.                         &si,            // Pointer to STARTUPINFO structure% @; y8 U; x" B' e0 t9 c# u$ R
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure9 ~. `% ]& [6 P
  54.                 ) 3 v5 ~. J% Y* \6 t
  55.                 {% ]6 |" w. S0 T4 M* U. k: V
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );5 E' x; F+ w6 k/ E# ^8 I) P8 @2 V- ^
  57.                         return 0;
    8 o, Y+ q1 F  M4 A# o5 c
  58.                 }7 V: v8 Z1 J' f* S3 `8 D" W
  59.                 //Creating Process was sucessful
    ' n* w  D  ~+ p* G' a! [
  60.                 else* @; X8 _, m3 x1 v2 r6 U
  61.                 {
    . i! O; }" k; Z( f4 G4 [
  62.                         printf("Sucessfully launched DekaronServer.exe\n");9 u9 Q3 o# `6 X' `: @' u
  63. . d, Q0 C1 K. H6 A1 N) N# n" ^
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure# M/ @; c0 E3 Q: e: i+ D  e
  65.                         dbge.dwProcessId = pi.dwProcessId;
    5 z8 [7 D6 F& o8 P1 F
  66.                         dbge.dwProcessId = pi.dwThreadId;7 m8 Q* `/ h1 N" G" t! Q

  67. 5 W  P( e' i  V2 d4 K
  68.                         while(true) //infinite loop ("Debugger")
    $ C: W* E7 p6 z$ U2 ^+ q
  69.                         {
    $ Y! u1 Y0 k3 {5 j3 R* ]4 B7 J
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx: F# U" H# x3 `1 o
  71. 2 r: W, j( W" ]
  72.                                 /*' r+ g2 N, W7 S: ?- T2 T' q
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

! o4 J" D$ m: X
4 u, k) `* s6 j, u8 W9 |8 J4 F" c" u- k$ a
商业服务端 登录器 网站 出售

15

主题

256

回帖

1250

积分

金牌会员

积分
1250
金钱
859
贡献
115
注册时间
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

回帖

1250

积分

金牌会员

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

3

主题

102

回帖

6221

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-31 06:40 , Processed in 0.086564 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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