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

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

[复制链接]

161

主题

397

回帖

7590

积分

管理员

积分
7590
金钱
2201
贡献
4831
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
: t5 \" }9 C: i& M% T: w; t
  s3 }: J8 I' I; R; \& ~* b虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
: h# y: j2 w4 |: ^( G: [* d& X- T; W/ Y2 b& k# p( O
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    , G! V7 x+ ^8 U) @4 T3 `* Q
  2. //5 D/ _& {# G3 x; Q% f6 m

  3. 3 M! {& p8 P* |+ f+ o2 z% C
  4. #include "stdafx.h"
    $ `9 {3 Q7 _$ G1 ?' |
  5. #include <iostream>* P+ N3 H" G1 Z  S
  6. #include <Windows.h>0 H5 ~) ~! f6 R5 A( ?$ L1 ?! M. b
  7. #include <io.h>
    7 G% P$ }3 p  U
  8. # ~& C, I6 Q/ J6 F- B) B3 X+ K
  9. ! w+ y7 {% [7 j- v) A# `7 v+ v
  10. int _tmain(int argc, _TCHAR* argv[])" m, M( g5 Z* ?, M1 Z. X) P
  11. {
    9 G/ l; `' d: N% e
  12.         printf("Dekaron-Server Launcher by Toasty\n");
      j+ |4 Y: S& J  P" O
  13. % B5 o( z* |4 g/ A1 j
  14.         //查看文件“DekaronServer.exe”是否存在
    ; V- P8 q1 \9 G' `" X
  15.         if(_access("DekaronServer.exe", 0) == -1)) O) p2 u8 h* W
  16.         {
    ( T( A. `# u# D9 p3 z% }$ h
  17.                 printf("DekaronServer.exe not found!\n");( O' d* J/ u. d% [5 w
  18.                 printf("Program will close in 5seconds\n");
    3 U) J- W( |8 ^* _# v; c
  19.                 Sleep(5000);
    , M# t; P  W  y8 ]
  20.         }
    6 }$ J4 }5 P8 \' ~
  21.         else: M2 h4 j  l6 Q0 O9 a
  22.         {  o. E; P' E8 s1 h( \
  23.                
    5 E8 H, J6 w  \6 F
  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
    : P4 c3 M3 ?# z% q  C7 w
  25.                 STARTUPINFO si;
    4 h6 n2 K$ W5 u$ f; j# @

  26. ; ?/ b: m6 y! ~7 t% [: T
  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( H! J! D0 u0 u$ |2 ?! r' `' Y
  28.                 PROCESS_INFORMATION pi;, _/ O, h9 [% X- M4 q# \

  29. 5 {+ C, L% H8 @0 Y( V0 h
  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
    9 Z& {7 Z) D- y5 w& m' E
  31.                 DEBUG_EVENT dbge;
    , Z* A9 j: `  \. Y) G
  32. 7 \/ H2 y0 e7 m3 l: N
  33.                 //Commandline that will used at CreateProcess
    " u; h: l* G5 h2 Y
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    8 B0 z8 g5 H+ _6 J9 k1 n  R+ [1 Y# q
  35. / Y6 n. k/ `  Q, `/ V0 r( p/ b/ Y, S
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    8 Y) g! U6 p. O9 {7 R2 I, H
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    * ^; R" `7 @4 N; J# ?5 c+ X0 @# e
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    ( p( v- I$ e2 N) S) t
  39. 3 I, S( y* ~, Y8 Y. o/ q8 d* A
  40.   I, X) I$ k* q

  41. : Y. m# B! i5 y- ?6 c" c; K
  42.                 //Start DekaronServer.exe - S" n% J  W* u
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx9 k+ B( a, `, s; F
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    6 u$ k; Y3 {8 M/ s  ~$ p6 b
  45.                         szCmdline,        // Command line
    - A, _- D$ D$ y" X% M+ Z" j+ ~
  46.                         NULL,           // Process handle not inheritable1 P8 {- }! j. |8 D5 P2 o& D
  47.                         NULL,           // Thread handle not inheritable
    % l) Q* S2 z0 ]! H  I! ~* ^
  48.                         FALSE,          // Set handle inheritance to FALSE
    8 |: }" H1 l" x6 m' [
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx% c8 D7 s* f9 _
  50.                         NULL,           // Use parent's environment block
    7 T; r. O. ^4 {- o
  51.                         NULL,           // Use parent's starting directory 9 N; P% i! [( Z2 S0 X( y
  52.                         &si,            // Pointer to STARTUPINFO structure
    / J9 S5 p% k- Y
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    $ Q8 D# L1 R! }& I
  54.                 )
    " q& X, S$ q/ f) z) T. C
  55.                 {) U% `* }# K( q
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    $ D+ h1 e% T; E: q
  57.                         return 0;
    * W0 K& h8 `- N3 e! }! \
  58.                 }
    & q3 h3 @& |% ]" s1 q
  59.                 //Creating Process was sucessful
    * R" b! b5 i2 y9 \
  60.                 else1 f7 g4 b9 f8 @0 z& g3 L. {7 W
  61.                 {
    & Y  h6 _4 D- }; u* G. g
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    * M: _9 Z% G; R
  63. 8 O/ V  y: c5 X. o
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    ! y+ V4 `7 b+ j! T
  65.                         dbge.dwProcessId = pi.dwProcessId;& s( O& e7 B: d) T
  66.                         dbge.dwProcessId = pi.dwThreadId;
    6 r9 d: W/ O4 m2 E5 [
  67. 5 q+ E5 i# N/ l( f# B- b* t2 {
  68.                         while(true) //infinite loop ("Debugger")
    , M& _. J+ w' H: |# M1 O$ x
  69.                         {
    + A6 y  y; e7 u- r
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    . v2 c/ Y% f9 _# Q$ a! T+ ?3 {4 Z

  71. ' A4 k" n9 D% N% J9 m
  72.                                 /*
    0 P8 [- y6 j- X" G
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

0 _% ]# l5 p' E3 {  ]( c
. V+ {- E/ t( U) @1 f
* f3 k+ b/ T' X1 m& h
商业服务端 登录器 网站 出售

15

主题

260

回帖

1335

积分

金牌会员

积分
1335
金钱
963
贡献
92
注册时间
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 | 显示全部楼层
学习学习赞赞赞

15

主题

260

回帖

1335

积分

金牌会员

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

3

主题

102

回帖

8557

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-6-3 03:10 , Processed in 0.044087 second(s), 29 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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