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

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

[复制链接]

136

主题

168

回帖

3156

积分

管理员

积分
3156
金钱
1032
贡献
1820
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
( |* z2 Z% t# V" e4 P; H! O
) m$ k& h7 \4 K; Z) i虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。4 p$ U& R2 [! L
2 j0 m9 E& z: p
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    0 o5 Q; f4 \4 v% j0 Y1 g
  2. //
    ' W6 l" G5 O. q0 ^) Y( B

  3. ; `2 b" ?  Q4 q& |1 L& |
  4. #include "stdafx.h"
      `( C8 {9 Y. N+ W, p# u
  5. #include <iostream>
    ! S' C8 j+ T: d/ I. I/ X7 Z
  6. #include <Windows.h>! S0 V1 s) G; Q4 Z, j
  7. #include <io.h>
    2 t+ ?( E/ m9 c1 V/ g

  8. + S  v& h9 k# I& ^6 M' F; b- M: {
  9. ! z8 r4 Z7 D3 P& @5 J% v
  10. int _tmain(int argc, _TCHAR* argv[])- m' i  i" w- D: `
  11. {
    6 d6 ]' ]/ x% i4 `# R# p6 ]
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    % \  D3 K) i9 X+ L
  13. # Y7 E" S& f; d: J
  14.         //查看文件“DekaronServer.exe”是否存在5 t! e" `8 N8 b
  15.         if(_access("DekaronServer.exe", 0) == -1)
    8 w, D' N% O4 o
  16.         {
    : t: ]! Q2 F6 w* P8 y
  17.                 printf("DekaronServer.exe not found!\n");
    * ?# @% R: I* N; G; E3 i& R
  18.                 printf("Program will close in 5seconds\n");/ b7 V: Y7 ^8 ]: y8 y0 P
  19.                 Sleep(5000);
    , @$ k, _4 A$ E7 t% ]
  20.         }
    - k, Y1 X: d1 y6 H  d3 e$ @* M: I
  21.         else% P1 _* ^' o  O4 P
  22.         {
    / T2 h+ T- n# A7 d
  23.                 $ _: W+ J! k/ t& y' ~/ 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).aspx7 G% @3 q+ x" _
  25.                 STARTUPINFO si;
    , p( Y4 w7 _9 M, p. @# l+ F

  26. / \0 W1 K6 ^) p! u8 P
  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
    3 l; T! L4 d6 H9 G4 ~
  28.                 PROCESS_INFORMATION pi;
    ) N8 T) M% Y! W4 n1 I* ^  q8 y
  29. 6 \7 u9 K& z$ J; c5 O" h  Q
  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
    2 ?. g* f* C; z9 d2 E. M$ y. m
  31.                 DEBUG_EVENT dbge;
    , Q# C- H1 W( {6 f4 f  Z
  32. : C: v9 P& n8 f/ V% B
  33.                 //Commandline that will used at CreateProcess
    & v! M. _. P. @% l0 g
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    5 y* E+ X6 p2 x' k7 L; E

  35. . [, ^' A; I7 t) N, a" F
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)4 ?  x# Y7 |2 t; `3 w! h& v
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)) n( N1 T7 O' q3 m2 b- A
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    ( V. N. Z6 v7 q4 Z# L

  39. 0 g( r2 t( e5 \  w! A: }4 p
  40.   \, J6 I: D6 C: S6 D9 x( x! M
  41. 1 b( h& F! @: p5 o- c
  42.                 //Start DekaronServer.exe ; N1 W7 r, G( I# f( `" p- g7 ?
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    9 u+ }' \0 z( E2 P# `
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)1 j$ u) u) f1 ?! C' m% B' h( ]
  45.                         szCmdline,        // Command line2 r7 F& i4 Q, ^! b5 L2 ^1 N& @
  46.                         NULL,           // Process handle not inheritable
    . P' a- k. L! g, b) r1 I
  47.                         NULL,           // Thread handle not inheritable
    ) j9 v( o9 j& v% U
  48.                         FALSE,          // Set handle inheritance to FALSE* a9 `9 M0 j3 f+ O5 J  H& X
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    & F% k$ o% F' c% U; o9 v
  50.                         NULL,           // Use parent's environment block- t: Y, q$ ~% Q. W3 G1 _4 t
  51.                         NULL,           // Use parent's starting directory
    1 z+ b& B  L% k1 _0 R% [& _
  52.                         &si,            // Pointer to STARTUPINFO structure7 F" U: H7 f8 c! K( U
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    # b3 {1 @, K' X% C
  54.                 ) & O3 `0 _* ^* A/ G
  55.                 {( _+ r) d% d5 l7 f" e( r
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );: N  \3 z+ ~7 t3 L0 g0 m
  57.                         return 0;
    & t0 h6 q3 f4 O0 {4 }+ x4 e+ W; a# k
  58.                 }
    # @  U1 i' _/ {$ y
  59.                 //Creating Process was sucessful
    1 x, t8 Y% o* M8 F9 N) O' e: Q; U
  60.                 else
    ( L3 H- A1 \' ]* x
  61.                 {
    " e6 t& R* F) k. _" D
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    * c2 x. B  x3 o

  63. ) F; W1 B  S" X% S, K0 w  R
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure. @3 k' k- |& c
  65.                         dbge.dwProcessId = pi.dwProcessId;0 B6 f/ }: F5 @) C2 B( x& T- p7 N% v
  66.                         dbge.dwProcessId = pi.dwThreadId;
    0 j2 m! \5 _+ \9 b! ^
  67. : D2 e3 X+ v# F  X9 W
  68.                         while(true) //infinite loop ("Debugger")( u4 `0 _$ v: s: I. g
  69.                         {
    * `* O( t: d  y" d( n1 k
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx5 b1 P, }6 N1 K+ Y

  71. 8 O1 Z8 U- f( |6 K( D$ Y' y% H3 i2 U
  72.                                 /*; X' C/ G8 Z, ~2 I3 O1 W3 M
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

( b" \$ A! E4 r) R  ^9 C; _; T" g; N$ ^2 l5 Y" x, q2 o
2 ?1 g1 o! `/ j
商业服务端 登录器 网站 出售

8

主题

230

回帖

816

积分

高级会员

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

主题

189

回帖

298

积分

注册会员

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

8

主题

230

回帖

816

积分

高级会员

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

2

主题

81

回帖

614

积分

高级会员

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

本版积分规则

Archiver|手机版|小黑屋|EGameol

GMT+8, 2025-2-23 07:03 , Processed in 0.049228 second(s), 25 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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