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

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

[复制链接]

161

主题

389

回帖

7498

积分

管理员

积分
7498
金钱
2165
贡献
4783
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
  ]' d+ g  Q- ~% E' |" _
; J6 }5 E  `6 q, D2 w. ]6 f: o2 S$ |/ D虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
7 c  G( j# `* p  d' _5 T" l. b
5 B% U( T3 b8 n4 l+ D; L: C
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。: ], x# @  b) H/ U
  2. //7 r: f9 u1 _# ], `4 n0 G" S6 Z% b% Y

  3.   l' y) i1 L* s0 k$ z" w
  4. #include "stdafx.h"
    2 T8 h; |  j' B& X- t9 b
  5. #include <iostream>
    1 ]6 T) T+ G( g7 F( H  s7 |
  6. #include <Windows.h>
    0 J* ~' l+ z0 j* ~9 U
  7. #include <io.h>
    7 x& y% Z8 k' ^
  8. ( R2 N2 _- h4 U  N! S) P7 F

  9. ( u4 i* W" v7 R8 l
  10. int _tmain(int argc, _TCHAR* argv[])
    4 Z% [$ R* q& `3 ?/ o: d8 }# y
  11. {( ~. f8 Y; }5 w/ J# y# H0 x9 `4 B9 ^
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    1 B; u2 k# d  |  s, ~
  13. ! l& s! ~/ J7 u( J1 b0 _7 y
  14.         //查看文件“DekaronServer.exe”是否存在& d7 r& o5 x  |! E  L  o
  15.         if(_access("DekaronServer.exe", 0) == -1): c3 L* _5 W5 f, x- N$ X3 A6 Z7 P
  16.         {
    9 i% t  j) }+ q. b0 r
  17.                 printf("DekaronServer.exe not found!\n");
    9 x6 T, u& Y7 o7 ^4 L/ I
  18.                 printf("Program will close in 5seconds\n");( {! u) P# y, X( L9 q3 Y& O
  19.                 Sleep(5000);5 u2 [% Y  I1 \
  20.         }. f3 F  h8 Z5 I5 p
  21.         else
    9 O4 f) O; `% {
  22.         {
    8 Z4 }* h. V+ g% k; O
  23.                 6 M0 p; S: I6 N" L# j; v$ F
  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
    * ]% ~4 |9 g( T
  25.                 STARTUPINFO si;
    6 }( S6 w+ E1 V* t

  26. ! T! V. ]3 s' K4 @9 u* n" h3 Y
  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% R3 d0 v1 j; A  D$ T% ?9 o
  28.                 PROCESS_INFORMATION pi;
    ) H8 k  ]( C  v+ K

  29. 5 C, Y- q  M# I0 W8 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
    ) E3 \6 r( \4 Y* x7 E
  31.                 DEBUG_EVENT dbge;2 V, F7 U0 ~$ Z" _3 B- H
  32. % B& d. \* R- w) j
  33.                 //Commandline that will used at CreateProcess( b& B6 d- Q4 Q! C9 I5 J. ?
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));9 {- d" p3 p0 U! n; M9 a& B
  35. 5 [$ u7 u* k9 G/ f* J
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)/ h9 Q; X/ f* m. y( E
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)7 w2 q/ d0 m, r8 O
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)9 x/ s/ ?3 W" t! k+ i, P
  39. 7 m+ L' u& [' k. v8 G0 Z1 ]
  40. * w4 D6 w/ d$ r* Z/ c

  41. 3 H) B7 P& g' _( m6 j! O
  42.                 //Start DekaronServer.exe
    ) r! l7 b7 d* B, ]5 B1 N
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx% |/ r! W0 D! c- @- \9 T
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)* `2 V# F7 L$ m9 y/ r: z/ u* e& K
  45.                         szCmdline,        // Command line3 z% K" ~) z6 R4 U, {. {+ l
  46.                         NULL,           // Process handle not inheritable) Y  u/ J& U$ q$ [6 i7 ]% ~  _& u
  47.                         NULL,           // Thread handle not inheritable
    4 E- v+ w) E8 V0 E* W
  48.                         FALSE,          // Set handle inheritance to FALSE4 }5 h6 O- ?& R/ ~4 U; f8 Q& N' D
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx$ ~; j, i% J* B  }, a9 f
  50.                         NULL,           // Use parent's environment block
    - H% F# o* n$ l( ^  A9 B' D
  51.                         NULL,           // Use parent's starting directory
    6 p$ t0 z/ R; G0 a
  52.                         &si,            // Pointer to STARTUPINFO structure
    % b1 K3 @1 `* V4 t% r
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure  N7 s. @- {( h0 _6 s3 I
  54.                 )
    # L+ I6 j0 ^1 a
  55.                 {
    - I* I* m- Y! k: u+ u/ Z  g# c1 H
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    9 s9 h" a$ ^0 z$ ~$ M/ `8 U
  57.                         return 0;7 K+ c5 g5 j/ c3 h  ^) A. B
  58.                 }& S% q/ Z$ R5 J1 q
  59.                 //Creating Process was sucessful' C* N' P$ G- O/ o7 d: L* @
  60.                 else
    # @* T* u2 l- V8 E7 T  i
  61.                 {6 b, Y3 z. m8 F* s, `" @
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    & N% Y( T& i2 @0 ~" U+ `' j
  63. + w# n4 V& A; q9 R+ S) r% M
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    & I* b, x4 X# q6 w' q4 L& m
  65.                         dbge.dwProcessId = pi.dwProcessId;
    : d( y! M0 F( _9 P
  66.                         dbge.dwProcessId = pi.dwThreadId;: K* z# Q9 [. e: W

  67. : X: p$ l2 L- f5 o; ^* k+ r5 D
  68.                         while(true) //infinite loop ("Debugger")
    3 j# j; ~% g' e! b
  69.                         {! O0 w. ~$ b, h5 S# F% L/ R( O) E
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    # S( b2 s  X7 M: Y9 ^6 w8 Y

  71. 5 p0 a  k' p2 r7 k* c. U
  72.                                 /*
    1 b9 x$ D; G+ V! M4 K  e2 Q' F
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

: o% a  P- g' N) X( q6 a1 ]/ [8 G9 x# s! {$ {6 L  p
5 F" |- e9 m* ?) J5 F
商业服务端 登录器 网站 出售

15

主题

260

回帖

1313

积分

金牌会员

积分
1313
金钱
945
贡献
88
注册时间
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

回帖

1313

积分

金牌会员

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

3

主题

102

回帖

8197

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-5-15 16:48 , Processed in 0.047623 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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