找回密码
 立即注册
查看: 5973|回复: 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 贡献) 2 D( [9 |9 e: X; b% S) a  G
( ^8 q9 s: i. W& F, p
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。6 `7 w* M$ |1 N7 _

$ S" v- h; Z$ u  P$ o: @
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。1 K+ V% @: {- K' b% k1 b( e+ R
  2. //
    % {; Q6 `$ Z7 c, y+ S% G/ b
  3. & ?/ J# x* `. e, U  f6 q4 L- S
  4. #include "stdafx.h"
    5 z. S! |; \9 w$ S5 [
  5. #include <iostream>
    + }; j! }8 Q2 E; ^
  6. #include <Windows.h>7 u1 r  Q( @( B
  7. #include <io.h>
    $ b' R0 a- g2 H  N4 v3 Q: q8 O
  8. 4 f3 \9 y/ J" ], I2 N/ ^: A

  9. 2 X4 U6 T2 b+ |% m) d6 |$ T
  10. int _tmain(int argc, _TCHAR* argv[])
      m$ h; v! ?$ |2 m' S/ ?
  11. {3 X0 ^  T* a' q
  12.         printf("Dekaron-Server Launcher by Toasty\n");, F- Y1 _. i2 M( g" b
  13. 1 V/ g4 p# @6 q# {
  14.         //查看文件“DekaronServer.exe”是否存在
    8 Q' q0 j- h4 ]' M
  15.         if(_access("DekaronServer.exe", 0) == -1)
    " j: F* g; ]7 s* r( l% T0 S$ ]- U
  16.         {2 U' z1 h% N8 B
  17.                 printf("DekaronServer.exe not found!\n");
    & x  K$ ]. \2 r3 }. G- U, ?' l; N
  18.                 printf("Program will close in 5seconds\n");0 a6 P4 N1 K  h5 [* u. S, w# C
  19.                 Sleep(5000);6 E  z, A# A5 Z- Y# g* K8 {
  20.         }
    2 [9 p- K0 W; N7 T0 e5 {- I
  21.         else
    4 E5 M) B( x& p% n4 ?: N# O. v) a
  22.         {. S( U) m  j2 y3 E2 S
  23.                
    & H/ t3 L6 L7 J
  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).aspx0 o# y' C1 @4 u7 E
  25.                 STARTUPINFO si;
    3 s" L. _5 R, g" S! K2 X( J6 {

  26. 3 b$ l; f, i* q. |& o
  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& S; O. g9 j0 @( Y- l
  28.                 PROCESS_INFORMATION pi;9 w$ I' S/ P3 [& T. z5 o3 b& x/ ~

  29. - \# p6 ~, j( ~) o. d( u: K
  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
    ' W/ i$ P6 l! ?( T7 J/ l. L- |
  31.                 DEBUG_EVENT dbge;% J4 n, P/ q  B% D& L- w; y: _
  32.   N  S  c% |/ b( t6 R/ k
  33.                 //Commandline that will used at CreateProcess
      S# O5 a* ?4 r$ Y/ I# B
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    & w0 \( [* Z' R& w4 W9 R: x6 o
  35. - U* Q3 X. d7 B
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    0 \7 q/ ?: X$ Z- n" {
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn), a3 t7 `8 @! }0 N: K8 c, j/ X. n
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    - Y$ ?8 G' u% ^; L2 g
  39. 3 P* D0 t7 m8 ]" d. p; [4 z

  40.   O# {" `8 J  e

  41. 9 \) ^* a% c' G0 D, b6 q2 l
  42.                 //Start DekaronServer.exe
    4 k9 _8 B" d2 c6 Y4 t
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx& c, |" Q8 U2 Q  ?# ~9 d, d' X7 F
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    + f9 J3 [7 N3 |5 D$ |
  45.                         szCmdline,        // Command line
    9 I2 Q+ C' I3 Z% ^" v! ?, l: B
  46.                         NULL,           // Process handle not inheritable
    0 _9 ]- y' M7 B) R, u% D
  47.                         NULL,           // Thread handle not inheritable
    8 T# H, R. G$ r, b
  48.                         FALSE,          // Set handle inheritance to FALSE6 M" K% U/ n& U1 x
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    5 [5 U; ?- E! D+ t/ {" Q5 Z
  50.                         NULL,           // Use parent's environment block4 W6 A" F0 s5 N! |) a) c# b3 w: `
  51.                         NULL,           // Use parent's starting directory
    ' p+ F2 n' X+ n$ b
  52.                         &si,            // Pointer to STARTUPINFO structure
    2 C: D1 M% x' t/ f9 K% _
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    , \% {% k0 U3 t6 z8 `& ~
  54.                 )
    - p2 ]# p/ `7 s# `6 w
  55.                 {
    + V: e9 U, u( \+ Z
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );' x- L# q9 H- f. ^1 p- m% i" u& [/ p
  57.                         return 0;2 I6 P1 C! {4 H
  58.                 }* Z1 ]6 A1 {  W8 l
  59.                 //Creating Process was sucessful
    / L. N4 a! f; R/ s# l
  60.                 else9 f: v2 T' {; v& u: X
  61.                 {8 H. Q. K" ~. d6 n2 |1 m1 B
  62.                         printf("Sucessfully launched DekaronServer.exe\n");) i& o& N3 ^5 Z: W8 C9 }' f' C# B

  63. 1 E% `& f3 c" x7 a( J7 g- B  q
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure* M% V) K2 t$ @9 {
  65.                         dbge.dwProcessId = pi.dwProcessId;
    ( N5 f) U7 }# Z* c6 u. W
  66.                         dbge.dwProcessId = pi.dwThreadId;
    8 Y2 ~$ G" z( ?9 Q6 V/ r: M# F

  67. + P1 u  P* t5 y7 `3 K* `6 Z
  68.                         while(true) //infinite loop ("Debugger")
    0 e, N0 m! g) r6 r8 F# r  I% ?; W
  69.                         {2 z( m0 E$ `9 g8 p$ c( ]4 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
    ) C2 S6 a) d% k* P. ~' s
  71. : P$ Y9 z! N4 v) y6 y' _
  72.                                 /*+ I" u3 i. f( O: S
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

, |9 ?' q9 G5 w8 n/ t. [2 A
' J% T/ j  Y' ]! O5 x6 B) X; s
! J0 a# e7 o+ {9 R/ q$ E7 W
商业服务端 登录器 网站 出售

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

回帖

7997

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-5-5 01:53 , Processed in 0.047084 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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