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

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

[复制链接]

157

主题

363

回帖

6895

积分

管理员

积分
6895
金钱
1959
贡献
4416
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) : E$ L: W' N2 z
3 ~$ l: w8 k  {! P' W. u0 {; g
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。9 o+ s' J  i! b% v

3 f! ~& B) C9 B8 {; ^! I0 P
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。) n& w& e. }4 z8 M) B& \8 |
  2. //
    / w7 I* m) H% O8 D7 T5 L8 N2 k
  3. ( V. j2 W' ~9 e
  4. #include "stdafx.h"9 Y5 p5 d# P8 ?0 }5 `
  5. #include <iostream>( B6 n' k' Z+ k$ ~/ A% E
  6. #include <Windows.h>
    ) Q' R, u8 w( J8 s
  7. #include <io.h>
    & I5 j+ [7 {6 x( X5 t2 N
  8. 3 ~9 v* h  d  u2 W$ j" x: y
  9. . l# d. s( e1 s2 S  X
  10. int _tmain(int argc, _TCHAR* argv[])) z' K. R, ^6 Z7 \. K
  11. {$ B% M; R4 q3 Z# u
  12.         printf("Dekaron-Server Launcher by Toasty\n");2 B& I0 A. k' |" l

  13. # s) H% `5 o4 a) n5 g7 {' d0 J  w
  14.         //查看文件“DekaronServer.exe”是否存在- V: a2 A' Z6 Y6 O8 I6 M
  15.         if(_access("DekaronServer.exe", 0) == -1)2 S6 Q# b* F! r5 ^9 S3 I2 e! \: g- Q
  16.         {, E' U% V) z) ~: R" c
  17.                 printf("DekaronServer.exe not found!\n");
    ; K* w9 h9 W$ V9 P4 v% N$ u' I
  18.                 printf("Program will close in 5seconds\n");
    : J- O0 D% f' X) x9 v5 H3 u: h
  19.                 Sleep(5000);& H8 |/ [# q, D3 r2 {3 {  e, a( P" `
  20.         }1 |# m& T. h- m5 f  W
  21.         else
    1 [3 h; q: L4 v0 B/ N
  22.         {" \& r; t& A. P- ]/ Q6 h
  23.                 2 F; T: f" {9 r" E, Q' }
  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/ A( Q0 l# D6 ^9 ~: }
  25.                 STARTUPINFO si;
    " M% n; d( ?; O& Z+ D
  26.   |4 y. k$ M* n
  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
    8 e6 @  E# J( t; f7 g( N
  28.                 PROCESS_INFORMATION pi;
    8 X8 ~+ H' z( G, `6 m& z

  29. " R, w% x# u: Z% ~0 a
  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
    ) U; P$ Y' f8 U
  31.                 DEBUG_EVENT dbge;' L* n" F+ a# N" X* Z
  32. 3 B5 U8 O6 I! h8 A- ~
  33.                 //Commandline that will used at CreateProcess
    0 ]# F# i, |6 I7 D$ I& m0 M3 t
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    4 j* `* U$ l+ |, R2 p# e* w% C
  35. / G% |8 `) A- a: o* ?3 V) U3 j
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)6 r' ]6 |7 M0 i  E
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    4 \* t# Z; Z( y! C
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)' z% N; I8 U. u' ]6 G
  39. 6 ]  W  q) P3 z; g7 h( n9 L5 z( ~1 {
  40. ! |' K, M$ U2 J. ?) z0 `# X) l
  41. ; Z% i9 E7 m4 [" {6 q9 i0 [
  42.                 //Start DekaronServer.exe
    + P$ E" l# N8 e+ T& a
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    & L/ Q6 \7 T( P1 t
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    % H4 |) R6 n! ]7 d. K- t
  45.                         szCmdline,        // Command line
    8 y" N. n- s( P% N
  46.                         NULL,           // Process handle not inheritable' z& c: w* e2 o& K: x: ?+ z
  47.                         NULL,           // Thread handle not inheritable3 @8 L# F9 p; k! o) `, z1 Q; e
  48.                         FALSE,          // Set handle inheritance to FALSE
    & k7 k$ X: u+ F  @
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx4 F; [3 [. {- O) e' [/ x% X* n
  50.                         NULL,           // Use parent's environment block1 j3 \) G. W% S1 R/ Y' s
  51.                         NULL,           // Use parent's starting directory 0 m) \0 {0 i( U
  52.                         &si,            // Pointer to STARTUPINFO structure4 ]# n) j- @! r6 d2 A9 y& S
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    ( M) `5 O5 t8 k2 c( i2 K, V
  54.                 ) % ~: U3 O! Z4 S9 C
  55.                 {
    1 f0 k4 h2 T+ i# S3 O6 p
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    ; b! s) c. |$ F+ ^
  57.                         return 0;
    3 G2 t: m  i+ R: \' _$ F" z: q
  58.                 }" z% O" m3 ^/ A6 z  v' ?
  59.                 //Creating Process was sucessful
    3 g6 b( _. @) }2 g; i4 p/ F7 M2 q0 V
  60.                 else
    1 s6 e% d9 {* G) R: t
  61.                 {
    ) f# h; f+ b4 ^& e* R" r. i7 |
  62.                         printf("Sucessfully launched DekaronServer.exe\n");8 k: e# l! E/ S# |2 H7 H% M
  63. : ~: G. V# \( ]8 m" W7 e" A) F$ o' r
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure+ Z- c' {6 _0 }8 l* d) H: x' R
  65.                         dbge.dwProcessId = pi.dwProcessId;
    5 J+ t5 i. j6 {9 h" W  D
  66.                         dbge.dwProcessId = pi.dwThreadId;
    6 F( u2 l  h2 f( f
  67. 2 i% Z# m% b5 M6 }) s
  68.                         while(true) //infinite loop ("Debugger")
    $ A2 t. ?9 m; H2 J! R8 B
  69.                         {/ ]; h: F+ a# Y. k: M4 h& A
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx6 M5 I/ o" K1 Q. e
  71. 0 h2 q: y) I* e8 a
  72.                                 /*
    " s2 b* K2 U% j; S% o
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

8 `. Z# {" F& ?& j# U( X8 |) Y1 G6 m3 v

* _- G0 l$ V+ ?, t1 T* S$ d# o% e
商业服务端 登录器 网站 出售

15

主题

257

回帖

1255

积分

金牌会员

积分
1255
金钱
884
贡献
94
注册时间
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

回帖

1255

积分

金牌会员

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

3

主题

102

回帖

6659

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-25 09:05 , Processed in 0.055746 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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