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

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

[复制链接]

159

主题

378

回帖

7300

积分

管理员

积分
7300
金钱
2098
贡献
4665
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
* l8 B' }& ~& n: T9 N1 l/ W/ o" h# N% s' [8 Y( Y% {
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
( |" `+ c, }; Y! L6 N1 @8 ~" I4 W2 `- T  v# D
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。/ K& A3 d  i% [# ]
  2. //
    1 t7 V$ O% a) {' T+ U

  3. ! _. u/ f9 o, n0 U* [4 m0 n1 R
  4. #include "stdafx.h"  M8 y6 W4 r; L8 @' L! [6 T9 E% U1 I
  5. #include <iostream>
    6 H; x  \/ {" b% r& X1 Q6 O
  6. #include <Windows.h>
    $ g1 T- g# d7 U9 m  u: G
  7. #include <io.h>
    - i/ M4 T6 h, J+ U, B

  8. ) r! N1 d9 k' b8 |% {8 A

  9. 4 G: s4 C0 @4 |: ?2 o) o
  10. int _tmain(int argc, _TCHAR* argv[])
    - w3 r2 |1 Z+ ]. _; V6 W
  11. {
    " W: w) G( q5 v
  12.         printf("Dekaron-Server Launcher by Toasty\n");4 f; G7 q' q# Z
  13. * e# b1 r& O2 S
  14.         //查看文件“DekaronServer.exe”是否存在
    2 u6 k6 R4 _& z  v, X
  15.         if(_access("DekaronServer.exe", 0) == -1)
    4 Y, N( g+ {% X0 r4 D! N  n
  16.         {' X9 R7 B" j/ j# T
  17.                 printf("DekaronServer.exe not found!\n");
    + L& ^4 w8 `/ v& j7 s
  18.                 printf("Program will close in 5seconds\n");
    / A8 M6 }9 s! X0 [* Y* I
  19.                 Sleep(5000);
    1 `0 A! @$ Z( P! {( @5 n2 Q9 O1 a4 g
  20.         }
    ' N5 ]5 m% E  l( `$ w$ a
  21.         else
    ' N% I. q% N& o* M6 S# \  l
  22.         {* _/ i$ a+ p  I- k, A( w
  23.                 $ c+ |$ N$ M8 O8 ]5 Z
  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
    . Z- J) L0 |% G9 ]0 C5 K: ^+ r5 X
  25.                 STARTUPINFO si;
    0 i& s0 V* S( J) r! }

  26. : M& K( Q7 V8 |" S/ q
  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
    3 y/ R9 A0 u6 }* G/ u& q3 ?9 d
  28.                 PROCESS_INFORMATION pi;# g, G- }4 W4 x- g* B$ w

  29. 6 A9 |3 g# U9 N1 x  M3 ^* u$ `
  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).aspx6 Z, Z& r& G: z6 S! {' I
  31.                 DEBUG_EVENT dbge;
    # G. B( }3 h0 _0 ~, j; Q& g
  32. $ s5 g1 t2 e( S+ f( v
  33.                 //Commandline that will used at CreateProcess6 k7 y. m* ]" L5 @9 g9 z* X$ c  s
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));* K* Z* w( z+ _" C8 C( ~
  35. 9 Q& f* E' f1 U
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    ! ~5 I; I' l# D# |3 i7 d& e
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)7 A2 D; m$ C# x8 y+ L& b! L5 R7 v
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    / y6 Z  O0 i0 r: d

  39. , t" u: l. U, X; ]! |( b4 b
  40. . E4 ~* Q: ?; @+ }9 ?
  41. 4 }' z9 I6 d) S# i. u, \% S/ r
  42.                 //Start DekaronServer.exe 9 ?# @/ j$ X5 l; r; n0 x
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    % X$ {& x3 E7 E; R, M1 z
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    : d& c7 ]& m8 f$ `7 l5 Q
  45.                         szCmdline,        // Command line# x7 |& M: u# ^' o" c0 p4 G+ B/ h
  46.                         NULL,           // Process handle not inheritable
    . A* \$ ~% w1 O, _3 |# n& u6 D
  47.                         NULL,           // Thread handle not inheritable% ?0 q" n9 l6 d6 y
  48.                         FALSE,          // Set handle inheritance to FALSE
    * V; y  _4 {2 `
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    2 K/ H- @" B; H0 K  p
  50.                         NULL,           // Use parent's environment block
    ( J: J: @- w# G! {* X
  51.                         NULL,           // Use parent's starting directory
    ( y; j. Y  f1 U7 b
  52.                         &si,            // Pointer to STARTUPINFO structure2 i% `4 w" b0 N1 a5 e. u; U: O9 z8 I
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure1 r( J) h3 b8 s' [& _9 ^; C/ ]
  54.                 ) 8 u" K+ t$ j: c& X
  55.                 {+ ~4 D- S, U9 L  R" d
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );! d% X+ n3 i2 F2 T$ {- y1 H
  57.                         return 0;* c1 g& N' U: ~+ S9 h- M! m
  58.                 }5 Y2 [3 q. I7 |, U# L
  59.                 //Creating Process was sucessful
    3 Z: W) K' o4 X! j4 L# U' _+ L
  60.                 else+ T4 u3 r( p1 u1 \& a8 w/ q
  61.                 {$ n! v! p8 x6 p" u# p
  62.                         printf("Sucessfully launched DekaronServer.exe\n");8 V4 {7 u# W% F5 v

  63. / d% |2 e4 b$ X" k
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    4 }2 G  a- j; g
  65.                         dbge.dwProcessId = pi.dwProcessId;0 Q& O+ W  X5 h  D7 |
  66.                         dbge.dwProcessId = pi.dwThreadId;
    / h3 s, Q6 g$ @) w( r7 P8 B
  67. ) z$ a' q; r: l$ y. `
  68.                         while(true) //infinite loop ("Debugger")
    ! q6 m; q4 l6 U1 I* ]% o
  69.                         {
    # K, u; v* }! Z! c( ]* ^7 `
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    2 i: ^! h. J- r% S( `
  71. % Y9 Q5 m, X9 y- ~: T2 K3 g+ u+ A
  72.                                 /*
    9 g# }! k+ T0 e: i* I7 X  h
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

" i4 P8 Y$ ^& Y+ K8 \& s8 a$ c' N& z6 b9 }8 \' B, |- f. F( H/ ^

2 t$ B8 h4 X& J# u8 T
商业服务端 登录器 网站 出售

15

主题

258

回帖

1267

积分

金牌会员

积分
1267
金钱
915
贡献
74
注册时间
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

主题

258

回帖

1267

积分

金牌会员

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

3

主题

102

回帖

7597

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-16 07:27 , Processed in 0.038371 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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