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

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

[复制链接]

157

主题

366

回帖

7051

积分

管理员

积分
7051
金钱
2010
贡献
4518
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
5 t* f' r0 k- ?4 O/ t3 Z, i8 M, l9 a+ o* o7 W0 U
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
5 d  P" C. o0 w
7 X5 j. \9 @0 b4 g; W  Q! ?
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。8 P; G& Y+ l" }+ }5 j6 F  ?
  2. //
    7 g8 K' B# k8 X1 s* U2 R: @7 D4 O
  3. 7 _( Z& V2 I) Q: \' N& L* {  r
  4. #include "stdafx.h"
    - R. `6 c9 ?, t% X8 a0 W5 J
  5. #include <iostream>
    3 c, I0 t4 H5 j7 I, m4 n
  6. #include <Windows.h>( g7 i, g2 x, J% _3 o4 l6 r0 }1 v& a
  7. #include <io.h>
    4 X% }; x, d6 G9 G0 H6 l

  8. 6 Y1 L6 j6 z; D' A1 b8 V* t
  9. 6 @; k. P- H4 ~5 P; O) }" A; V* V
  10. int _tmain(int argc, _TCHAR* argv[]), n, P" I* T& `: X
  11. {
    3 E& V; e6 p% k$ T9 Z
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    - J) @  j  N8 @( W6 M' I" i0 k
  13. / i" J. c% d3 `( ]0 C  d
  14.         //查看文件“DekaronServer.exe”是否存在
    5 {" `( C2 l/ O. p6 P
  15.         if(_access("DekaronServer.exe", 0) == -1)9 ~0 e' O0 s( S9 z1 ^* S1 |
  16.         {
    " z, L9 s, Y4 K0 J
  17.                 printf("DekaronServer.exe not found!\n");8 t0 e8 {% w2 E" P' B* I; ?
  18.                 printf("Program will close in 5seconds\n");; y* t* q# `0 L3 x* ^/ {
  19.                 Sleep(5000);9 v) R& X% Y: _/ T5 `1 h- ^
  20.         }/ }# `0 `9 B3 Q4 v& ], J9 W% @
  21.         else
    ( V: p  M0 L5 A9 X- z, }% d+ D6 o5 n
  22.         {
    6 M8 b3 v. c$ j) W0 l
  23.                
    0 S* M: m& x1 x* N# P5 I# Y
  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
      U' E4 N" X3 ]" w* m( B
  25.                 STARTUPINFO si;
    ! P8 e7 s3 `3 B; b) T5 ]

  26. 2 D6 ~. x" D0 K. {7 F0 l
  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
    3 Z/ F  i  u- }& s7 x& z' O
  28.                 PROCESS_INFORMATION pi;  C7 E8 D6 W, u' t( Z- A% Y
  29. 4 V* A4 ?8 I8 o5 }/ g
  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
    6 }7 b. r$ K- ?$ I6 X
  31.                 DEBUG_EVENT dbge;* n8 u! x) m/ v' J; h) h8 F
  32. : d; x2 `' D6 U" g; G: k8 h+ b/ Q$ F
  33.                 //Commandline that will used at CreateProcess
    ! y, D5 f  ^) M/ U! H
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));8 t  v; L4 d$ \( P) v4 X0 j% G
  35. - N3 e! E; ~5 P. h5 {" {8 U: X% c
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)8 K6 o) r' e# V: \1 Y. [8 v( M
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    9 H8 f9 M1 f0 L0 I
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    $ O3 ^* `/ n) w8 j1 A( Q- I

  39. ' g8 M! _8 Y( k; c  @/ h' K

  40. ' ], E4 l- H1 c4 p

  41. % \) k- N- B3 {: n
  42.                 //Start DekaronServer.exe
    * d# n8 a& L( J/ C9 c- x
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx4 p# e! _1 w# @  z' ?2 Z
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)8 E2 E% V0 \1 l' o9 V7 q2 y
  45.                         szCmdline,        // Command line
    : z* P/ [% u) L& X/ }7 A# o. n
  46.                         NULL,           // Process handle not inheritable
    9 _4 b9 P' `: V2 E9 P
  47.                         NULL,           // Thread handle not inheritable
    + r( t3 u+ y4 u2 T) q
  48.                         FALSE,          // Set handle inheritance to FALSE, R& n  H: g' z, g8 L
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx3 |- p. ^- Y5 c# S0 Z
  50.                         NULL,           // Use parent's environment block8 ~# B6 O: Y2 {5 o# a
  51.                         NULL,           // Use parent's starting directory
    9 |( q2 v( y; Q
  52.                         &si,            // Pointer to STARTUPINFO structure
    5 E! M* X0 r- h' s+ l* N2 l
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure$ i4 j) N. j; t0 l1 L) J, g* V3 s! p
  54.                 )
    & V- r, I4 o. C0 W6 K
  55.                 {
    ( U; Z' ?$ h8 h0 x% O6 F
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    + n7 E3 _5 U! ]- E2 G
  57.                         return 0;
    . S. c! ^$ p" @& r4 D
  58.                 }
    $ C, V$ ?: U# H  D9 q+ e' Z! Q( @( \& j
  59.                 //Creating Process was sucessful  V- W  c2 j2 U2 V2 z
  60.                 else) |: O) q; a5 V4 y2 }
  61.                 {% j( Z3 U1 u' ^% G* i7 R4 G
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    % t. h3 F7 R& \) m* a" X! `

  63. % e) y9 M% F2 s$ j3 h
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    1 k8 `# @; p5 c8 t2 H# K" e9 b
  65.                         dbge.dwProcessId = pi.dwProcessId;, j- ^  W8 b3 e
  66.                         dbge.dwProcessId = pi.dwThreadId;
    8 u3 R( |" ?& e  `( ~! ]: w

  67. # u! F4 k, M. r3 \
  68.                         while(true) //infinite loop ("Debugger")5 r/ Z- M5 z  [; ~; q; Y0 ]8 z
  69.                         {
      e( s! P% C" k0 V
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    - x/ x( m7 y* a" ^4 A6 v+ b

  71. ! R; x5 H+ r- _# E" U' t0 s
  72.                                 /*
    . H) c7 H1 Z* e
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

" `3 q' E$ V; a5 x! H( [# n1 ~: H6 z4 O# ^

0 ^" W, ?% \+ R/ R* `
商业服务端 登录器 网站 出售

15

主题

257

回帖

1231

积分

金牌会员

积分
1231
金钱
894
贡献
60
注册时间
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

回帖

1231

积分

金牌会员

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

3

主题

102

回帖

7157

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-3-24 14:44 , Processed in 0.032400 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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