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

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

[复制链接]

157

主题

363

回帖

6895

积分

管理员

积分
6895
金钱
1959
贡献
4416
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
& [4 G0 Z% {* \3 c3 c( K8 k
. c# }" h! Y4 h" {) |虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。% @7 ~3 y: x$ i. C5 Q8 P
( B0 |+ ^8 z) F; f
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    9 @; k* h2 D2 i4 [" x) N
  2. //
    % Z& t( h) q8 y8 U( D6 m# A9 `

  3. % F# ]  t' L) w
  4. #include "stdafx.h"
    - w% Y* m6 n+ P( ~' n2 B
  5. #include <iostream>
    ) p# h) c9 S" R2 s" E
  6. #include <Windows.h>
    $ D, z+ p- B9 X# d: P& {  ~9 {% C
  7. #include <io.h>. _" Z2 p  A& d2 b, X
  8. + P1 H- a# \: u$ C" b+ M

  9. 7 r' m) J9 T: B5 B: G
  10. int _tmain(int argc, _TCHAR* argv[])- T# `5 S# M: S& H! v% c
  11. {
    5 m, A8 E: ^; Q. k' L) e4 m4 ~& D
  12.         printf("Dekaron-Server Launcher by Toasty\n");: J# h) ?. E1 G3 s; W! C* F
  13. - K$ W, y, W/ o0 ~
  14.         //查看文件“DekaronServer.exe”是否存在
    7 v4 P9 s; b5 y: P  Q, u( B
  15.         if(_access("DekaronServer.exe", 0) == -1)
    ) D# S+ V9 E# h- P/ U6 Y
  16.         {
    & x: H8 U/ \8 j# ^  l
  17.                 printf("DekaronServer.exe not found!\n");
    3 c. T- {. `, l# j7 u& o# K3 n
  18.                 printf("Program will close in 5seconds\n");
    % `( L) D+ l1 B/ w7 e
  19.                 Sleep(5000);
    9 ~1 f9 X3 D/ H: u# h: G
  20.         }2 `4 y, n# v) n4 ?4 E
  21.         else
    0 o# m" I; }7 O5 m7 T: |
  22.         {  w! F( j+ d3 m1 b
  23.                
    8 s  t6 P! G% Y- s0 H, R% z
  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).aspx6 n% f, W' x+ Z
  25.                 STARTUPINFO si;) C1 `6 [+ }; [+ A6 {3 m% a
  26. + |" |$ H" w9 u$ T, Z% {( W
  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).aspx7 y  n, \' Z" Q+ n( x
  28.                 PROCESS_INFORMATION pi;
    / t8 E" `. B% N1 A

  29. & B* _! Q: w; G6 A: R6 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
    0 w) T9 ]% e! ]2 t6 s8 I0 G! m
  31.                 DEBUG_EVENT dbge;# r2 X! F) E' b9 I
  32. / }) T! j  \# E
  33.                 //Commandline that will used at CreateProcess: H$ M+ K$ P( C  U
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    & W$ p* ]# b  B7 n! W! @
  35. + ~% a  F3 O# I/ b7 o/ B: R, g
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    1 d% q# B& \( }
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    9 O; T; @, n8 e) A
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    % L* J, F5 @$ q# c6 y1 X  z/ I! k. d$ Y
  39. 3 y0 c/ R$ _3 D! f  H& Y3 c" w

  40. & P, ~6 {3 F) `: l. B1 J
  41. , m5 e+ b) `5 [# {) u: Q$ s
  42.                 //Start DekaronServer.exe
    $ N2 B, C# m& Y  _  p! e  }2 \8 v
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx% D" i; v" w& [" u/ @
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    8 l# Q2 g: O7 ?! \7 w
  45.                         szCmdline,        // Command line+ X8 a8 g" m: F/ z+ A
  46.                         NULL,           // Process handle not inheritable
    / k8 c% q+ ~# p. \2 G5 d
  47.                         NULL,           // Thread handle not inheritable
    9 W- @3 [- _5 r* w( n
  48.                         FALSE,          // Set handle inheritance to FALSE
    + R5 X6 |, c. U
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    $ V/ A+ V8 w4 x1 P9 a3 g
  50.                         NULL,           // Use parent's environment block
    5 h, P1 m8 ~6 U+ f) s
  51.                         NULL,           // Use parent's starting directory
    2 U' i( D8 f4 ~+ f- I3 k. l' v4 T6 `* n; ^
  52.                         &si,            // Pointer to STARTUPINFO structure- B- ?* w* C' f" L) ]6 o6 |3 f- x
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure; _4 d; S4 C+ r3 `2 J. W
  54.                 )
    9 _+ h, g, k# Y7 d4 a; d! h
  55.                 {& G) b% Y; T5 Y" ]* g% t+ f
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );) s! K& W! |; {) }1 Y1 O  K
  57.                         return 0;0 u0 b$ l: S  b
  58.                 }
    9 J% b( y! i' d2 c& V& g$ v
  59.                 //Creating Process was sucessful9 H: |" n" ^+ S5 x
  60.                 else
    9 Y( r3 U$ l9 R0 s: w  q$ c4 B
  61.                 {$ |2 n; ]' L+ I. C# Q/ ^8 t
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    " ?! [* O' U3 \, w
  63. " i! P3 E" c7 W$ e( a) t* E3 K1 y, B% ?
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    & A- o, K$ u  q' ~5 k; h' K
  65.                         dbge.dwProcessId = pi.dwProcessId;
    . U) ~5 d& m8 y, m3 D* V2 A( Y- c
  66.                         dbge.dwProcessId = pi.dwThreadId;) @, C+ g6 J$ V. c: I

  67. # `1 u1 Z, |& m
  68.                         while(true) //infinite loop ("Debugger")
    8 N9 ~% t' M1 u+ m* K# s
  69.                         {2 G: X% d% v& B* |. _' z
  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! T. j/ h. h3 L3 D

  71. # K. H5 D. E, J1 r' ]& K
  72.                                 /*2 T4 A; Q) f* m' Q# g
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

2 G( c4 H- e. X0 C' G$ {0 h/ n. V! {" P
. m; {! `7 ?/ K+ E- U4 X# Y
商业服务端 登录器 网站 出售

15

主题

257

回帖

1255

积分

金牌会员

积分
1255
金钱
884
贡献
94
注册时间
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

回帖

1255

积分

金牌会员

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

3

主题

102

回帖

6659

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-25 03:07 , Processed in 0.056138 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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