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

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

[复制链接]

155

主题

348

回帖

5959

积分

管理员

积分
5959
金钱
1860
贡献
3596
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) ' |" f6 m. ]; d3 G
; Q5 l' D" n4 n: J
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。6 `7 Q+ E; z' r  u- W/ Y

$ J0 v5 G  I! _8 N. H4 Z
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    " v. d. y' ~; f6 }' ?4 p8 ~& z& ?
  2. //
    , \* Z' I; y+ o" S8 u5 u4 j8 J
  3. 4 W3 V" m1 f4 g; c* B5 r, I
  4. #include "stdafx.h"
    8 Z7 N3 v  B6 Y: E6 d
  5. #include <iostream># p; [# X; A$ D6 M+ V
  6. #include <Windows.h>
    ! w9 V6 A9 c5 L; C+ }. e/ o4 ^
  7. #include <io.h>
    # m1 s- k: s% Q. j6 [# a5 u. d1 z

  8. 8 l7 E  c. J5 ]" _% q  E; U

  9. ! `, ~- R: n$ Q/ X0 l. J
  10. int _tmain(int argc, _TCHAR* argv[])
    6 o! }# Y/ j! H
  11. {% i6 V4 f8 e  o; W2 K
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    2 |5 B' B' X/ O; `) A8 u4 y

  13. 0 E- z' L" H3 P7 y
  14.         //查看文件“DekaronServer.exe”是否存在
    8 y0 i$ m% H$ ^, `% M2 v1 F
  15.         if(_access("DekaronServer.exe", 0) == -1)
    ) P5 S) q# }/ ?' p
  16.         {( C1 H8 q$ ?( t% m6 U
  17.                 printf("DekaronServer.exe not found!\n");
    1 \4 @' R3 q& x% E. D
  18.                 printf("Program will close in 5seconds\n");; m" K9 {' q# R: x! A
  19.                 Sleep(5000);
    # {0 S1 P2 P( M* _) G7 Z  U* l
  20.         }
    1 o7 U4 g4 J$ c2 K0 o# V
  21.         else4 A- P, M0 e/ z, e
  22.         {( v1 `2 j$ h7 c) x2 M* O% @- j
  23.                
    9 E, f" d' l( U9 g" D5 A
  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* N/ s) G# T% U: J
  25.                 STARTUPINFO si;
    9 c8 H  n* U. A0 Y9 {! H
  26. ! P0 u. w" g& K' E8 F/ x" j
  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& q$ G% x" N& M: t% ^, A7 @
  28.                 PROCESS_INFORMATION pi;
    & M/ N4 b& R( x: ^
  29. 9 y# e4 P; N: w$ m, Z5 N& M6 u3 b% X
  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).aspx9 u( F' R' N3 R" x7 ]$ _
  31.                 DEBUG_EVENT dbge;/ K! n* y' E& N. u
  32. # \" y' ~# j/ T/ I) [" @" H! R# A1 |
  33.                 //Commandline that will used at CreateProcess7 e5 ~( T+ C% ]% m1 p! [
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    3 z) `5 B0 X$ R! T& U
  35. : r4 P2 T: ^1 Z9 k. x" I6 Y. B0 d
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)  {. I! H. x1 g) V. y  s1 F
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)3 Y% ?; o" v2 u& e
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    1 s7 E0 d8 X. ~# m# @; V  e7 C, f# e8 i

  39. 5 p" X9 t3 \9 ^* ~
  40. 3 t/ Y6 w, i7 ^
  41. . D& B+ V3 s  g! @; O% w2 N
  42.                 //Start DekaronServer.exe
    , E4 P1 |4 X& k5 ?2 N- f
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    # F  a3 s) x8 f: M8 E
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    # \. ^# Q9 @* _! p) a* ]
  45.                         szCmdline,        // Command line
    + c" F7 z$ o) v
  46.                         NULL,           // Process handle not inheritable( D6 N* _  X& {" O+ s, B
  47.                         NULL,           // Thread handle not inheritable
    # B; X+ p/ f. L3 g2 o! D" a: ^
  48.                         FALSE,          // Set handle inheritance to FALSE9 ~, R  v8 c( e* W
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx9 u8 ?' f8 j8 L4 s' G- h
  50.                         NULL,           // Use parent's environment block8 }: _" _( [2 B+ f- r4 ?+ d" S
  51.                         NULL,           // Use parent's starting directory " p% u- k/ _) m2 O) D: e
  52.                         &si,            // Pointer to STARTUPINFO structure
    7 @' T( r7 ?, \6 y5 A6 G
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure6 ?3 P( w5 V. B$ A
  54.                 )
    4 A" E$ o" V  h
  55.                 {
    6 u4 H' B; H* U' _- x
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    , H1 |7 W( v1 G& m
  57.                         return 0;
    % }6 W  @. f$ I! o& t
  58.                 }
    - l3 [2 J6 @0 y( l& n
  59.                 //Creating Process was sucessful9 w! x, V2 S! f- J: Y+ ]
  60.                 else, W; k- i- V: P/ ]9 c* C8 U4 W
  61.                 {
    / }* G3 }4 l. e2 O& @. [7 V
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    * Q- e) b' E7 S* Z9 N

  63. ( V9 i6 G( Z+ X1 x1 C( t. e
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure- j2 Y# {" T& x
  65.                         dbge.dwProcessId = pi.dwProcessId;) e6 K1 k% W8 h# d; L
  66.                         dbge.dwProcessId = pi.dwThreadId;
    1 U0 K, G: g) B7 g+ \# i

  67. 2 z/ {6 m8 M% ?' A" }' B. \. F
  68.                         while(true) //infinite loop ("Debugger")
    / a/ v/ H$ B/ M, x4 y8 [  X) y
  69.                         {
    4 A9 C/ `+ z2 n# l5 u) S7 v) A6 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# m( q/ Y, ^% N5 w# u# A; y

  71. # H( e: n1 S+ Y$ s, e$ H
  72.                                 /*% ~# E8 q. M7 W, w% q2 z9 ?
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
. |# g9 J; U6 C# U# ], f
5 n3 G0 A/ {9 U* V4 [
$ m' s3 H- B/ M
商业服务端 登录器 网站 出售

13

主题

251

回帖

1239

积分

金牌会员

积分
1239
金钱
812
贡献
158
注册时间
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

主题

205

回帖

345

积分

中级会员

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

13

主题

251

回帖

1239

积分

金牌会员

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

3

主题

99

回帖

5693

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-26 12:15 , Processed in 0.081089 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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