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

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

[复制链接]

153

主题

334

回帖

5706

积分

管理员

积分
5706
金钱
1802
贡献
3417
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
$ Q" Q4 w* x* z9 L" d4 K
1 M; E3 n5 f* ^& _! t虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
) N5 i( r( Z. [* R3 U7 h
1 i7 y; j3 O5 G6 y4 a  n
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    & {% u4 j# Y2 c! b
  2. //
    ) @, u8 A2 T  o+ s6 ?' i

  3. ; k0 c8 w6 ]8 v8 {7 u! A
  4. #include "stdafx.h"
    " P/ d* V2 F1 I: h
  5. #include <iostream>* v$ e6 b9 A& V, s
  6. #include <Windows.h>
    & m! D$ R* f6 k0 G) g* L, @0 e- I
  7. #include <io.h>
    ) }5 R" ^* D  E! o7 |8 p( R

  8. : L1 |; z" _, x
  9. 0 u: G& i1 _: x( [, J
  10. int _tmain(int argc, _TCHAR* argv[])$ b# |8 Y' U% k5 D( D- @
  11. {
    ; g: W/ S) d; [3 z# ~8 q
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    7 j6 ]0 c" U/ |% K9 q; g

  13. 3 v" A- x- S7 l. ~' j# |* v
  14.         //查看文件“DekaronServer.exe”是否存在
    7 O, e* E3 A& `% ^. p+ l
  15.         if(_access("DekaronServer.exe", 0) == -1)0 p. p( O( d) f3 Z$ Y8 S& Y. P
  16.         {
    - Q; h6 r- @' v* [) z1 R$ g. o% I; c; Q
  17.                 printf("DekaronServer.exe not found!\n");
    , f9 I: `8 P; ^4 K$ ?1 D! m
  18.                 printf("Program will close in 5seconds\n");
    ! ~1 z* l1 }: e% i3 K/ o- \# j  ]
  19.                 Sleep(5000);
    : }: m; l6 y1 c7 y
  20.         }0 v; E9 D* R; p+ G, y
  21.         else
    ) U8 a# }/ Z4 O9 v
  22.         {
    0 L6 y" W  Y8 ]" T4 q2 a; o$ O
  23.                 2 ^. m+ w/ Q4 b' s7 }
  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" o1 Q" T. M! N) J2 y( o
  25.                 STARTUPINFO si;
    * P8 g% d' w" d3 e- s

  26. 3 {; A: D4 g" L" \
  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
    ) j* ?4 T- [' K$ N& N! Z5 A$ x
  28.                 PROCESS_INFORMATION pi;
    3 @" o! Q+ z+ N3 G

  29. 4 i" ^- M5 }0 j, i. @( z
  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
    ) V2 ?2 c6 y  I$ q# t6 p" P2 \
  31.                 DEBUG_EVENT dbge;$ i' _1 G5 Q$ ?
  32. , }: T2 M' E+ _* p, Q
  33.                 //Commandline that will used at CreateProcess
    # @; H# r8 j$ _' F7 h- {
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    ( }- V: t5 s& J
  35. ) G" ?% c& J, a& P1 B, L5 m
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    ' ?8 f* j) ?1 u2 U
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)' b  o- n) @7 I' ?& l) ]5 p/ `
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    3 E, d9 W: r+ A2 ^

  39. 7 D( I# g" F- M+ N6 c) V+ E

  40. 3 X/ w: h- {/ l: V# b

  41. 2 j& N$ b/ k; O) s, A9 D
  42.                 //Start DekaronServer.exe ! i* H# }1 i) ^: u1 L
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    ( z9 K' O4 s! V9 E2 ]( ~/ r
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    ( ^3 u6 g& N& o% |# M: v
  45.                         szCmdline,        // Command line
    + ~: j' o5 U# ~
  46.                         NULL,           // Process handle not inheritable7 h' v2 ^7 h8 @) w0 k
  47.                         NULL,           // Thread handle not inheritable; [$ B8 E- \  p
  48.                         FALSE,          // Set handle inheritance to FALSE
    # \# f3 h/ K9 D9 ~; ~; A2 B
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx/ |( `5 _6 p6 T& t# J
  50.                         NULL,           // Use parent's environment block
    & g/ |; o: _: {; P7 k: R& ?
  51.                         NULL,           // Use parent's starting directory # W3 s' v& {* J4 S7 D- G
  52.                         &si,            // Pointer to STARTUPINFO structure2 b1 l  {5 |, R
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure) \& W! E7 S$ R* `" E
  54.                 )
    # d; Q+ X7 E8 ~( C$ p* g( c6 {8 W
  55.                 {4 F  N/ [0 U: V/ R7 m! ~
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );( e* u/ g2 y( M' V1 i7 E, u
  57.                         return 0;
    " R, G* c' [7 S- _; E' m2 a
  58.                 }
    5 D2 v8 l# t8 ~- M6 Z" ~8 Q6 p
  59.                 //Creating Process was sucessful, o) h, `; G) n1 r
  60.                 else4 J7 D& ^7 C2 H, o  o
  61.                 {! f" ]" f  J3 g+ U& V
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    , k& `' ?( o& @# x* X, C

  63. ' c6 H3 k9 E* \9 d. o+ f# {" u. F" X
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    # Y; c: s# w/ y' F
  65.                         dbge.dwProcessId = pi.dwProcessId;
    + @0 e2 ]1 |5 L2 r: K9 n1 U" f
  66.                         dbge.dwProcessId = pi.dwThreadId;) m' ~2 `. ^  |3 ?  e6 Y& R
  67. 8 y  P' B; \+ X8 |* k
  68.                         while(true) //infinite loop ("Debugger")! X9 C+ t9 I! Z' Z3 J% c0 V4 U
  69.                         {  J% f# f" j/ E4 m' [
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx( |% g! P  I" U$ Z; M0 C

  71. # Y8 c$ U% t: C0 X
  72.                                 /*9 a5 f. I! J4 m- l  k/ \
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
1 X2 ?" Z" `$ x. v" o

1 G9 O. U( j+ V& v  _) Z' q! B, e  J8 C3 @. O3 B# d0 P) h
商业服务端 登录器 网站 出售

13

主题

250

回帖

1220

积分

金牌会员

积分
1220
金钱
779
贡献
173
注册时间
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

主题

250

回帖

1220

积分

金牌会员

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

3

主题

98

回帖

5051

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-11-23 19:47 , Processed in 0.063754 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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