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

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

[复制链接]

160

主题

385

回帖

7427

积分

管理员

积分
7427
金钱
2133
贡献
4749
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
" s5 D& t; {. i  g; E: K; M" d( Z( u2 v% @5 q
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。# |; ]" [' r$ ?% k

, F# K/ M  G1 m/ a1 B/ N1 u
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    & Q/ O. ]& }! x2 ^- U3 R- l, g. a
  2. //
    3 F- A7 Q2 I: U+ h  l  g. j0 l# x
  3. $ ]: X& z( W- B
  4. #include "stdafx.h"% u$ i; z6 G5 x3 Y5 Y
  5. #include <iostream>
    2 @0 ?9 z2 l+ z' m& ^6 |- K  o
  6. #include <Windows.h>) t1 [) y6 R3 D" p: R+ b
  7. #include <io.h>
    1 h4 H; W- |4 `2 Z* N& G" V/ C
  8. ) G4 q' j2 w3 z/ J
  9. 2 [$ c+ j  O0 G0 h, f/ D* ]& m
  10. int _tmain(int argc, _TCHAR* argv[])
    8 `- A9 w6 t9 Q. {
  11. {- l1 I4 j2 L6 s; u. L+ J
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    ' j  A) b8 d% l5 B

  13. ) f0 @" {9 j  s$ m/ \4 y) y6 }" I
  14.         //查看文件“DekaronServer.exe”是否存在! ~/ K& T# C1 `* \4 g
  15.         if(_access("DekaronServer.exe", 0) == -1)
    3 M3 m8 [& R8 C7 [
  16.         {
    / q+ R( j: |3 V& b8 U
  17.                 printf("DekaronServer.exe not found!\n");- M/ ^& N1 V; P7 s. _4 k$ V
  18.                 printf("Program will close in 5seconds\n");& r1 V& `# A! O5 i* D8 W
  19.                 Sleep(5000);8 C, R) A, ~* _! J! T5 u4 o+ x& j
  20.         }! ?/ [( j6 n9 N- B. w7 ^
  21.         else- w1 h+ Q) w  K/ X
  22.         {! ^/ g& O' r6 M: ^; e; j0 z
  23.                 / v% d, [# r5 q5 X! m9 j( |  M
  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  l6 F$ W. b/ O- Z
  25.                 STARTUPINFO si;
    / l5 r" X, z; V4 O
  26. 1 o+ J' h  m5 X# 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
    2 c: W! s6 z* B  L8 _8 m
  28.                 PROCESS_INFORMATION pi;
    ' {( D! {  N1 H; B) S
  29. ) S6 i" T, v# x! ~
  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
    5 ]% `8 k& D) `! ]5 {$ M' S, `6 V
  31.                 DEBUG_EVENT dbge;. P" e( ~+ ?) n+ Q$ C7 ?9 S

  32. 0 w& r7 l! U' c$ s  T
  33.                 //Commandline that will used at CreateProcess
    * i6 e5 \+ n; d& X0 p
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    * u- ]! S- H2 |* O

  35. & s' Z+ D  e% R8 |8 |- F, e
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)& ^  }5 M' V6 E6 s  P2 l
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)- C3 W% }& G8 C. n; E
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)5 z) u4 [( u* P6 g! M# `
  39. $ z5 U4 |- W2 @2 M

  40. 4 G8 q' {2 `2 ~( a0 w
  41. / E1 F. B8 D) v  ~# ?
  42.                 //Start DekaronServer.exe / Y4 a2 b; y- R
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    ; W& G& A7 C* [- v$ t
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)' H. u" K! G$ [! n( N0 Q
  45.                         szCmdline,        // Command line( A) k) c! q1 l6 h5 X
  46.                         NULL,           // Process handle not inheritable! ^6 \+ L  F5 z% V% i
  47.                         NULL,           // Thread handle not inheritable
    : i% O, |1 C  S) ^
  48.                         FALSE,          // Set handle inheritance to FALSE
    % Y5 S7 c! T% S% L* e% o
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    5 o4 @0 s* H0 s# ~8 e0 M3 G7 N
  50.                         NULL,           // Use parent's environment block5 A# A' B  r* }# y5 [! _. V
  51.                         NULL,           // Use parent's starting directory & j0 k3 W$ V6 p, m0 {/ y! Y
  52.                         &si,            // Pointer to STARTUPINFO structure
    : _, r7 J8 ?$ N9 j
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    " U) I5 L9 s7 N+ q) q, H7 [) D
  54.                 )
    + H7 K4 ?% Z7 T: H2 D
  55.                 {# w, F- A! U- `! D
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );% h4 Z7 Q" T/ X& P+ O! A. x9 B
  57.                         return 0;
    " m+ z6 ~' n' m
  58.                 }  @6 _5 P5 o+ O
  59.                 //Creating Process was sucessful
    . W% F6 a9 t$ U1 {
  60.                 else
    1 X) T& H: H3 i
  61.                 {2 E' O% ~3 T7 o
  62.                         printf("Sucessfully launched DekaronServer.exe\n");6 }/ _1 c/ ~' \  F. G5 G& e
  63. ( U" K% R* m/ R) o; }
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
      m0 H. C: R) d4 [/ z, }  k3 f
  65.                         dbge.dwProcessId = pi.dwProcessId;  Y* U& L: i* z, q' u  V5 y( y# A
  66.                         dbge.dwProcessId = pi.dwThreadId;  V8 v+ `' b0 |; q& ?8 G8 e# ~

  67. - [7 h" B) E. i
  68.                         while(true) //infinite loop ("Debugger")7 s' U- S( F7 W6 @1 w2 j8 Y
  69.                         {2 c' a9 t; m, X5 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
    $ G9 \, M5 j4 t  f# H$ s% v& Q- G
  71. & |0 F1 ^7 ]9 B  p- ^2 E4 r# t" L
  72.                                 /*
    9 z  g0 f* B1 t, D4 Q1 g, g5 G
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
/ {2 c$ r; {4 W: O' V( C# L, C# t
; E* V8 W4 `& D# X" A+ |! Q
& K, _7 y* J5 `9 p" ~" G5 D
商业服务端 登录器 网站 出售

15

主题

260

回帖

1292

积分

金牌会员

积分
1292
金钱
931
贡献
81
注册时间
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

回帖

355

积分

中级会员

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

15

主题

260

回帖

1292

积分

金牌会员

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

3

主题

102

回帖

7937

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-5-2 14:50 , Processed in 0.038660 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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