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

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

[复制链接]

157

主题

363

回帖

6922

积分

管理员

积分
6922
金钱
1961
贡献
4441
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 1 }# [- z( y( A1 x, |9 C
8 c! o( I" a" W  `; R
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。) g; J: ~5 P/ T  ?1 X

' |+ M# w& L/ {; M7 G" p
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    4 V6 A9 k( j3 p( [
  2. //9 e# z) T+ @  ?& `- Q7 \* B

  3. * i7 `* c' q& Q' w2 V
  4. #include "stdafx.h"
    3 ~/ [  Y9 h7 E( \
  5. #include <iostream>* M+ E/ H5 r0 e0 \. c
  6. #include <Windows.h>
    8 e, ]4 A0 \! g( s$ f+ g
  7. #include <io.h>
    " y' T7 V5 w. O$ M
  8. & g/ F4 T9 t% A. Y( `2 b
  9. " f5 {% O2 a  g1 ]) I( Q4 d
  10. int _tmain(int argc, _TCHAR* argv[])/ W# B4 X7 \$ Y9 h+ w
  11. {% @3 {: Q2 H0 ^# T% o1 L
  12.         printf("Dekaron-Server Launcher by Toasty\n");6 X3 l( {1 u. k( m4 o* ~

  13. 3 ^7 k% H/ `9 T# X: R
  14.         //查看文件“DekaronServer.exe”是否存在" r# `) |) m7 i5 D2 B2 f; W7 e9 }2 V
  15.         if(_access("DekaronServer.exe", 0) == -1)6 l' d/ c5 ?9 |& l
  16.         {
    ( c# V3 {5 X3 @; f
  17.                 printf("DekaronServer.exe not found!\n");+ H: }6 G! n) U. A
  18.                 printf("Program will close in 5seconds\n");0 v. s+ Q. y6 C" {! @
  19.                 Sleep(5000);
    ' N  D! Z* E0 B; ~7 M& }+ A( z
  20.         }
    : P; ?! V7 P' U
  21.         else7 ?+ G* y( B9 Q* f. u1 I/ _
  22.         {
    / P7 Z9 ]0 [1 F  P1 Z
  23.                
    6 J  d. X5 u. n& p+ h
  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: ]3 J8 ]# ^- G  ], [- `& }! @
  25.                 STARTUPINFO si;5 K3 n- Q' u$ b. h, t/ f) w$ X

  26. 1 B4 ^& v+ D8 t* S
  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) q7 |) I# ]$ z
  28.                 PROCESS_INFORMATION pi;' b% U3 P# }6 f4 t9 m
  29. 5 h# x( V: V2 j: C$ 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. B+ U% p+ n8 N0 q4 U
  31.                 DEBUG_EVENT dbge;
    - J2 C/ f) d, A) k6 E5 H

  32. 3 Y/ J0 g# R" ^& Q
  33.                 //Commandline that will used at CreateProcess$ X- W5 M* x* ~/ ~$ a
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));3 O& v" I0 q. V3 U7 m
  35. , A% J9 O- J4 w# P& a9 a
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made): Y+ @% h  e( a$ N5 z) s
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    2 B2 E) X! E# E" m! y  t$ N( w* L
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)% E2 {3 L0 W( r! v" P/ u

  39. $ F! t6 ]: I; c' V
  40. , y: u% u2 s+ ^: P
  41. - h0 b8 z1 x; K, e3 d
  42.                 //Start DekaronServer.exe 1 _0 d' y0 u) u# w# G
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx* J' r4 g& j5 D& e/ b
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)( `4 S, Z& X. G' ~/ d( F; T
  45.                         szCmdline,        // Command line6 \& [! U  D& r" S$ W
  46.                         NULL,           // Process handle not inheritable
    0 F& W! y/ e2 [, O! P) A) R0 c6 T5 |
  47.                         NULL,           // Thread handle not inheritable4 F  N* s- E( H6 v; x/ P$ r; P; X  @
  48.                         FALSE,          // Set handle inheritance to FALSE
    4 P) j& z, f" \( _/ L
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    2 Q) s6 P/ u$ ]
  50.                         NULL,           // Use parent's environment block* Z6 t1 L/ ~" H  d4 M
  51.                         NULL,           // Use parent's starting directory
    * T3 [7 R/ D4 `6 r- S
  52.                         &si,            // Pointer to STARTUPINFO structure, e$ s' U. I( X) w( ^3 B  y  ~% R
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    ; |( J$ |3 b* S, ~3 L& Y3 d/ Z' {7 e
  54.                 )
      E8 G6 S; F) A- K
  55.                 {) i, _8 e3 Q; L  z
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    6 x- S: D" C1 b- t: A. k
  57.                         return 0;& x! O, L5 e( q6 w. B' H4 W
  58.                 }' X& T7 q$ k7 f3 m% f7 M
  59.                 //Creating Process was sucessful. H- O1 h) F' y* y+ b( v% }  O
  60.                 else
    ' r0 E. l, p" E! I$ y
  61.                 {
    % _* j- {6 O" d* m4 `9 ^
  62.                         printf("Sucessfully launched DekaronServer.exe\n");. [# X: H0 L2 @1 y3 ^6 l

  63. * T  c. M2 @6 h( S/ m9 O/ N9 R4 d7 b
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure& L1 F& u+ p: v5 k" I0 v8 _7 _
  65.                         dbge.dwProcessId = pi.dwProcessId;
    * \7 b2 w; K7 ^
  66.                         dbge.dwProcessId = pi.dwThreadId;
    * _2 c& _8 d! Q; T9 t
  67. 4 {) e0 w/ ?/ _# Q
  68.                         while(true) //infinite loop ("Debugger")
    % L0 F$ Z; W: P  D) i$ C* D
  69.                         {+ ?. E; T2 |" n/ ]& r
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    4 |1 d' k7 g1 K/ G- V* e
  71. % I* @: r& \) Q/ Y- Q
  72.                                 /*) p" A  X/ y, }& N& a
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
; j6 W' g. G( C# \+ z
, S) _, M" o; e6 l/ G" n

8 `* ~0 m7 z7 ?
商业服务端 登录器 网站 出售

15

主题

257

回帖

1226

积分

金牌会员

积分
1226
金钱
886
贡献
63
注册时间
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

回帖

352

积分

中级会员

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

15

主题

257

回帖

1226

积分

金牌会员

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

3

主题

102

回帖

6679

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-26 05:36 , Processed in 0.060238 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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