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

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

[复制链接]

155

主题

350

回帖

6207

积分

管理员

积分
6207
金钱
1872
贡献
3830
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
2 L9 V9 z: s3 G. i5 b
* C0 Q: n$ r2 z1 l7 k虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。! F! u: s: `4 G' i  N7 a0 f

7 v8 E5 ?& _* C+ @2 Z8 z8 z$ w0 ~
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    0 o! H" Z; F4 `
  2. //
    ! W5 u% r1 ^5 `( ^9 e6 t

  3. $ Z1 W  b$ B2 s1 n
  4. #include "stdafx.h"
    ( V3 l5 q! W0 K0 m  T1 R, D& ^
  5. #include <iostream>
    1 B  y2 Z, ^5 {' _
  6. #include <Windows.h>2 C" u) a' b( o1 N+ h/ F& J
  7. #include <io.h>
    6 c. Z9 Q. v  x0 M1 S& R
  8. ) U) o8 H9 E7 Q6 y) F4 l# X$ [' H

  9. 4 ?. Z  k% O+ t! Z
  10. int _tmain(int argc, _TCHAR* argv[])
    3 G' K$ a4 g4 t* W0 T0 |
  11. {6 T; R' p; b, c- a; l: N2 j
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    / Y- y/ g% u5 [6 e7 `
  13. . ~1 ]! Z$ t0 K+ L! Z
  14.         //查看文件“DekaronServer.exe”是否存在6 s7 S7 _) o, q2 M* m
  15.         if(_access("DekaronServer.exe", 0) == -1)
    9 A, t9 g: g0 Z) Q! J
  16.         {) V7 m; n" ?& Y4 ]. y: V6 h
  17.                 printf("DekaronServer.exe not found!\n");
    3 H3 a; u8 V% o& }
  18.                 printf("Program will close in 5seconds\n");- `* n% F8 a1 {( q
  19.                 Sleep(5000);
      X( f, a0 U4 O" ]3 A8 B3 Z
  20.         }
    & q0 H- ^3 a9 w% Z0 I: r. o
  21.         else
    : o8 Q" h# P( C* H
  22.         {
    ) z* S3 @: F* B3 K$ ^2 R/ K
  23.                
    ( W5 @7 z: a2 E+ [& h! f2 U
  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, e2 o, T  A8 M" [( b
  25.                 STARTUPINFO si;& B0 C% K0 M1 o1 Q  K! F2 O

  26. ! v* w8 g8 {5 W1 B( r$ ~! E2 ^7 {
  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
    5 e4 L$ J# D- s5 Z
  28.                 PROCESS_INFORMATION pi;
    : n/ [: [( d2 D6 k7 v  C/ J" z* y
  29.   b0 |% {% Y, i0 Q* q" g
  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
    " T6 w7 |* e3 b1 Q' I5 u
  31.                 DEBUG_EVENT dbge;; o2 L( A2 O4 r
  32.   k! T' h- O4 P: k& E2 A& R( x
  33.                 //Commandline that will used at CreateProcess8 r/ g9 B/ c3 N; z% d# F/ ]2 X
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    $ G$ F3 w, |5 y# m: [9 @
  35. % B/ B: [, o# I; Y& x8 U0 J
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    ! ?+ R: g/ X4 f# N7 V' d
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    ; K  O. z# c% w/ k  d5 J
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)9 G7 J1 I6 d, C8 K5 `

  39. " P+ @' `, g* U) e7 L( O

  40. ; _" K# H( b: v% d& G
  41. 7 }8 B, E, A/ w* _. A
  42.                 //Start DekaronServer.exe
    / Y2 f( \7 w8 F& Z$ i3 q
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx. F8 Z5 f- g: q4 o5 ~  s) {, ^/ Y. y
  44.                 if( !CreateProcess( NULL,   // No module name (use command line), ^. p8 C+ _9 ^* j- v8 {+ Y+ B
  45.                         szCmdline,        // Command line# h2 x- t- D% x" U+ C! \1 g# C4 H1 [
  46.                         NULL,           // Process handle not inheritable5 `7 V4 l. F" D0 N
  47.                         NULL,           // Thread handle not inheritable+ l& G: _& q; c' d, I+ b1 V* c
  48.                         FALSE,          // Set handle inheritance to FALSE
    * S( i' N. Z* d' `
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    0 z) q3 u2 @. ~" F5 F# H
  50.                         NULL,           // Use parent's environment block4 ^4 W! D6 J# e, i
  51.                         NULL,           // Use parent's starting directory 6 @+ y  Q6 b  K0 B# V. e
  52.                         &si,            // Pointer to STARTUPINFO structure/ ]; `. y/ t% W+ O
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure3 M1 [+ e% A2 v0 O
  54.                 )
    / S, C2 {- N( K# q& t7 e+ n
  55.                 {. Y6 R7 P! L# n2 R
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    : t( S* `7 P2 e6 d5 u
  57.                         return 0;4 q* I- Q0 z* a# R9 ~4 L; _
  58.                 }
    5 N" x  R" l. N$ l; X9 n, y( F
  59.                 //Creating Process was sucessful
    ! {( ?/ \6 X2 E4 s* q
  60.                 else4 I* U8 e1 ~7 k8 S0 t4 Q& `3 W7 t: w
  61.                 {
    9 }( k6 a/ w2 t% F0 b9 E1 V1 ]
  62.                         printf("Sucessfully launched DekaronServer.exe\n");$ I8 K3 |5 W: Y! w0 O- `" m& Z

  63. 6 p2 n+ @/ z; a. F& g9 d
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure$ M# m* k3 @1 v
  65.                         dbge.dwProcessId = pi.dwProcessId;
    1 @& C* @# t0 U3 h1 @
  66.                         dbge.dwProcessId = pi.dwThreadId;
    1 t% x% P7 Q% w) H

  67. - P: q' g" Q. r
  68.                         while(true) //infinite loop ("Debugger")
    0 t3 w  H$ ^6 K* w1 ]" U
  69.                         {
    # s+ i1 [3 ]" R/ N0 O; z
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    9 W* [% e5 H) q
  71. 8 r  |- |% P. n' ]( |- G
  72.                                 /*
    5 e) V" I- N6 U$ P6 ^5 p+ ]
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
( T; p3 i) _$ n& c
# X, E" f' i5 T( S) O

1 W; e4 G/ z+ [: w
商业服务端 登录器 网站 出售

13

主题

251

回帖

1250

积分

金牌会员

积分
1250
金钱
826
贡献
155
注册时间
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

回帖

1250

积分

金牌会员

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

3

主题

102

回帖

5823

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-7 21:12 , Processed in 0.069269 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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