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

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

[复制链接]

165

主题

418

回帖

7948

积分

管理员

积分
7948
金钱
2328
贡献
5037
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 8 q) @/ M* o" Z- x' A9 S8 V
8 J3 `) J& J: Z
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
7 ]. v4 `6 Q+ d
" ?2 i0 P( I- |2 N- ]
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    9 p: {* `- P1 B6 C9 P# r$ S. m6 c
  2. //
    1 o, r: N7 n# B9 e1 U7 m

  3. + m9 @* ^% a) s
  4. #include "stdafx.h"$ ^4 u* K1 Y( R$ q
  5. #include <iostream>
    4 V" i. r3 }( O4 w+ p7 D/ d# z
  6. #include <Windows.h>
    * W. ?  D: a2 P1 r
  7. #include <io.h>
    7 ?! S$ g6 @( |! p3 z$ w% _6 u

  8. , j: w6 }- w& f, S
  9. " e% m( e- l4 @* o; D
  10. int _tmain(int argc, _TCHAR* argv[])$ l& E) Z# U. f) O2 n' c
  11. {. D2 }4 v4 \0 g. G
  12.         printf("Dekaron-Server Launcher by Toasty\n");  q8 Y0 l2 _0 b. f( i" o, {2 m. J4 L
  13. + `) O( Z: ?& l: ^
  14.         //查看文件“DekaronServer.exe”是否存在
    $ v5 v" h6 |1 L0 z5 `6 X% W, m
  15.         if(_access("DekaronServer.exe", 0) == -1)
    ' F* D$ p6 i, O/ N+ g, [5 R- q
  16.         {, {- u6 E1 G4 j* r9 ]) \4 T
  17.                 printf("DekaronServer.exe not found!\n");
    / C6 P1 \- n% @( U1 |) r# z
  18.                 printf("Program will close in 5seconds\n");8 B3 p7 A- f$ u8 |, W! g
  19.                 Sleep(5000);
    % \  {3 ~3 }, J1 Z4 X$ {: M/ a
  20.         }
    % n+ F& O2 |" Z% a! `% F3 ?
  21.         else
    3 G) w! f3 [: W- n
  22.         {
    3 [7 J& W( f9 Z( ]7 m
  23.                
    2 X' }" w/ W( J) ^* {
  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
    9 v$ y1 e4 P5 O
  25.                 STARTUPINFO si;
    4 R/ m/ R) t/ n% B& ]0 ]! `* f
  26. * ?; L* v' s* o2 Y! C) K. {
  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! W. M4 m4 N: N# ?
  28.                 PROCESS_INFORMATION pi;
    1 @! A. g+ ?8 h3 ~- a9 k
  29. - r) j1 F5 l4 D, I0 Z+ O& }+ Q& A
  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
    , r6 M3 j8 e4 W! s5 J, X
  31.                 DEBUG_EVENT dbge;4 O: o" W0 o. ?  _
  32. ! M7 |. U1 M3 P8 {+ ^) s
  33.                 //Commandline that will used at CreateProcess
    3 S$ w2 y9 @: {! L+ a
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));) t$ P; G0 a! b6 D3 x
  35. 2 S6 N. p' H, d' L- [7 b
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)2 Z5 K% w* Q# a9 M2 i7 }
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    + j0 K- m) m+ K: ?! ]7 L; ~
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)1 n* D; y" ?' y
  39. + y5 h7 e5 C' a$ @- W* z

  40. % H( `: t# c# [. w6 L; ~( y/ F

  41. / N3 x2 y! P$ M2 T; }. K
  42.                 //Start DekaronServer.exe 3 b4 A0 R  {, G
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    ( p% p! ^$ o; k
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    8 _; _8 d# \% L. g2 W; k/ @
  45.                         szCmdline,        // Command line
    : N: n2 C& s. e0 ~* U$ U7 t
  46.                         NULL,           // Process handle not inheritable6 y+ m* C) }- d- \
  47.                         NULL,           // Thread handle not inheritable
    4 J+ d! D- n6 h. f
  48.                         FALSE,          // Set handle inheritance to FALSE
    - K1 k! M" U; c, p+ p: T3 F8 h+ N0 l
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    % i  J! U( R6 k3 `
  50.                         NULL,           // Use parent's environment block: i$ D1 `/ h- k8 t5 J  n, o' t: R- U
  51.                         NULL,           // Use parent's starting directory
    6 d" Y1 I% a. S, h
  52.                         &si,            // Pointer to STARTUPINFO structure
    5 N/ |0 B5 f+ ?. X; [, {: ?
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure6 @: B$ _1 U" t) @
  54.                 ) & v7 e/ L, K% ]* ~% F
  55.                 {
    + u1 S" n' z8 c9 V( m4 G( J2 Y
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );* K: B' I% F, T) W1 P& G$ e$ E1 T+ r
  57.                         return 0;
    1 J: j7 Y6 J/ \7 [
  58.                 }- v# B1 y2 E4 S* z. z9 V4 B
  59.                 //Creating Process was sucessful/ e. H$ `5 c% @* T; v& [
  60.                 else
    7 X2 E5 l# D& M
  61.                 {; ~! b2 F5 T. ]/ c0 f- R4 I- o( \
  62.                         printf("Sucessfully launched DekaronServer.exe\n");/ e: K( _* W1 X' e' S# T
  63. % O% m: [  T5 p- K
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    , I3 f8 D" v- K/ w% ?1 |6 I3 Q
  65.                         dbge.dwProcessId = pi.dwProcessId;
    0 l4 z7 B3 n' q5 ^2 h
  66.                         dbge.dwProcessId = pi.dwThreadId;) O2 i" {" ^3 [- U/ g' S

  67. ! c- y. ~$ L+ z
  68.                         while(true) //infinite loop ("Debugger")$ s3 b0 W3 W' W% U% s
  69.                         {( `/ w: y0 y0 e2 V. }! D" l/ N/ ]
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    / O  z6 l  e# u: S; Q& Y9 M
  71. # K( N& q& {* |" S
  72.                                 /*' f7 ]: I5 p. p* o! _( z
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
1 ]- }# B6 g5 D1 o
' Q+ N! z, M3 f6 |  b3 ?) s

& U8 }- v& R2 z, o8 n% W
商业服务端 登录器 网站 出售

16

主题

264

回帖

1426

积分

金牌会员

积分
1426
金钱
1039
贡献
102
注册时间
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

回帖

355

积分

中级会员

积分
355
金钱
142
贡献
6
注册时间
2024-5-14
发表于 2024-5-14 15:56:57 | 显示全部楼层
学习学习赞赞赞

16

主题

264

回帖

1426

积分

金牌会员

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

3

主题

102

回帖

9195

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-8-18 20:53 , Processed in 0.058895 second(s), 30 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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