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

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

[复制链接]

151

主题

312

回帖

5413

积分

管理员

积分
5413
金钱
1730
贡献
3220
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) ; l, @* |$ f- ^+ G

* |: \" A1 o! P+ j' y8 j7 ^- A虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
! G7 r. L. ?+ A( X0 z7 S! l/ n
$ G) c4 m" _! [% s$ D
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    7 c- M) V% d" A. ?- w, S
  2. //
    $ q) b: h5 c# j

  3. ' F. v% J4 B  A) W; ~; O" O
  4. #include "stdafx.h"
    + {7 ~) Y+ {+ I2 U+ y' e8 r% E
  5. #include <iostream>
    & N0 M7 E! G# p" P& C5 f2 S
  6. #include <Windows.h>2 a/ F; i+ y: L1 O6 q0 F1 z0 ]/ }' ]
  7. #include <io.h>; P- L# N1 _5 Y) a
  8. " P1 I; y% T+ G9 @
  9. : G" q) Z: S2 h- w* A) n
  10. int _tmain(int argc, _TCHAR* argv[])- F7 |+ X) F3 X- x' X4 b# H+ X& O! I
  11. {
    7 _0 R3 g1 c( U, |* {5 `: k9 |! b
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    / |: v+ a4 j* g. Q% c) Q

  13. ( R( {6 G! b* Q
  14.         //查看文件“DekaronServer.exe”是否存在
    3 G* ~5 D9 [* T+ }* \
  15.         if(_access("DekaronServer.exe", 0) == -1)+ G3 p9 y9 v$ W6 k! W% f* m1 X8 D
  16.         {
    - l+ w0 O" ^% Y* @6 V: l
  17.                 printf("DekaronServer.exe not found!\n");
    , Q/ j* _% e9 ~) Q" B* a0 ?
  18.                 printf("Program will close in 5seconds\n");+ a9 D) w* y& F$ x0 d
  19.                 Sleep(5000);+ M  c+ s4 O) [
  20.         }! U% T  w8 z* j9 q) p; `
  21.         else
    + Y/ y, l  y! S4 j) W
  22.         {' Z; K1 f& `+ M" n5 {, j3 y5 b
  23.                
    : o3 C* x9 A4 {
  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" Q1 T1 b, o% J9 F1 D, _
  25.                 STARTUPINFO si;
    9 L$ [) l. B" m; k9 m

  26. - Z( o+ O* U- V  ]! \
  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% r5 p" q% }+ Q! K2 W9 u  U
  28.                 PROCESS_INFORMATION pi;+ x& G: ?- N. a9 @/ C; ~- I7 j; a

  29. 1 n3 O8 D0 ~: q0 G0 Z3 t* m
  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- E- Z* h" ~) O/ P6 v4 |6 j
  31.                 DEBUG_EVENT dbge;& M4 {$ T  d. V) L$ Q: n& V
  32. 9 j: v9 w& o5 @0 @7 I% s# K% a
  33.                 //Commandline that will used at CreateProcess
    ! Q+ Q* @2 j/ W* M5 a% p- C* R3 j
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));! d5 Q+ _# s9 }- c( {5 K
  35. ! P  h7 y& B# M+ `' O( S: @$ C
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)/ F7 |5 P! }6 f  {
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    % y5 d8 c' ]; i) z
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    + h- K+ S. m$ q( B8 `
  39. # s, ?8 Z, ^  T6 p

  40. 3 [0 y; _0 y0 F7 q
  41. 9 r1 k3 R3 R; o2 n. U: u" M5 I) p) H
  42.                 //Start DekaronServer.exe
    ! f; V; C6 T  q
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx2 C- p1 M& M: n; I2 x1 s( ^
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)+ i9 }3 A1 Y" O( A/ T% X  g
  45.                         szCmdline,        // Command line) M6 Z9 h! l5 b, V2 I
  46.                         NULL,           // Process handle not inheritable
    8 H( E( O- `  g+ S- x9 r  `, l
  47.                         NULL,           // Thread handle not inheritable. P5 m2 `( [. u) e0 c
  48.                         FALSE,          // Set handle inheritance to FALSE  H7 [3 `. M9 J2 j
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    & w1 C6 L  h4 t% P
  50.                         NULL,           // Use parent's environment block2 w- \$ P9 r* W( k
  51.                         NULL,           // Use parent's starting directory
    0 p0 z$ s: o/ a4 y# z
  52.                         &si,            // Pointer to STARTUPINFO structure" N" l: X$ ~0 k1 v2 C) `
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure' ?5 @. k+ M, I9 Z9 |5 R$ R% w
  54.                 ) " o3 q1 F& A6 O+ |' I8 f  E1 d
  55.                 {
    * t  {% D. s. R8 Y! T* T0 m' e
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    6 C7 A; q' I* s, }; S% t
  57.                         return 0;
    3 w' B; U+ U+ ~2 u
  58.                 }7 H$ m$ |& ^, \8 N% p% s9 ~
  59.                 //Creating Process was sucessful
    - k( Y! y( \! G& I0 }: O
  60.                 else, A$ |$ V# X( A. G0 v9 m
  61.                 {* W( F  h8 g( b8 W3 c! Z
  62.                         printf("Sucessfully launched DekaronServer.exe\n");, z8 j9 s# a* i% c! R6 s' t6 e
  63. + O; t; o+ I" C
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure. S9 a* H" Z7 p: ?; h1 E
  65.                         dbge.dwProcessId = pi.dwProcessId;
    / _/ Y9 Z- W: p) w$ \  f% @' V
  66.                         dbge.dwProcessId = pi.dwThreadId;
    / f: r! E9 s: S: y: Y% \' q

  67. % P3 P1 a1 L4 l$ g" A' H
  68.                         while(true) //infinite loop ("Debugger")$ J+ W6 N3 {" P2 Q  O- `
  69.                         {
    , k5 v* y2 ?* j) {% X! O" y1 q/ 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
    7 b' r8 y1 ~# I+ P% b2 N* z7 V
  71. 2 }* t: b9 P8 M5 j
  72.                                 /*6 H8 i7 j6 k! N9 e( p
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

6 h  x! E; z! F2 E6 V
" d, x% e, S0 K4 w3 B) b; D& f: w. c, k$ i1 }$ X
商业服务端 登录器 网站 出售

13

主题

249

回帖

1180

积分

高级会员

积分
1180
金钱
746
贡献
167
注册时间
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

主题

204

回帖

340

积分

中级会员

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

13

主题

249

回帖

1180

积分

高级会员

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

3

主题

97

回帖

4311

积分

金牌会员

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-10-14 19:50 , Processed in 0.073686 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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