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

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

[复制链接]

161

主题

385

回帖

7437

积分

管理员

积分
7437
金钱
2139
贡献
4748
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) ; o+ D3 A* ^' x2 Q

) b' h0 _9 {- d虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。5 ]2 R7 }6 o/ j  o& i/ U# h6 c5 K3 G% c
, |0 F4 j# @+ @7 R6 o. |
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。! c) f$ h1 q/ L/ N* W% {$ u+ h( L
  2. /// m8 u2 v* d& `3 H: M
  3. - \  K8 k* D- W6 s6 t
  4. #include "stdafx.h"! W: D9 m8 t) c& w& `
  5. #include <iostream>
    & v: w0 s+ ?! t4 T: L# R  N0 q' r
  6. #include <Windows.h>
    5 Y/ S) k+ x/ N5 e1 t# t
  7. #include <io.h>: F5 j7 P! g) U# N; p
  8. 4 i6 Z: D2 z' d2 @
  9. 1 L; R+ F: R# d3 W1 A4 v! @
  10. int _tmain(int argc, _TCHAR* argv[])0 m( p" l$ m4 \, i& I
  11. {, P5 |) D- k0 Z1 ^0 x& A: ]0 W5 U
  12.         printf("Dekaron-Server Launcher by Toasty\n");, I( u$ k8 o6 N) R2 r! C
  13. 4 V) |# A$ R) z( v+ L6 c
  14.         //查看文件“DekaronServer.exe”是否存在
    . _% C1 O; ~8 k$ L
  15.         if(_access("DekaronServer.exe", 0) == -1)4 H! B! x8 D' u1 z6 a( n
  16.         {' H& T& E/ x5 j1 y0 \  S
  17.                 printf("DekaronServer.exe not found!\n");
    ' U! Q6 d- s6 A1 d6 k
  18.                 printf("Program will close in 5seconds\n");" x  a! y2 p+ V
  19.                 Sleep(5000);6 j4 Y# ?  A: u0 Y& v* a" {8 P
  20.         }3 J( c! b! s8 a' n0 A: }6 g: y
  21.         else
    + {* F) [% M3 I) ]
  22.         {
    / m- A1 G6 B) `- E
  23.                 ; l- e5 G% Q/ {- y; 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).aspx+ j) K  H3 _. J2 Z
  25.                 STARTUPINFO si;* ^. x* y5 K. y4 J# Q5 e0 t1 |
  26. ! P' g/ `& D# ?. I# W$ n- X( U& ]
  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
    % @% v4 ?' b. S4 j
  28.                 PROCESS_INFORMATION pi;+ F1 g  k' _1 s* C

  29. ) h9 j3 ?9 `) ~+ e1 U3 |  Y
  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
    3 W5 o! [8 s' E5 ~2 F
  31.                 DEBUG_EVENT dbge;7 {: g6 E; J; c6 z

  32. / c' y- W( i% q* V' w$ P  U  o
  33.                 //Commandline that will used at CreateProcess3 B7 Q& G" k+ L$ b3 I
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));( p1 W6 B2 K+ n: r& q# ]" R

  35. 5 u2 S+ m9 X4 M5 `9 }! T; x" ?
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made); F. v# o3 U# h9 \5 `: ]; O8 O
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    - u0 t' I$ l7 \4 t
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)9 d/ `) S; ?; L0 U
  39. % N+ I. H' l3 s. u' k' h. C

  40. 3 o/ y, `' }* J# j
  41. 1 z. i3 K, y- a8 h6 Q5 S; B  x
  42.                 //Start DekaronServer.exe " X1 Y' {$ @7 F
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx# Z! U$ P/ }! ~$ T! C
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)4 C7 i4 X' |0 ]& j) A9 D
  45.                         szCmdline,        // Command line
    1 c$ E$ W; y1 v0 ?% H
  46.                         NULL,           // Process handle not inheritable3 i' H2 r& _. E# F& k0 i7 U0 k% d8 n
  47.                         NULL,           // Thread handle not inheritable
    9 U6 K: z9 t8 \8 L
  48.                         FALSE,          // Set handle inheritance to FALSE: u% {% R( C. Z# q0 k0 }" I
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    + ?$ s; }  r$ J' H. H- G
  50.                         NULL,           // Use parent's environment block, H$ \* s9 P7 R0 w2 F
  51.                         NULL,           // Use parent's starting directory
    4 E5 f9 t+ D  R1 j+ }
  52.                         &si,            // Pointer to STARTUPINFO structure, n3 r( L% O  N
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    / W) D- l, V  N
  54.                 )
    % Z( x1 s9 j4 c) A3 u
  55.                 {
    & ~; z% L* Q% t# d1 O# J3 H
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    . y* _+ f7 W- q5 `
  57.                         return 0;
    ) C9 ]& P) g6 p, C9 s2 e; k
  58.                 }
    & U% E+ g1 A* D) ?
  59.                 //Creating Process was sucessful
    9 A9 i$ b0 T+ @. j; ?1 e' e2 }/ @
  60.                 else' z2 S+ E- a! [; H$ ^( \( M9 j3 ?
  61.                 {
    3 \  U" F! `* }& U) k- `- L: R! x/ C1 a
  62.                         printf("Sucessfully launched DekaronServer.exe\n");8 Z. z# b, C$ }; g! _, N

  63. - \& K/ ~5 H, x0 B
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    ; U4 A6 [% Q1 ^$ g/ N
  65.                         dbge.dwProcessId = pi.dwProcessId;
    3 K" R! B0 C7 y# C
  66.                         dbge.dwProcessId = pi.dwThreadId;
    3 d8 z/ @% u7 w; z
  67. 8 p* P8 F" Q, Y. R6 j3 h4 v
  68.                         while(true) //infinite loop ("Debugger")
    7 V& [1 V5 b8 ]
  69.                         {' L9 p. e' X* R% d
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx  p1 H* F' r2 f1 `7 j' t1 ^6 \

  71. 1 @3 Q+ H1 y$ X' _: P
  72.                                 /*
    ) s" \5 D. J1 ?9 f2 z+ ?6 d% E
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
1 [6 S5 t* h8 ~- x/ b; i( o
- l. M* b5 k; S

+ i: _" e* ^1 c* d
商业服务端 登录器 网站 出售

15

主题

260

回帖

1295

积分

金牌会员

积分
1295
金钱
933
贡献
82
注册时间
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

回帖

1295

积分

金牌会员

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

3

主题

102

回帖

7977

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-5-4 22:55 , Processed in 0.032583 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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