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

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

[复制链接]

151

主题

321

回帖

5508

积分

管理员

积分
5508
金钱
1753
贡献
3283
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
* H# E: _$ S$ T* h( a% h  Z
/ ~9 L# o$ m6 M2 O虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
$ G0 X0 |4 W/ _8 e4 ^( [# x, s. A8 d" B$ Q: T. @% `
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。# _1 V. h6 J6 n# m$ s
  2. //7 s" T  T2 h7 ~6 ^' q- @0 j
  3. 7 R; n, ]$ c* D+ Q# a: I0 J
  4. #include "stdafx.h"
    8 N( ~3 Q) |2 [5 b0 f
  5. #include <iostream>
    * @. N7 N- o" s* O: u( y
  6. #include <Windows.h>
    ; @! H  t$ q, F6 O) F9 d
  7. #include <io.h>
    6 W! A* r4 |( j+ I. B

  8. . m$ G! O' C; Z7 J( i2 Z/ v
  9. : Q/ E1 u) @2 T% J
  10. int _tmain(int argc, _TCHAR* argv[])5 o, k# {2 l" [+ {( S4 N% k/ a2 `
  11. {  k0 Z( J  Z% x$ f
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    9 U  M. ^+ c* V1 a2 D$ Q

  13. 0 D* h( n/ p7 e6 o' p
  14.         //查看文件“DekaronServer.exe”是否存在
      M/ C( H0 s+ K6 a6 r
  15.         if(_access("DekaronServer.exe", 0) == -1)
    , b! t- f5 W$ S% l' }; p" `2 S; y
  16.         {
    4 f, a* L8 Z$ q9 r& s2 i
  17.                 printf("DekaronServer.exe not found!\n");% v0 }9 {+ ~6 ~( w1 d. K- e8 y
  18.                 printf("Program will close in 5seconds\n");! m, {" X' a4 J' v
  19.                 Sleep(5000);/ a' f" W) `/ M
  20.         }# p0 S; V9 B2 O: d$ h
  21.         else( N1 ^) p' h/ N- M, ^  C2 O" X
  22.         {' d# j& }9 Z0 |
  23.                
    7 B  n' R+ V( A1 i6 M8 R
  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).aspx4 k. g# v5 v" P7 R$ M$ U1 p
  25.                 STARTUPINFO si;6 l1 D; {$ \: x2 X! t

  26. ( ]+ E. m4 a! 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
    ' C* t" [" k: [6 E
  28.                 PROCESS_INFORMATION pi;
      m) n8 T! c# A$ N0 E
  29. + N) `2 E0 h7 P6 Z$ r
  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
      T& F! ]$ L* a4 S- e! h$ p8 }2 P
  31.                 DEBUG_EVENT dbge;; |! j$ s$ u5 Z; D  u' j* k

  32. 9 u4 h) X3 g0 y5 D
  33.                 //Commandline that will used at CreateProcess$ Z% u0 U. }5 z+ h: M# H) U) n
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    - j) z+ U/ t/ Z# j3 c
  35. $ ]  a+ S( Y; j0 {
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    % H; \8 {$ N( e+ z
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)8 P5 L2 T1 g, e2 j
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    , b6 H! U1 l; q. I
  39. 3 G  g% T; h: H1 t+ X
  40. $ l/ c5 K! I9 h8 e- p0 Y1 E  T2 v
  41. 2 A9 @2 ]7 Z, b2 G& a0 ]( V+ v8 J1 T
  42.                 //Start DekaronServer.exe 4 G$ }4 Q4 w# {- \0 w- V# ^/ G& {1 y
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx$ S! a2 k; I8 i. |1 R- b- u
  44.                 if( !CreateProcess( NULL,   // No module name (use command line); M8 R0 a' Z7 A; [/ k% g1 C
  45.                         szCmdline,        // Command line
    % Q: L1 s, z) Q% T& f: U3 C9 T) @, ~
  46.                         NULL,           // Process handle not inheritable
    . N& P% C" R3 I8 R/ p- v
  47.                         NULL,           // Thread handle not inheritable2 [9 ^$ G5 R$ u
  48.                         FALSE,          // Set handle inheritance to FALSE+ W5 q/ M: T: o9 O& `: G
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx+ f5 w* f7 z3 i- E7 O) V
  50.                         NULL,           // Use parent's environment block5 P1 K2 P- h% `) S
  51.                         NULL,           // Use parent's starting directory . U6 o: n7 N4 P* ]' t
  52.                         &si,            // Pointer to STARTUPINFO structure
    + }1 {) I4 C+ x3 ]/ ]  D
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    ! T. `9 i9 x/ D0 s2 K/ ~4 o
  54.                 )
    $ o( P" n7 x7 d
  55.                 {
    3 }5 K% x0 G% _$ T& o5 T* E
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );( \- L5 X7 ^* a) m' V; m1 T% i# ?* {
  57.                         return 0;% u! l9 ~' h( {5 t1 n
  58.                 }
    / ~& C# E' W$ x7 n( Y
  59.                 //Creating Process was sucessful9 |! X  F& F3 u' Y1 Y! D2 T, z9 X
  60.                 else3 L  @0 T# ?3 e0 P+ u8 f+ S
  61.                 {
    - H4 A# X- `7 V" k
  62.                         printf("Sucessfully launched DekaronServer.exe\n");0 B( y# a8 h; V) o. x1 K

  63. # j  k. `0 L" l0 p/ S* A
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    / Z1 i  i+ _2 Y6 O
  65.                         dbge.dwProcessId = pi.dwProcessId;8 T' e0 x  s  p# o- y- c0 }
  66.                         dbge.dwProcessId = pi.dwThreadId;
    - e) B. ^% V! K1 M7 U

  67. 8 x. y' [7 n6 L2 Q; F
  68.                         while(true) //infinite loop ("Debugger")
    4 x6 h1 c, D) L/ {+ a
  69.                         {# m+ A- m9 k, a. h8 G# O
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    4 u8 n9 s5 H/ n  \7 N$ s" M

  71. 5 X- v8 {: P3 |1 |$ `
  72.                                 /*
    ) b: K7 Z1 W! b/ \' g6 Y' P; g
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
' u5 n1 a3 f  ?  t2 w

9 B9 h3 B4 b) \) a  `& k8 X9 `" S# I2 p; d# @
商业服务端 登录器 网站 出售

13

主题

250

回帖

1189

积分

高级会员

积分
1189
金钱
757
贡献
164
注册时间
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

主题

250

回帖

1189

积分

高级会员

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

3

主题

97

回帖

4551

积分

金牌会员

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-10-27 09:19 , Processed in 0.072725 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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