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

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

[复制链接]

156

主题

352

回帖

6266

积分

管理员

积分
6266
金钱
1886
贡献
3872
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
+ \% L6 E% _+ v% c8 U" A
5 p9 _! O6 i& H" S虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
# X8 o( ]( v# k4 e' M9 Z1 x/ p. m0 S5 X5 {- [; c5 c" k$ ]
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。! U3 \) Y! z9 Z& ]9 q
  2. //1 [/ U- e7 Y6 t7 b' t2 d
  3. " z- l- ]" f% G5 e& e3 P6 \* k3 q' B
  4. #include "stdafx.h"' J. T% v' q! I& g9 U
  5. #include <iostream>8 ~& m, q- Z4 X  i# |  a& @4 Y0 ~
  6. #include <Windows.h>4 ?4 l8 }7 a. m: [% |4 W- `# D" t* V
  7. #include <io.h>
    $ U( B; \0 L2 _8 @
  8. ' I- g* f' ~, e4 {% ?9 [! G9 f

  9. 3 V- Q6 s" x& C5 O
  10. int _tmain(int argc, _TCHAR* argv[])- |; Y) I, t  y4 U
  11. {- z" G2 X3 M! [
  12.         printf("Dekaron-Server Launcher by Toasty\n");  M" c) i: h3 H! I
  13. 5 I& A: {6 I6 c2 Z1 K+ m
  14.         //查看文件“DekaronServer.exe”是否存在, G( L! h7 I6 K
  15.         if(_access("DekaronServer.exe", 0) == -1)2 O  p  V2 h# F$ r# C4 I  y9 D, _
  16.         {  |& k' z! [# z6 E4 Z! }
  17.                 printf("DekaronServer.exe not found!\n");7 X6 ^- w1 K) H8 w
  18.                 printf("Program will close in 5seconds\n");0 [+ y9 X7 P4 Z
  19.                 Sleep(5000);2 H9 X& F& |* y/ {: ^# N
  20.         }
    ( V' g  e5 l( g, u/ a* x6 A# n
  21.         else
    ' w7 f) H1 `& ^* k4 j" a# p9 J
  22.         {5 r5 G- r+ m# j" I: v3 M
  23.                
    & c& g3 Y& J+ q& Z, K8 i  a1 \8 d( m
  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* W& ^: v  I0 }: z, A# m
  25.                 STARTUPINFO si;
    4 U. U4 b! E0 b  }+ C  c

  26. 7 F2 {$ s( j" w* U
  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).aspx3 I+ A( W: b- v+ W0 J
  28.                 PROCESS_INFORMATION pi;
      m9 Y7 E) q3 f. x
  29. : K- H/ F4 \+ N9 Q( D; a5 |8 T7 u: F5 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
    9 n+ y; ~0 j# K3 n1 G8 s0 G
  31.                 DEBUG_EVENT dbge;
    % H' T7 y+ O! \7 x: N+ d# F# w

  32.   K+ x0 N# |9 S0 Y% ]1 ~
  33.                 //Commandline that will used at CreateProcess/ o4 z" a# P/ I7 [
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    + ]8 m+ z) h, r

  35. . h3 {0 W1 ^8 X1 M- M& z( R8 O
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)& w: M4 H! F) V" Y1 B
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    . S' E& z! g; @; S
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)1 z5 L0 ]3 d  W
  39. % V" ^# J$ z' q. H$ p

  40. + ]/ \( ~0 x$ |5 B6 ]2 `5 i

  41.   T$ J6 ]- R0 `4 x! _/ S8 Z( s
  42.                 //Start DekaronServer.exe
    6 ~" ?/ a, A* w( C7 @
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx- Z6 d; R* f7 X- w+ a% b+ M& h
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    3 b; j4 p+ A& [0 P, K& e8 e2 {! Y
  45.                         szCmdline,        // Command line3 Z! I7 G0 N1 c4 ]  @( U  p  E$ p
  46.                         NULL,           // Process handle not inheritable0 m( X+ g2 t2 o
  47.                         NULL,           // Thread handle not inheritable# P$ K4 B4 B2 L7 G, d
  48.                         FALSE,          // Set handle inheritance to FALSE
    " X- }/ }3 Q7 d# l; w& h
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx, }& c3 z" p% K, I
  50.                         NULL,           // Use parent's environment block
    3 w4 V5 O9 }# ^4 \% l6 Q  j0 A" E3 H
  51.                         NULL,           // Use parent's starting directory
    + Y' y* i+ o) _* y: ]
  52.                         &si,            // Pointer to STARTUPINFO structure' B' V& Q9 L' w; b" X% {
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure8 f, T9 t& J; g+ r* y
  54.                 ) 8 s- S+ Y1 {" [3 T+ L2 J  \. K  t# ]8 A
  55.                 {
    , U; y  b# k! b" r. e
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );; |5 t' b6 B3 f
  57.                         return 0;
    * v' B, b* S& s0 Y" L
  58.                 }$ O3 [) W4 l: l3 a- H  J
  59.                 //Creating Process was sucessful
    8 U3 U3 ?7 e/ H, h, p- g
  60.                 else
    : m5 X/ b: w6 B& x# s
  61.                 {
      w5 `( O* ~) i6 t- g2 J" t
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    $ ]6 j% A$ L& G. g. f1 V1 L

  63. 2 d. a7 ]/ V# m' ]3 o
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure' C+ q; ~1 h" |$ y0 Z6 E4 n
  65.                         dbge.dwProcessId = pi.dwProcessId;
    & A3 S9 n. L! X/ ^8 m; v. |; N
  66.                         dbge.dwProcessId = pi.dwThreadId;
    - i- k8 u7 S" X

  67. 7 t- S1 O; s( l. W
  68.                         while(true) //infinite loop ("Debugger")
    0 G, c8 n9 Z0 P2 F; s) `9 ?
  69.                         {
    8 U' i% T% M3 O0 y8 Q* f; t) ?
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx* w3 g( ]/ R: u6 ]$ [" s- _2 F4 L

  71. / q% I( s6 c! ~# y+ C
  72.                                 /*
    ! s% [& f& H# x
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
( e* ^" y( `+ f, n

! D# @4 j) V) s6 o
! E5 m. p  A$ W( b  H' t
商业服务端 登录器 网站 出售

13

主题

253

回帖

1258

积分

金牌会员

积分
1258
金钱
834
贡献
153
注册时间
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

主题

253

回帖

1258

积分

金牌会员

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

3

主题

102

回帖

5983

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-16 05:13 , Processed in 0.068166 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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