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

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

[复制链接]

157

主题

370

回帖

7161

积分

管理员

积分
7161
金钱
2054
贡献
4580
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
: R9 w' j9 L6 G- |6 |! n/ |0 F% S9 ?# D
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
: E, K8 s; }: o; E" i4 e2 M! e' X9 O1 `: _  n; b# ]
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    0 e0 P9 K& s2 k, P2 h
  2. //; v. g9 |" t1 Z5 V4 R# m1 B2 V: x  G

  3. 6 L: G+ D6 V. {- i/ G
  4. #include "stdafx.h"
    ' t' P; g# X( f0 i$ J
  5. #include <iostream>1 H4 y0 F  Q. n: A
  6. #include <Windows.h>: f. \. ~( L; T9 E, y5 n) T
  7. #include <io.h>
    + [0 u: Y/ H& t
  8. . B. I2 v5 N" |) X: k- r, i

  9. 4 m" Z. D+ ^+ u4 b; j' S
  10. int _tmain(int argc, _TCHAR* argv[])# f4 {/ F0 S: O! J  z5 G% l1 E
  11. {3 E: d9 f& ^8 m4 f  W4 }/ x/ V
  12.         printf("Dekaron-Server Launcher by Toasty\n");6 q, }5 k% z" L! o

  13. 5 M; y( H' t4 Q3 @! [% O2 e
  14.         //查看文件“DekaronServer.exe”是否存在
    8 w8 c& I, N- w# ^. R
  15.         if(_access("DekaronServer.exe", 0) == -1)
    ! t/ ~4 p* n% m( [1 V; A. Z; [
  16.         {/ k# m+ I9 A# d6 x
  17.                 printf("DekaronServer.exe not found!\n");
    2 ^! I( @2 [" A2 p" [9 y8 Z% X: X; Q
  18.                 printf("Program will close in 5seconds\n");
    9 z, }( G+ z2 `+ y
  19.                 Sleep(5000);$ q+ J3 V6 P' x) e8 }9 O. E( W
  20.         }
    3 `$ W, Q' B2 N. S- p
  21.         else
    - P1 I3 E/ x: I1 ?* e6 X' _
  22.         {
    8 _, y: c1 @2 Q; Y& n7 Z- E6 M
  23.                 # _! r/ ^1 [2 W, X
  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
    * Z8 d4 v, u  N& |$ e
  25.                 STARTUPINFO si;
    : {9 ~# ?* ~2 W! H0 B
  26. % s; C9 `, i( `! _# _. S! p0 b; }% _
  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
    ' H+ Z3 Z; i0 H+ K  O, S
  28.                 PROCESS_INFORMATION pi;4 N$ R' q- Z, i; h4 @" [, W

  29. , |/ p* N# y5 [
  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
    $ N, c3 y' u: S' G+ V
  31.                 DEBUG_EVENT dbge;
    2 O% J8 H" ^, h6 y0 p
  32. 5 k- ^6 F2 y; K3 j1 O- F1 g, d( D
  33.                 //Commandline that will used at CreateProcess
    - g( M& z; D2 ?7 `0 G
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    5 f0 X/ L3 B9 {0 B9 _* E7 Y$ ?- m
  35. & \* M0 _4 z, @
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    6 @' l: ^5 g- y2 D, A3 z
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    # `  _3 M$ U& ]6 \8 p  G" m. s
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)! g% Y! H* X! ?; l; B
  39. : z) b, g- q6 P: S7 x9 H7 a5 e

  40. # I1 ~% a! A4 |6 G

  41. 0 a  [5 T7 z8 I  G5 ]
  42.                 //Start DekaronServer.exe ) c& [. z- \2 e% ^9 ]* G0 l
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    ) b9 U' O. x& F/ ?+ j6 L: t* j
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
      v: i: L  x- \
  45.                         szCmdline,        // Command line
    ' Q9 h: F& i! d$ k1 n! |
  46.                         NULL,           // Process handle not inheritable$ J* Z* U# S4 x2 o$ L: X* m
  47.                         NULL,           // Thread handle not inheritable* x( k" D  W& J2 e
  48.                         FALSE,          // Set handle inheritance to FALSE! A4 n" C  Y; N: [! v9 n9 J
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx) D) F1 j' u7 s$ z
  50.                         NULL,           // Use parent's environment block
    7 ]6 H& w/ x+ K8 Z
  51.                         NULL,           // Use parent's starting directory
    # U+ \# U* m3 Z! D% ?3 M, j$ U% G
  52.                         &si,            // Pointer to STARTUPINFO structure2 W/ e& @3 h( ]. a" V# y. X3 e
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure  ?8 A* e4 E9 s6 r1 ?0 b" }
  54.                 )
    7 A7 f5 s  k( A5 I, G5 \
  55.                 {
    ) e5 {- t* J& C6 f* u+ r7 [
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    ) K6 _- J; j  O  I6 O+ M8 K! W
  57.                         return 0;
    ) N8 v. `  R. i% M
  58.                 }
    * ^8 _: o: M6 h0 g7 E9 b2 q
  59.                 //Creating Process was sucessful& [! t# x% l9 S8 W
  60.                 else
    * A/ h, K+ Q3 w# S4 S( x
  61.                 {4 J& x, Z  u: B, `1 A1 e; ?# O- ~
  62.                         printf("Sucessfully launched DekaronServer.exe\n");- y1 |# C' P5 Y' y& R
  63. 5 m) g: w/ e# u7 z& d
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    ( Q8 A6 ^5 s- V' n4 o9 _+ ?
  65.                         dbge.dwProcessId = pi.dwProcessId;
    1 N3 b/ L! l; V. b4 S$ j- d* O
  66.                         dbge.dwProcessId = pi.dwThreadId;1 G; m" ~; q/ B- G$ Z& O
  67. " p: X4 ?- O+ {" O; a  L9 H
  68.                         while(true) //infinite loop ("Debugger"): [: @" d( u7 c' O) N  G& {
  69.                         {
      K6 r+ Q& z$ t
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx6 H/ p5 ~5 x' w# L

  71. 4 H6 e$ T6 B, M' |: l
  72.                                 /*; M6 w( ?% N+ ?  [) L
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

' O: Y) Q( j  W0 f. B+ c8 @: @, J; b* r( x

( D  n  w6 |7 D# W/ N  C' W
商业服务端 登录器 网站 出售

15

主题

258

回帖

1245

积分

金牌会员

积分
1245
金钱
903
贡献
64
注册时间
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

主题

258

回帖

1245

积分

金牌会员

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

3

主题

102

回帖

7460

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-9 01:25 , Processed in 0.037119 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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