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

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

[复制链接]

137

主题

210

回帖

3992

积分

管理员

积分
3992
金钱
1418
贡献
2227
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
$ N1 G) r3 V% ~2 u
9 y$ H  t+ g+ n1 h/ J! f* R虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。6 j- c! E4 B9 l! C: A6 {2 O

& a( m2 @" t. N8 t
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。4 e5 m2 ^: {; R2 i/ P# W/ Q
  2. //
    8 |, J# Q9 M+ e5 \4 I& B

  3. 0 X4 T/ a" E. ^0 ~
  4. #include "stdafx.h"' d- \5 }0 `: |/ A/ p  e) q8 p
  5. #include <iostream>
    , Q  V" c+ s: f# o$ w% i1 K
  6. #include <Windows.h>* J  d# b! Z1 p. ], c5 X8 Y2 d
  7. #include <io.h>, J) `- U7 l0 W9 O- S

  8. + [- c) c0 E$ G% L) K1 j

  9. , _- e* \) }  v
  10. int _tmain(int argc, _TCHAR* argv[])
    4 n1 l9 w( Q- _1 H
  11. {
    " {* E2 S4 z% e& \
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    8 R* B, B$ w. w! I0 f( {+ `

  13. ' y+ x: G( t3 T6 O
  14.         //查看文件“DekaronServer.exe”是否存在
    ( v/ m1 `) ^5 o# t6 J
  15.         if(_access("DekaronServer.exe", 0) == -1); ^# j' `5 y& r
  16.         {
    4 A- }  l; D* {. ~
  17.                 printf("DekaronServer.exe not found!\n");$ o- p6 I/ t; l
  18.                 printf("Program will close in 5seconds\n");
    $ ^; ?: j5 v! W5 S
  19.                 Sleep(5000);
    5 w$ x' j+ `! R# a
  20.         }
    # l+ B% I+ U, l( q$ L" |* c2 N( c
  21.         else+ A$ a; }1 r# i8 U& H
  22.         {
    . y% \7 G# e; Z) z) \' j; U
  23.                 # M( w/ F4 f+ v% `
  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* a7 g  ~: U7 A  H# O* [7 t
  25.                 STARTUPINFO si;( b! @" t1 m( N# @
  26. ' ~& N; u  O' I5 ]8 w9 L. I
  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! Q6 X/ C3 G' e' E
  28.                 PROCESS_INFORMATION pi;
    8 r# ?3 @* z# {' x3 U, V

  29. 1 F% M0 D  }, o- i2 ~6 g2 s
  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- q/ }) `# q4 W8 |7 a! h) V2 W
  31.                 DEBUG_EVENT dbge;+ ?( {) \6 g, }5 U3 v

  32. , _4 V9 x" g! T" ?% K, b
  33.                 //Commandline that will used at CreateProcess
    ( @) _: d7 `5 C) U
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));* u% @. _4 F# Q4 G* d: G$ B2 N. J. p
  35. 6 {/ d9 A  Y/ U  w
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    ' R' ^6 ]/ H) s2 U9 D
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)/ \$ @$ O6 N$ q8 j* R0 S
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    * d9 b: g. a# V# r) }% Q* l

  39.   A$ A( ~: [) g6 m! B& ?2 L

  40. 9 E6 L- |3 h1 D6 L* a

  41. ( d" q4 Q; Q0 h. P3 H
  42.                 //Start DekaronServer.exe * a% r) a( Q: D! M
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    3 Q/ n: Z8 W7 |$ C7 g" x
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    ; Z2 V$ e5 f' R9 E0 X- H. }6 ^$ Z3 b
  45.                         szCmdline,        // Command line: p& w$ G! ~' U! }: e4 t
  46.                         NULL,           // Process handle not inheritable
    " s2 I! |5 y$ B3 S/ B" A9 w0 {" [
  47.                         NULL,           // Thread handle not inheritable2 E& g- d# i6 T" C" U, e8 U
  48.                         FALSE,          // Set handle inheritance to FALSE
    ) y$ w; i4 B6 i* M; h6 q
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx- n. P, ]+ ~) i: u# J0 o- `+ K
  50.                         NULL,           // Use parent's environment block% ?2 Y! |' @2 B' l& g1 _
  51.                         NULL,           // Use parent's starting directory - \; y: D9 N  s+ V
  52.                         &si,            // Pointer to STARTUPINFO structure1 a0 V# d4 D2 d6 E# L' m
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure% ?1 _1 }% U6 u) }$ V7 ?, V
  54.                 ) ; K4 G5 N) ?) G. m( }+ N$ c
  55.                 {
    5 g" c( |' h/ }" i. w
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );5 Z. D9 k& M- P/ R9 V, E& G
  57.                         return 0;
    & C% g+ P  I' N, x
  58.                 }. f% y$ \8 E- @6 ~, r
  59.                 //Creating Process was sucessful' R/ A( t8 o) F2 ^8 F, T$ I. ^
  60.                 else' R( Y' h. M2 D
  61.                 {9 z% {& ]; A) _* b  m
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    ; W7 {: Y3 @' s& L- b
  63. % W/ G( Z3 l4 i% O
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    - c; }0 Z1 @6 F( B, j+ ^
  65.                         dbge.dwProcessId = pi.dwProcessId;
    + y0 \0 c9 d5 m! C9 |
  66.                         dbge.dwProcessId = pi.dwThreadId;
    / t( D' y8 x4 K, E) K0 f1 A
  67. 9 {2 i) N+ Q9 B4 r/ B, I# t4 j7 N" W* U8 u) _
  68.                         while(true) //infinite loop ("Debugger")- ^/ x" W& A; A# N( Q. J
  69.                         {) t* l/ V5 Y3 s0 r8 [# w) D9 T
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx8 y5 y- [- B9 i6 X" I& Y) _

  71. . S% b+ Z7 O3 d+ Y) @. s  X# {: \
  72.                                 /*+ K8 B* M& |. b/ T+ W6 ~
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
' W2 r" f4 O5 Y4 B
! i" ^( W* D1 r9 b

" Y& i9 e# H4 X( B
商业服务端 登录器 网站 出售

9

主题

234

回帖

956

积分

高级会员

积分
956
金钱
565
贡献
143
注册时间
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

主题

195

回帖

316

积分

中级会员

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

9

主题

234

回帖

956

积分

高级会员

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

3

主题

89

回帖

1736

积分

金牌会员

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

本版积分规则

Archiver|手机版|小黑屋|EGameol

GMT+8, 2025-5-19 17:26 , Processed in 0.066912 second(s), 25 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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