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

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

[复制链接]

155

主题

348

回帖

6179

积分

管理员

积分
6179
金钱
1868
贡献
3808
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 2 d. i9 h" j* w* z% r$ ~  C

9 K+ t' h/ \4 a0 u5 E3 N" ^& c/ l8 {虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
* R2 ]. y! g3 J6 d" p* a% S6 {; X  k2 T+ d' g- R
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。9 K, m9 O$ n8 P  S- N
  2. //" [" S1 M% ?" \6 U, b% {

  3. " r) M3 |  z  }- a! O% F2 x6 G
  4. #include "stdafx.h"
    6 i! T1 d: Q/ \# I" g9 }1 Q
  5. #include <iostream>
    8 Z1 {* C! ^/ U9 H! u" P
  6. #include <Windows.h>
    3 ], P; x0 y, v4 I
  7. #include <io.h>4 T2 ?$ e4 I- z* K5 q" r
  8. + V# n+ L& h1 @
  9. ( J! C. s, k$ u4 D; V
  10. int _tmain(int argc, _TCHAR* argv[]). U5 s6 j/ {% Q4 _8 Z2 c- t* T
  11. {
    , Y. A5 C3 X1 R3 G8 T# H8 z) x
  12.         printf("Dekaron-Server Launcher by Toasty\n");; p4 z. q. ]4 z0 e# \

  13. 1 v7 u6 Y1 i1 s1 Z
  14.         //查看文件“DekaronServer.exe”是否存在0 |6 j$ o/ k$ |6 D" z
  15.         if(_access("DekaronServer.exe", 0) == -1)( x, ^  w8 o1 K) N+ Y+ W
  16.         {
    * f3 O, j9 J3 V, [' x
  17.                 printf("DekaronServer.exe not found!\n");, ^: n8 v7 G! N! U+ [
  18.                 printf("Program will close in 5seconds\n");
    & _# Q1 X% e9 Z8 Z# o: N$ W
  19.                 Sleep(5000);
    # O' p7 a+ r- A. ~, c1 W
  20.         }
    : U8 z: f5 K, F- g. W0 ~
  21.         else
    7 f5 T! N8 y% J+ n8 j/ Y3 Q
  22.         {$ d: e+ |* v7 G1 _4 p
  23.                
    ' R5 o8 ]* {: }4 Q
  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
    : i# a& |+ u$ R, Y' A& J3 R
  25.                 STARTUPINFO si;- J+ I& w, M4 m
  26. " X& t! p  p4 i
  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/ F6 b0 q" l. d3 E5 ^
  28.                 PROCESS_INFORMATION pi;) }. L/ B5 h; Z( G

  29. . v! u$ r" q9 N* l$ N4 _
  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
    ) B' P3 V- v1 W
  31.                 DEBUG_EVENT dbge;
    5 k5 K) R  T+ q# `0 Y* n4 |+ o
  32.   h6 J' C9 x" b5 `6 O& d% d- q
  33.                 //Commandline that will used at CreateProcess
    4 G- Y) F, `" ^" Z. Y. s. c; n) D  {
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    ' g3 o% D6 |: x8 d* F$ v
  35. 6 {! J) H% w: P  G; [$ m
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)( P9 ~4 E4 p5 O" V, r  Y
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    : u( _" F. R$ s5 @* T
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    " n0 ~4 U1 P$ S" I. G) N

  39. 6 L3 g+ t2 Q! q3 v2 e9 l

  40. 8 L( v7 e. W" k1 X
  41. ; F# g! h5 _, q* B$ E, u' @0 Y
  42.                 //Start DekaronServer.exe
    2 T1 k0 D- B9 _6 [+ v
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx+ R! t9 Y$ a$ P! p0 S7 D
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)- g3 D. t! \0 P4 j) A
  45.                         szCmdline,        // Command line
    , g. ]& W- `4 Y  P9 m' |7 P
  46.                         NULL,           // Process handle not inheritable1 ^4 _/ Y  C! ]* P* }- z
  47.                         NULL,           // Thread handle not inheritable
    ) C/ `) x" T* C# Y9 s
  48.                         FALSE,          // Set handle inheritance to FALSE
    ( o9 O: p8 \" b
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    7 m: Z+ i& a* O  s
  50.                         NULL,           // Use parent's environment block5 D( e, T  ?0 [% t0 O
  51.                         NULL,           // Use parent's starting directory ' s) z6 w6 N  T# B7 P. [* r9 ^
  52.                         &si,            // Pointer to STARTUPINFO structure
    % p+ y  u/ Z1 w
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure$ f: n! n  D: q( y& {- |! Z+ j7 G
  54.                 )
    4 D% j% F$ [% O: K; r' {- z
  55.                 {
    5 E9 M" |* m1 J' X+ [8 K/ u
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );- z$ g, p1 J1 a! \! v  U
  57.                         return 0;
    9 U9 i( {0 ?4 T' K2 I! ^8 I
  58.                 }* d: n- i: b; u8 x! J
  59.                 //Creating Process was sucessful& V) ^* f+ X5 A9 d! v
  60.                 else
    8 D5 j: x1 i: F" \
  61.                 {2 B" p. t' r; q# s9 P2 i
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    4 q) ]. ^% f* w2 W' g

  63. 3 }7 w" Y, `5 b) R+ e& V
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure$ H' t/ H4 K- e9 P
  65.                         dbge.dwProcessId = pi.dwProcessId;" F3 S. l" b8 ?% g9 T+ T
  66.                         dbge.dwProcessId = pi.dwThreadId;) v, a+ v( W6 I% r

  67. 1 X! @7 H" b# I9 f1 G  d
  68.                         while(true) //infinite loop ("Debugger")
    % d- a- Q* ~, h* u  g' J" t
  69.                         {( X3 `! B! A" D! v" \/ N2 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
    2 G- l! K1 l( J3 y8 H& z' A9 I0 d
  71. 2 t  b! M7 o/ d" Z# c+ `! G# ^2 b
  72.                                 /*0 u( F7 r& [5 K* v/ Y/ `5 _7 w
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

; K6 \' [: w! N; _9 b
4 n3 `" T  x! {! e2 ]; c+ A3 H
5 R, P' v+ K' W
商业服务端 登录器 网站 出售

13

主题

251

回帖

1245

积分

金牌会员

积分
1245
金钱
816
贡献
160
注册时间
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

回帖

1245

积分

金牌会员

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

3

主题

100

回帖

5721

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-2 00:05 , Processed in 0.069260 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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