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

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

[复制链接]

155

主题

352

回帖

6233

积分

管理员

积分
6233
金钱
1878
贡献
3848
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
7 N9 c# \, k1 P
6 e! T! V$ d8 w1 B8 B虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
* K7 }6 i% W% s
! l. N6 ?- J5 K* W% H& }" \, g! q
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。/ Z; U4 M8 l0 I; f7 l2 w
  2. //6 l; L) l# Z! n
  3. ; \5 i/ f7 x8 ?0 E, L* ]  }
  4. #include "stdafx.h"6 x" H, m, R0 }3 G3 b
  5. #include <iostream>
    + P; d7 D1 v5 V8 O  A. S4 u0 b
  6. #include <Windows.h># Q' u' O% y3 ^+ J1 G
  7. #include <io.h>  w8 B. t- b- E. X* x/ q$ }: o

  8. 8 A* e* o: }/ M; w
  9. 2 a0 C* A. J: z/ S, w
  10. int _tmain(int argc, _TCHAR* argv[])
    " S' ^6 ^7 [8 l7 r& h1 u
  11. {" {* C2 g; p2 s- g; N" \3 ^1 P, y& M
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    6 T; }2 K  t  s- t% V3 J) L

  13. * W9 h8 J* _; k
  14.         //查看文件“DekaronServer.exe”是否存在9 p4 M! F: z7 U: C, ^
  15.         if(_access("DekaronServer.exe", 0) == -1)
    - o  i) `4 k  {4 M' Y+ p6 H% Q1 L
  16.         {" r$ d1 Y; d/ H3 W7 ?" J$ @* h% G
  17.                 printf("DekaronServer.exe not found!\n");, @# b+ A+ G& m9 p7 W
  18.                 printf("Program will close in 5seconds\n");
    9 x) I( q( T: j; K# ~* A
  19.                 Sleep(5000);
    9 H, y4 \5 U$ u# d
  20.         }+ {% T; J, {0 L* t; y4 `
  21.         else
    ) C6 M8 B! S+ Q3 v# s% H9 j
  22.         {
    9 B" W7 ?" g- o6 v& Q
  23.                
    7 h% n/ `6 |8 t# n" ?
  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).aspx6 {% a, \% P7 a3 t5 J
  25.                 STARTUPINFO si;
    8 h; H( z2 V) G( `, P# l% O! n

  26. 1 p  B$ h; c1 }) e2 T2 [  T( j
  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
    + n% a6 \# n6 }% f1 N& t% v
  28.                 PROCESS_INFORMATION pi;
    6 a9 v9 j7 g9 d  L& ?* I
  29. : \/ K8 a4 s4 W( }8 s
  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% d- j5 l1 k
  31.                 DEBUG_EVENT dbge;
      J0 I" e* N! p4 H

  32. ! J2 Z) U& j; d9 m+ N
  33.                 //Commandline that will used at CreateProcess' {5 u5 @' y8 ~. F& c
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    ! ?4 Q8 ^- d$ d+ F8 e, {

  35. 7 p: t: Y7 }6 {/ T7 b, F! P
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    - W- W- z9 U; E* f
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    9 S9 D9 C# }1 J2 a6 X
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)- r/ k1 C' x, M. f7 ~' ^2 j
  39. ; T! A) h$ R( F6 [

  40. ! R: b$ Q! K0 r0 f& b4 u

  41. / I1 }+ z% r4 S) l5 B
  42.                 //Start DekaronServer.exe ; }, _/ @: e+ [7 g: K3 ^
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    + s& `3 f& y$ Z- E" r) O
  44.                 if( !CreateProcess( NULL,   // No module name (use command line): t* |4 T! j/ y
  45.                         szCmdline,        // Command line
    ! ~3 Y& @" Y3 q6 g- O( H& |
  46.                         NULL,           // Process handle not inheritable& d7 l4 l3 C% N7 F5 e
  47.                         NULL,           // Thread handle not inheritable9 r9 x2 W4 J$ y: f$ p: D  c
  48.                         FALSE,          // Set handle inheritance to FALSE4 R: h' F; y1 X+ \
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx  P0 i! U  V  k1 f4 N
  50.                         NULL,           // Use parent's environment block
    & W# j3 `& m2 {* d5 x
  51.                         NULL,           // Use parent's starting directory
    + P3 q% Z9 }# w; r* I& z; g
  52.                         &si,            // Pointer to STARTUPINFO structure
    ! \5 G! \8 t' O! J
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    + j- E0 w& T' X; b/ K; u: ~, q
  54.                 ) 7 }; e; L; N- R" ], ~6 L
  55.                 {
    1 |2 a; u- C& V4 k. L9 m
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    , X! }3 e4 k) {' }: F
  57.                         return 0;
    0 e+ I( h" r9 u* ?5 ^; ?; L
  58.                 }0 h2 r( ^: b7 c4 U3 p, _
  59.                 //Creating Process was sucessful
    " A2 U. D5 C3 F; D5 {: Y
  60.                 else+ U; M& Z0 n, e; e2 q$ m1 v  k
  61.                 {' H$ q1 d; |- ]6 x# l3 s6 I
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    " i7 u) J9 `4 k6 G' n4 V
  63.   K6 p( @* p/ @) l" S/ N4 [0 e
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure) n9 t9 y4 @1 F6 H" k8 V+ n
  65.                         dbge.dwProcessId = pi.dwProcessId;
    6 F0 ?3 n, \- {, W4 K: x2 M& A, t
  66.                         dbge.dwProcessId = pi.dwThreadId;
    ' l9 p1 Q; I6 ]) D! V  F
  67. 0 h3 D: R6 Q4 @( ^
  68.                         while(true) //infinite loop ("Debugger")1 a7 K$ x. `/ \5 R4 }+ N# y
  69.                         {8 [! w; ~+ z: o9 X7 \% U
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    1 ~; r$ Z% n8 z' b% n

  71. * C% c4 ]6 `2 e
  72.                                 /*
    ! z/ W8 D6 D; Q/ S
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
8 u0 B3 F+ b  U
7 v1 [1 O" U& B7 X
7 g) N, p& R, ?6 O
商业服务端 登录器 网站 出售

13

主题

251

回帖

1250

积分

金牌会员

积分
1250
金钱
826
贡献
155
注册时间
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

主题

251

回帖

1250

积分

金牌会员

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

3

主题

102

回帖

5883

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-11 11:36 , Processed in 0.103682 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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