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

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

[复制链接]

157

主题

362

回帖

6846

积分

管理员

积分
6846
金钱
1946
贡献
4381
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
! a% [; V& s  p. G( _
8 L( B; ?. I# ]1 U( R虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
4 o  K3 |0 Y$ V- W6 |3 u; j7 U- [) B" M: ?
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。, C8 ^% B5 a( q2 U
  2. //- e# k( T4 G# P; R% r
  3. / F; L0 d- }! j) O3 {& t, ^( c
  4. #include "stdafx.h"0 b' V+ \  J1 Y. B
  5. #include <iostream>3 _4 w' `& k3 A# B2 z1 z
  6. #include <Windows.h>
    : N4 B; K$ q* l% H2 r' Y; g4 g
  7. #include <io.h>
    ; E% M7 L. m& T) ~, d# k5 d

  8. * |: d, V$ f" e# w; V
  9.   u2 c4 c7 f. r
  10. int _tmain(int argc, _TCHAR* argv[])
    3 I  U* d) q2 U  x: e/ c( |
  11. {  o  C! p( d- Q. Y
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    9 b, Z' D, Q  j# Q) W6 M1 m

  13. 3 W# F- G/ F; P; U% W
  14.         //查看文件“DekaronServer.exe”是否存在
    " l5 G9 a  ~& b: S# x
  15.         if(_access("DekaronServer.exe", 0) == -1)
    4 y& J  [8 c& y! S  \
  16.         {
    3 c9 D5 L5 `0 v& y1 `  f% s
  17.                 printf("DekaronServer.exe not found!\n");9 Z. i) r8 m! |, P! m, z6 u
  18.                 printf("Program will close in 5seconds\n");
    8 l4 n, U6 D6 d
  19.                 Sleep(5000);+ C" |3 m* Z1 y! L( [
  20.         }8 N% ?. q, E" E/ y! i9 W
  21.         else
    3 y9 v6 m, q1 t  n
  22.         {
    ; g3 F8 m0 k, N
  23.                 : t, `" f1 @- g0 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; b- d+ D! {' y5 o8 P& B
  25.                 STARTUPINFO si;) ^  _: K" j. A
  26. ' A! `6 A& t6 g/ x
  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
    1 Q+ m- s0 ^- x( }1 Y* A, z
  28.                 PROCESS_INFORMATION pi;
    9 {2 Q; g# P1 R

  29. 6 s. [! y5 m. J" r* _+ C1 g3 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: f, o2 k9 K  @+ o% i! j' Y- s( H% W
  31.                 DEBUG_EVENT dbge;5 H8 W* N1 Y5 [7 ]: }1 Z3 K
  32. 1 `5 y! f* ~0 j( Z% E; ?
  33.                 //Commandline that will used at CreateProcess5 z$ c0 y8 K  A  A& O5 C0 K! S: Z
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    0 _- ~5 E; U  i  ~7 Q

  35. 4 ?+ [  S; U0 T$ @* J
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)+ y: A) j- k+ u9 A  X: X- L9 B+ W5 o
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)( P% L; g: ~5 j! E; Y
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)( L5 c' Z0 q  R$ x) ?' O8 Q

  39. 3 T' h4 ^* {" ^% ~: ^9 z& [) \

  40. " H1 I9 h8 K. u+ V1 k) b2 m" a
  41. 9 C2 X4 i4 g$ V- A% j  b6 }" Z. l  Q
  42.                 //Start DekaronServer.exe
    0 c% }" W& ?, W# `
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx9 p0 C. e3 J. r5 v) x! N
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    " l* S6 V. V2 o3 u3 q% C0 G
  45.                         szCmdline,        // Command line: f; f) q2 A7 P  z2 C
  46.                         NULL,           // Process handle not inheritable2 L2 E, T9 O* i  n
  47.                         NULL,           // Thread handle not inheritable
    4 C1 d! M7 t. i# u1 o: y
  48.                         FALSE,          // Set handle inheritance to FALSE
      `8 f( r4 X; i7 n4 K2 J
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx4 n) {, V. l# W2 Y; d' [) N' S
  50.                         NULL,           // Use parent's environment block7 K4 t7 ?( |4 p
  51.                         NULL,           // Use parent's starting directory
    0 F) F( e1 V1 y
  52.                         &si,            // Pointer to STARTUPINFO structure9 p0 S' Q1 u! Q* L5 L& u
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
      Q5 T: p5 \* n+ {, `
  54.                 )
    6 ^* R# [' K( L' i# m( b4 p% A
  55.                 {$ _, N* G* ?6 x1 \
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );: J" J2 a) e" {& \; Y7 |$ E9 k* I$ f
  57.                         return 0;
    : b1 T0 X" T9 Z
  58.                 }
      R. b* ?3 n0 J! r# g1 w
  59.                 //Creating Process was sucessful' R. n# c( {# Q% g: V
  60.                 else
    ) O2 q1 I$ R/ E! S7 S
  61.                 {3 o: S& G/ C5 T4 A( w6 u
  62.                         printf("Sucessfully launched DekaronServer.exe\n");6 L# p' J% `1 N; Y% \$ R

  63. 2 h# d5 W% O+ h3 P, O0 l& H; C
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    2 B! `$ C' V# u# t+ N! S
  65.                         dbge.dwProcessId = pi.dwProcessId;/ @; B! h4 X: i, G
  66.                         dbge.dwProcessId = pi.dwThreadId;# o( D" i1 _! g  [9 G

  67. . }" L4 w9 L4 ^: [) w! c
  68.                         while(true) //infinite loop ("Debugger")
    ; W$ h4 b4 D: w- N
  69.                         {1 p; b% h- |( k! {
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx/ l. A% K+ c0 `4 S' ?' `* i* O
  71. ; L: A: q: S# ^3 u. f  V, @* s5 u
  72.                                 /*
    * |5 _  p9 O! U( h8 f  Y* S4 O
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

! \9 ?8 a( b7 T5 x3 k. o6 @* e+ u! E9 H% I. t6 C/ D2 Q7 V* M

0 {6 Z! [+ g8 V  @) \6 D. p+ Q
商业服务端 登录器 网站 出售

15

主题

256

回帖

1274

积分

金牌会员

积分
1274
金钱
877
贡献
121
注册时间
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

主题

256

回帖

1274

积分

金牌会员

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

3

主题

102

回帖

6594

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-19 14:21 , Processed in 0.063100 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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