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

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

[复制链接]

157

主题

364

回帖

6952

积分

管理员

积分
6952
金钱
1984
贡献
4447
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) + d) F' V& k$ h2 G+ q) h* D4 i

2 f. H+ k. \. U虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
! B" n9 Y) p9 A+ n7 d0 Y5 E3 Y. {( m" k5 {
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。/ t" X* O+ u7 R: y9 k5 \
  2. //
    " X* M6 ^0 [7 R, R/ K8 w
  3. 3 c$ F) Y$ N& H" v. M! I4 R
  4. #include "stdafx.h"
    8 _4 A7 [/ h, N( p
  5. #include <iostream>7 k# O9 [1 v* ~  H" x! o
  6. #include <Windows.h>
    * X: f) r3 }4 C* c- R- I( K  ^
  7. #include <io.h>, U! l9 y+ @% j! W, A
  8. ) B' k4 r5 }- ]" k
  9. - b( j# \  h5 B2 l1 {, I5 s" S
  10. int _tmain(int argc, _TCHAR* argv[]). J9 J' F' V9 R+ E% p
  11. {
    % x. J! N4 C. ?
  12.         printf("Dekaron-Server Launcher by Toasty\n");: @3 b: a; c* L9 @

  13. 7 c  u; ^# w  Q8 {
  14.         //查看文件“DekaronServer.exe”是否存在
    5 J) }) d8 J  v/ e0 t3 k
  15.         if(_access("DekaronServer.exe", 0) == -1)/ ]: ?- q" e' F- S( L: P
  16.         {) L, y) k' l5 I/ \( Q7 C- b
  17.                 printf("DekaronServer.exe not found!\n");
    ; p$ o9 P& H& l1 G
  18.                 printf("Program will close in 5seconds\n");
    6 G. i. g, P% B  G( L* V
  19.                 Sleep(5000);
    % B: z) [2 q* C9 W
  20.         }
    4 |  C! S7 W6 h
  21.         else
    8 o( ^+ x& Z) H! x4 A
  22.         {
    % ^+ S; k3 h9 e) ]9 u
  23.                
    7 w; P6 p* H, O& S
  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
    ( a" L& L$ w: J- Y
  25.                 STARTUPINFO si;4 e1 o( d9 }2 W5 t
  26. 1 S- N& F3 O0 q: \- F
  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
    , V5 b/ B2 W  a9 K
  28.                 PROCESS_INFORMATION pi;
    1 I6 U9 G& V/ E* N5 o+ \" X3 I
  29. ( i4 W. |& l9 k% K: A# H8 I' b5 K3 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).aspx1 t1 n* k" x! G9 R! O- v) x4 m5 U; X
  31.                 DEBUG_EVENT dbge;9 ]. x* ^9 |2 C' g
  32. ' g( M$ v+ O( s0 \0 U" H: _
  33.                 //Commandline that will used at CreateProcess7 i% x' l- \& M2 [( @  E7 c
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));0 B/ q4 A* J% S; |% W
  35. # L, L; d4 ]8 f% c! m
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)) x* r4 A' p( o7 ]
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    / W4 g. |0 [# X! o8 a9 R
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    3 ]6 P' J: o, \2 ]! b7 A- O
  39. & ^- i/ x. a0 v9 X4 S
  40. ! f! A5 a* F  U; K' [1 r

  41.   _- I7 B9 H& P/ Q
  42.                 //Start DekaronServer.exe 5 \" k1 ~8 y1 s6 m
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx) X( @1 F7 @- U' l8 J# A( h. H" D
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    / N: R$ E, c9 |% E
  45.                         szCmdline,        // Command line
    3 K) [0 j, X8 @
  46.                         NULL,           // Process handle not inheritable
    , U, h! a% V8 O( R0 P
  47.                         NULL,           // Thread handle not inheritable
    1 Q6 p8 _2 `# j4 C8 {# t
  48.                         FALSE,          // Set handle inheritance to FALSE
    ! |: M6 X* K4 H  x8 ]2 \- m) x
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    % m3 b7 j4 c7 q, Z/ ^. u8 ^
  50.                         NULL,           // Use parent's environment block
    & w# I* \" w* Z2 L; ^% ^' L
  51.                         NULL,           // Use parent's starting directory
    ' C5 p% v5 P# ^  g$ G) s
  52.                         &si,            // Pointer to STARTUPINFO structure
    ) Z9 q' K: Q: D. I) U
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    ' @. Q5 S$ v9 b3 m
  54.                 )
    % {6 l8 i$ M: H
  55.                 {, b4 f4 l' J+ R" U
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    0 {$ }. o' `, v1 `; y. m
  57.                         return 0;2 J( F. {0 C8 @2 U  y
  58.                 }
    ( M  M7 |& u* J. s2 c0 s( h$ T
  59.                 //Creating Process was sucessful
    7 P2 q) g9 ^3 w: p7 [) H7 E# N
  60.                 else1 O6 I: `1 K3 |- ]" R6 B
  61.                 {
    % o6 @  N% n! {  b/ N" P& ?
  62.                         printf("Sucessfully launched DekaronServer.exe\n");  d! U& ^5 w3 k( ~

  63. + a3 x3 A, ~9 d1 m
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    9 C4 W) X# t; l' y
  65.                         dbge.dwProcessId = pi.dwProcessId;
    ) d! n, ]8 f+ b  R. K
  66.                         dbge.dwProcessId = pi.dwThreadId;
    " v& t2 V& ]3 }$ G9 a4 ?

  67. * W% X; g/ s9 U% S& N' B$ x, u
  68.                         while(true) //infinite loop ("Debugger")
    ( z" V" D; e2 @
  69.                         {
    7 P) J- E' _; n) Y
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx% C, y0 P5 }1 I/ E/ E/ b0 c

  71. 4 E. W/ ^; ]" H2 \  ^7 c
  72.                                 /*
    : B. _/ N# d1 B- n
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

6 x4 j4 L: `* K9 C  |% M5 T
; t+ [* ^9 c, y9 m. {0 h9 Q6 r1 e3 k( y: n; p3 Y. `' T
商业服务端 登录器 网站 出售

15

主题

257

回帖

1233

积分

金牌会员

积分
1233
金钱
892
贡献
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

主题

257

回帖

1233

积分

金牌会员

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

3

主题

102

回帖

6897

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-3-11 17:52 , Processed in 0.034567 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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