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

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

[复制链接]

155

主题

352

回帖

6236

积分

管理员

积分
6236
金钱
1880
贡献
3849
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
" k6 ]* x# R9 h1 K8 q- [6 W# u( _; A4 }5 q( n4 x/ Y  \
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。' b, w; I2 b& i# V! m

+ U4 W4 j% {7 k9 x0 w. A
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。7 @/ Y0 c' ^2 _% X5 |( i* A
  2. //0 ~8 e2 x2 a5 ~0 r% k8 a

  3. ! v  p9 v+ k* H8 U3 C! {
  4. #include "stdafx.h"
    7 A1 D  U9 }* P# Q: h" k# N& ]
  5. #include <iostream>7 _" B: a- H  ~" r1 }6 r6 \
  6. #include <Windows.h>" ~( ^, X6 W6 K& l) }# ]. ]; x
  7. #include <io.h>
    4 ~) q) J# I+ h. h2 w6 j

  8. & y) n/ k) ~0 w2 u. {

  9. + N% ]. g# K/ d8 b7 z
  10. int _tmain(int argc, _TCHAR* argv[])" C& F& h  q# H- K
  11. {
    $ f% {/ X" w  q- K+ K2 U+ u+ {
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    5 n; y( H3 |2 o  i" q
  13.   Y# E( N6 E3 R, v- V# |
  14.         //查看文件“DekaronServer.exe”是否存在
    $ f' l% u5 J1 i6 ~
  15.         if(_access("DekaronServer.exe", 0) == -1)
    + o7 G3 P/ F0 a- D6 [: t
  16.         {
    7 i$ m: W- W% _4 t: K; M
  17.                 printf("DekaronServer.exe not found!\n");8 b# C9 t; M; }" d: U$ \" o" I, }
  18.                 printf("Program will close in 5seconds\n");0 K2 x& v/ o" s* r
  19.                 Sleep(5000);* N0 M% V& L# Y1 D; ^1 I+ ?
  20.         }
    : u. u2 v4 j+ _0 R* X! L8 ?) k& N
  21.         else! Z! u( F1 h+ {! U& `' n
  22.         {
    ! m$ |& g2 X9 a# e" A% E
  23.                
    ! g* l, y0 q, A. U% O
  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
    % Y. _3 I/ c8 Y2 P! g
  25.                 STARTUPINFO si;: t8 F, e+ L& e+ w3 D" `$ e* _) ?

  26. % B9 I1 \! k. r4 T3 D1 n$ e
  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).aspx4 `+ f7 u3 n4 i7 r
  28.                 PROCESS_INFORMATION pi;
    5 x7 [6 v: s+ G) G  V; O( c- t+ g" V
  29. 4 i' b/ X: v$ y6 Y( T
  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).aspx8 p, a- a/ }0 A: e# y7 d
  31.                 DEBUG_EVENT dbge;. G% w+ c5 @4 H! M( {6 l3 d- Q

  32.   G% v" E7 U8 x6 p
  33.                 //Commandline that will used at CreateProcess% ^. F3 o: X4 b& H3 k* s9 J# f
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));5 ^! g6 u  z0 ?
  35. 5 E8 ?, |& U4 z  s
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    0 `) }5 n# e1 N5 f. O' @7 J
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)  D2 q- r+ y5 V
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)' v6 n7 M( s$ a+ X/ o& }2 f) z
  39. ' M& w( f, P! [& i9 C/ l# ?* w
  40. % w5 r; {, b3 ]. H; l
  41. 3 m# I8 i0 w0 v4 c
  42.                 //Start DekaronServer.exe
    ( n# k# v2 j+ b2 o! e
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    * G3 f1 V' A4 u0 ~; o9 h8 x* l
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)' F* ?6 Q% _. x' f, Q
  45.                         szCmdline,        // Command line
    0 x$ Z2 ^: G: }9 o7 N" A$ L5 F& U
  46.                         NULL,           // Process handle not inheritable2 C% t! A  ~4 b
  47.                         NULL,           // Thread handle not inheritable
    8 F' N! R! d5 s* J  c6 T
  48.                         FALSE,          // Set handle inheritance to FALSE
    ) R  Y8 D; ]; S) [, I
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    ! H: A1 Q$ l. D, S$ L+ ]+ _
  50.                         NULL,           // Use parent's environment block
    2 F0 j0 c! ^9 R! b, V, d
  51.                         NULL,           // Use parent's starting directory
    ' J: v- }1 R1 \  t/ P
  52.                         &si,            // Pointer to STARTUPINFO structure  e3 c! N* E) \. {+ M
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure5 l, W8 `1 W( i' H* A) u! H1 R
  54.                 )
    3 S1 b+ R' u& i. U  t$ c. N2 p
  55.                 {
    6 U6 i' G" D7 _) d
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );2 o& m$ f% A2 ?, A
  57.                         return 0;: ^6 w) y4 h$ ~1 h' l
  58.                 }2 D# H. E7 {+ m" i
  59.                 //Creating Process was sucessful
    ( F6 F: x* E. j% o* F! n  ~2 K
  60.                 else) ~' Q- J1 |  r! O( }
  61.                 {; \& {) i: Y' W4 w& v% h& P
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    * |" p3 |$ L! D5 D

  63. ( D6 T4 k1 d; G: @2 d/ H
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    6 Y. B) g4 R5 ]' `+ G
  65.                         dbge.dwProcessId = pi.dwProcessId;
    9 M( F! A7 g/ `" I) v7 p
  66.                         dbge.dwProcessId = pi.dwThreadId;- g2 j, O5 F$ \0 C: y% S1 E
  67. : ?8 o, S: `6 F4 O
  68.                         while(true) //infinite loop ("Debugger")! h9 O' ?6 Q2 j  j6 d( J! s9 J
  69.                         {/ R. J' k" Z' q% ?- i5 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
    5 Z1 |. s; e  |8 q8 w% D% c
  71.   m, q, ~  r' u$ s( T: i
  72.                                 /*
    9 e  w; `& N' a
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

* p" ~9 V; ^3 }. T: G
$ I9 Y) ~- o+ \; d* N
  l# ~! ]* O/ M) q8 G5 F
商业服务端 登录器 网站 出售

13

主题

251

回帖

1253

积分

金牌会员

积分
1253
金钱
828
贡献
156
注册时间
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

回帖

1253

积分

金牌会员

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

3

主题

102

回帖

5923

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-13 12:26 , Processed in 0.090855 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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