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

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

[复制链接]

157

主题

364

回帖

6927

积分

管理员

积分
6927
金钱
1964
贡献
4442
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
8 t! \/ j+ F) o/ C) U9 R% E! Z1 _' a  m7 t5 y5 h' U' d7 f: M
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
6 ^0 g) w" M" q$ T
1 C& [$ J' x3 t2 r& p
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    , v: ^+ e- Z- m1 C; ^/ O6 s, I
  2. //- i, k% a( ^. `& ~# [

  3. $ m, v7 a; w6 Y* `8 K+ C
  4. #include "stdafx.h"
    1 y! p' E9 U# _
  5. #include <iostream>0 W0 L( c0 S+ N" [) y
  6. #include <Windows.h>
    7 V5 f# Q/ V5 ?/ S& @  a- M1 J! v' P* X
  7. #include <io.h>( `6 _  P1 R3 {. X% `; f

  8. / P8 K) g3 |3 M: a1 x0 Z

  9. & Z5 U+ Q/ Q9 i+ |0 [" J% S
  10. int _tmain(int argc, _TCHAR* argv[])
    # p- S) Q9 C6 g% _. g, A
  11. {
    8 I& L/ d, }) g) U5 N+ d4 Z2 V
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    . w+ `$ i5 l( [. m7 ?5 g9 m
  13. & Z1 Z3 x  X" M: |6 O
  14.         //查看文件“DekaronServer.exe”是否存在
    , \6 s' w6 b* ]/ r: P
  15.         if(_access("DekaronServer.exe", 0) == -1)
    , Q5 }. }& P+ g# B, i0 t; A5 M
  16.         {1 J4 c/ A8 y9 @
  17.                 printf("DekaronServer.exe not found!\n");3 k9 d6 j* j. T& Y5 p3 ?" ^
  18.                 printf("Program will close in 5seconds\n");5 J* ~7 e+ m- Z$ D( j$ B( X) Y
  19.                 Sleep(5000);) r+ J! |$ [& m) J- R' z' a
  20.         }' w" Q6 P$ S" A# n
  21.         else6 S2 g; `0 W% ^- _
  22.         {
    : N# u& `7 {2 Y$ m( Y: I- E5 x
  23.                 0 }: K! R7 U7 y+ ]  W
  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% i, X) d, ]4 _
  25.                 STARTUPINFO si;
    $ x, K/ X; d! D: X1 w  m
  26. 4 ~$ S: S& w& I% a
  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).aspx1 u, f  `1 M; l9 G6 c: c3 g
  28.                 PROCESS_INFORMATION pi;8 h& }4 J/ t  B* c! ?* E* w8 T" F
  29.   O# L$ X& K/ m4 ^7 e
  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! ~/ X: u, P$ T' ~/ M
  31.                 DEBUG_EVENT dbge;
    " ?# }, M4 A6 }
  32. # A7 Z9 j( X* x- g  s
  33.                 //Commandline that will used at CreateProcess2 a9 c- ^6 H* m! K  y  q
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    ! u! H! b) Q( y6 W

  35. * r" I) f* y1 ?1 N+ G- G3 ?
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)  n( @+ [. C9 Z: w; A
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)/ O. F8 Z% l0 U3 ~, ]
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)  A( s' l  O: c; m; s3 ?
  39. 8 [# |1 o+ e7 @4 j) R, _

  40. 6 J6 H% L# a( Z  b

  41. $ n) g( x) C5 c" L( B
  42.                 //Start DekaronServer.exe
    + \  t- ~4 y$ o; x& @. N+ \
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx$ y' F  Z, W( w3 V( [9 x+ m6 ^8 j2 c
  44.                 if( !CreateProcess( NULL,   // No module name (use command line): D$ Q* r/ [9 j8 u, H
  45.                         szCmdline,        // Command line# c$ R2 W) a( e2 d- C) R( @7 Q
  46.                         NULL,           // Process handle not inheritable- j9 Z, m" |8 c+ C4 i5 O0 f7 t# l
  47.                         NULL,           // Thread handle not inheritable
    ' Y+ n7 L5 ]6 |: X
  48.                         FALSE,          // Set handle inheritance to FALSE
    : N5 y3 I6 Q# T
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    8 N# u# L3 C6 I
  50.                         NULL,           // Use parent's environment block
    , P3 N* C% X# g% O7 P6 |
  51.                         NULL,           // Use parent's starting directory
    : }0 u9 |7 O4 E  _
  52.                         &si,            // Pointer to STARTUPINFO structure" S7 p4 u; f1 W& Q9 D
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure. m) E; B8 W! S/ h3 F% F' |& U
  54.                 ) * }% s+ k7 Y" z. B" s
  55.                 {# h: _2 N! i% a1 o! J# r" Q$ y+ m* d
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );/ W; q0 G( n' w. T
  57.                         return 0;
    5 x5 |. D7 F# {
  58.                 }
    5 w0 l$ K+ t4 \% o. _" N  {' ?
  59.                 //Creating Process was sucessful: ?7 e/ f* t- {) u
  60.                 else6 Z1 h7 {% m' F5 O/ V, x9 y
  61.                 {5 b3 r8 \$ T  ^: z! r
  62.                         printf("Sucessfully launched DekaronServer.exe\n");3 k& k$ l% Y- v: C
  63. 2 ^: |# [* B  x
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    & G. t, N# b% \; O3 u) p
  65.                         dbge.dwProcessId = pi.dwProcessId;
    & N$ p7 r" t5 H% @. ?- m0 Y
  66.                         dbge.dwProcessId = pi.dwThreadId;% }. \5 n. C: O; T7 u
  67. + H3 W& t+ H" w+ n1 _
  68.                         while(true) //infinite loop ("Debugger")
    - I" S4 ]. s6 h4 }6 D
  69.                         {
    : R$ z& ]  c# z$ d
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx( p  Z7 n8 V9 C( x, b* c8 Y

  71. 2 a) Z' P. L. z5 E
  72.                                 /*- t6 x4 N- k' ^/ {2 q
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
* d- R1 z. Y- K0 K5 Q

3 g" Z. x4 F. d3 D' [! X: R1 X2 D% m9 D  f( l
商业服务端 登录器 网站 出售

15

主题

257

回帖

1226

积分

金牌会员

积分
1226
金钱
886
贡献
63
注册时间
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

回帖

1226

积分

金牌会员

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

3

主题

102

回帖

6759

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-3-2 12:11 , Processed in 0.075315 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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