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

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

[复制链接]

156

主题

352

回帖

6266

积分

管理员

积分
6266
金钱
1886
贡献
3872
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) , e0 @% z2 R& ]9 E3 B# ~" ]
5 n5 l# `/ @1 A& B+ A  l) R
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
4 R+ j/ k2 Y$ @3 @" `& w, y  D3 @! p3 T
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。: n( t2 e/ r# M/ l# k: G
  2. //$ ~+ a% F: \: X% F

  3. % ^" r. y- R9 u* i4 g. f% j! e
  4. #include "stdafx.h"
    " _4 @. U( n  _. B2 `# ~
  5. #include <iostream>
    - K/ q& V5 V# J2 ~% O# k9 m
  6. #include <Windows.h>
    ; P; ^! p# y8 Y& Y# T* c( j+ D
  7. #include <io.h># Z4 u/ E6 c& [( ~  s, o  k
  8. ; d# f0 K8 ?( A8 Y( m) j
  9. * O. C' G# n; a7 y0 m
  10. int _tmain(int argc, _TCHAR* argv[])
    8 Q) g2 u4 H# ?. c* ^6 B
  11. {8 {; }- S6 K0 `; N
  12.         printf("Dekaron-Server Launcher by Toasty\n");/ D# m% ^! |- d$ g3 o) A( Q
  13. 8 K' p7 X/ B" y8 R
  14.         //查看文件“DekaronServer.exe”是否存在
    ; B) U0 D; v- ?" d0 G
  15.         if(_access("DekaronServer.exe", 0) == -1)
    0 C' U' ~+ c; K2 O
  16.         {
    : L( I$ R7 {/ ]% a/ }
  17.                 printf("DekaronServer.exe not found!\n");# c7 H8 G4 x+ T, M* n& D! F. s  s6 c
  18.                 printf("Program will close in 5seconds\n");1 g, j5 _2 k" X7 S! u5 o. H
  19.                 Sleep(5000);4 K" B- J8 n' s
  20.         }
    - V. W. X0 y2 U
  21.         else
      ^0 v! x' ?6 o9 L& S$ S+ M4 @! B
  22.         {
    ( J% X6 w3 i0 Q- u
  23.                
    ! x8 V/ t0 \9 ?5 S6 q. 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( X7 b) i- X! T* F+ L% H! r( S) c
  25.                 STARTUPINFO si;# c6 O6 b/ g2 U) z0 W! R8 Z( C

  26.   T% ^+ M% U8 m: m$ Z6 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  n/ L+ W$ A! `+ R/ [( O- b
  28.                 PROCESS_INFORMATION pi;
    " p- g/ x& E& ]# Z
  29. 2 j, Y& _$ V- Y6 H3 T/ B
  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).aspx7 R& o! z$ k& x6 z/ N' [
  31.                 DEBUG_EVENT dbge;8 R, y+ h% z! L

  32. 6 C- i- U9 N. X: ]/ |( u5 Z/ C3 C# p
  33.                 //Commandline that will used at CreateProcess
    / q: \/ \* N% t9 \
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    : T! {8 H$ b3 W( ?4 `: _2 S
  35. 4 ^) P' G2 T$ q/ |% f; m2 W. @* n
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made); C! k$ o, V! ]; z
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    . s  H8 B: o2 D( \+ h( r8 T
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    , c& R$ ]! U5 U2 p* P
  39. 6 b* ~1 T: r" _* S. {

  40. * J! [# T6 W; F6 t+ i

  41. ' f# Z& r  D8 o7 e6 T  h
  42.                 //Start DekaronServer.exe
    # O9 S- I- @1 z/ M0 w
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    2 R1 J4 _- k0 C# m% n4 L
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)" E( g1 U) _+ }; p( s, v$ U
  45.                         szCmdline,        // Command line
    2 x2 z! Q' X) ]
  46.                         NULL,           // Process handle not inheritable9 Y  h: c: @' A5 }5 c6 e
  47.                         NULL,           // Thread handle not inheritable
    9 F% q2 z. |' K
  48.                         FALSE,          // Set handle inheritance to FALSE
      u! o+ m1 o& v5 M' x! j
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx# u7 M0 z1 z$ X, u
  50.                         NULL,           // Use parent's environment block
    3 d! M1 g2 u4 G, s
  51.                         NULL,           // Use parent's starting directory
    " C# C: H, k' f) Q1 N' h
  52.                         &si,            // Pointer to STARTUPINFO structure; v# n& _, A+ [, x: s+ T3 ^, Q' J
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    ; k2 G. @+ L+ v- f2 w! s1 @
  54.                 ) + I2 N2 X- Y$ N) e: S7 @3 |1 O
  55.                 {
    , x. }. r& ?! }1 a- }+ u
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );. w; b9 b- p6 P, P  j* T
  57.                         return 0;( n  e. v2 M" V0 @. \
  58.                 }
    / T, A$ J  P2 @* s8 p, y
  59.                 //Creating Process was sucessful% B* q* @; V0 k. R0 S9 S( F& b
  60.                 else
    0 ^- f% R; d( C% k
  61.                 {
    . Z$ k! P% Y* ?
  62.                         printf("Sucessfully launched DekaronServer.exe\n");  h9 J, k+ \. T) D
  63. 2 k& t: W. a: I% y; _
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    : @4 `9 M! B. A9 k1 _. j% i, [! A
  65.                         dbge.dwProcessId = pi.dwProcessId;+ c. b* y& K9 t" {" S
  66.                         dbge.dwProcessId = pi.dwThreadId;- a4 f8 v4 }" ~/ L

  67. ( E  u6 H+ i5 B+ ]
  68.                         while(true) //infinite loop ("Debugger")$ \9 ]% q  [) T4 M6 c
  69.                         {" U$ o# c9 T, N1 G  r# b, ~
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx8 U6 J5 ]& j9 h* `% c

  71. 7 @% V- c0 n' p) ]
  72.                                 /*
    , _5 |( ^( [& l5 |) ?, ^* z
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
. i8 z/ E0 K& U( L* }, F* {

. E) g# c+ p' l7 z; Q& A& s5 Z6 }+ p' A8 i2 }; p7 }
商业服务端 登录器 网站 出售

13

主题

253

回帖

1258

积分

金牌会员

积分
1258
金钱
834
贡献
153
注册时间
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

主题

253

回帖

1258

积分

金牌会员

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

3

主题

102

回帖

5983

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-15 17:03 , Processed in 0.086762 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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