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

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

[复制链接]

159

主题

379

回帖

7308

积分

管理员

积分
7308
金钱
2103
贡献
4667
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) - j, Z7 G- D) D2 k0 n
# ?! }  m  l! l( _3 ?9 }1 A: M
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。* o  i2 o6 G7 r6 `
( x" H) e, [: m# a" s/ ~
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    0 z8 c- \7 t" p2 h
  2. //3 ~4 E/ k1 f) T% M  @7 \
  3. & V8 E% y& J5 b, l( @0 K
  4. #include "stdafx.h"
    ( ^: `2 j+ Y8 |, T3 Z0 w
  5. #include <iostream>* B* a- P& u  `& o, O
  6. #include <Windows.h>
    5 p2 w( K( p; g
  7. #include <io.h>) @8 l3 i6 D/ c" s# N0 @5 y

  8. 7 s- S8 X6 F' {6 G

  9. ) n, M# C6 x3 q
  10. int _tmain(int argc, _TCHAR* argv[])7 ^( A3 j- A% N8 D* W
  11. {
    : k/ N" I0 N; v$ V7 ~1 u# s6 k& F+ T( h3 T
  12.         printf("Dekaron-Server Launcher by Toasty\n");7 z% A& n  I6 Y/ ~& Z. Z, d
  13. ! V5 [# G9 a. L( n+ L
  14.         //查看文件“DekaronServer.exe”是否存在
    : {. ?, o: v+ k: m( x8 F
  15.         if(_access("DekaronServer.exe", 0) == -1)
    # K$ g- g& ?8 F" ?- b) Y* ~# l) K
  16.         {' C1 j  a4 B4 F! r3 E$ z
  17.                 printf("DekaronServer.exe not found!\n");. ?" n( A3 M. C0 A. [* R! B. p
  18.                 printf("Program will close in 5seconds\n");9 e& |+ [$ P. H$ [( N1 B  V
  19.                 Sleep(5000);
    . w$ s: X/ ?2 U8 l% T
  20.         }' H) ?7 B* b( N  F7 P- w$ y
  21.         else! ~5 v( k- d3 ?
  22.         {- c; S* m3 @7 a/ d3 s1 x5 a9 Q, @
  23.                 ) S6 M* N! b7 P- x7 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).aspx1 P0 o% ?0 S6 J; i' Z
  25.                 STARTUPINFO si;
    3 z! ?& D( e  V7 @& |" g
  26.   \- y" A" f" K) k+ `% L
  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! T: x( I# O0 B: F4 @' M
  28.                 PROCESS_INFORMATION pi;
    0 J! L* u" N) w* W5 T7 ^
  29. * @) W5 B9 h( {% Q8 ~& P* d
  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
    4 V2 p* a* a) G: a
  31.                 DEBUG_EVENT dbge;
      Y' B( c8 G1 @" _  Z" B1 a
  32. - W9 h( }$ A4 P; L9 f; X
  33.                 //Commandline that will used at CreateProcess$ k! s4 x. v. W
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));; P/ U! Z& c$ ^) D7 _7 r

  35. 5 d. j# V  l) |& @, p# w
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)$ Y% c/ _. u' \% r* A6 m$ ]
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    9 B" X2 O5 O+ }8 H: p7 _; N/ q0 y# V3 o
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    8 m0 r0 Y' H& z' ^: o4 U; t9 _; c# }) ~
  39. & P7 N  k4 }& a+ L, d

  40. ) s* }  F' q* M4 _
  41. & I0 T* Y9 A7 V4 G+ ~
  42.                 //Start DekaronServer.exe
    5 K/ ?/ i; y# T; q
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    , w/ P5 H! y4 P6 C8 Z9 Q- Q5 H
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    5 f, }' k& E$ e
  45.                         szCmdline,        // Command line7 _! H$ y% h% e( m3 J4 ]
  46.                         NULL,           // Process handle not inheritable. k2 ]3 I) H. E$ R; m
  47.                         NULL,           // Thread handle not inheritable
    % |. @0 J! U" n) i( K% i) g
  48.                         FALSE,          // Set handle inheritance to FALSE
    % I. Y) g) J9 g
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    5 F' a6 a) e1 c. |& ?
  50.                         NULL,           // Use parent's environment block
    % x7 M1 C! L; T3 b5 ^( Z
  51.                         NULL,           // Use parent's starting directory
    6 }2 A( ]( Y- v) M: \$ f7 f- Z
  52.                         &si,            // Pointer to STARTUPINFO structure% U$ u/ i! E* o* E$ X% h/ x& d
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure1 s3 O: u" k) w+ b5 ]* f9 @
  54.                 )
    2 [1 a6 l* [, M. q" g9 [+ g
  55.                 {
    2 Y0 b% z# p6 |
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );9 J& |; g3 e# M
  57.                         return 0;
    , Q1 B& v, `1 l4 v
  58.                 }
    : _% P8 r2 L9 F7 ]1 `$ W
  59.                 //Creating Process was sucessful
    + I1 }  t6 e6 ^( x, l; L
  60.                 else
    . O" b5 s. N3 I* R6 F. i; s
  61.                 {! ^2 l6 h+ h7 K7 [( X6 [7 d
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    ! O* a8 P( B1 p. c# b* d3 `

  63. . g. B0 J3 W. e7 L
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure( A! }" `# _0 l2 K! J! O1 a
  65.                         dbge.dwProcessId = pi.dwProcessId;& T. U; z8 w4 ~% C
  66.                         dbge.dwProcessId = pi.dwThreadId;
    * E' c: s/ P# v- _4 e( T

  67. ' ?" _' L% l/ H( s# e
  68.                         while(true) //infinite loop ("Debugger")
    2 H0 Y' D% H0 F
  69.                         {% M) y) B/ a: W: X, T9 @" e' P
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    - ^- E4 f7 v( R7 g2 |  q( t" z" X* a
  71. 5 Y( s+ C4 L7 ~, h
  72.                                 /*
    3 N( M( z5 J2 o8 }# Y* T
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

9 \3 ~  F$ K3 C' o+ L& G: N# G' M7 M8 G# z6 z+ ^
' M7 g! ]) |1 z7 m% |+ B1 V/ X
商业服务端 登录器 网站 出售

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

回帖

7657

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-18 22:41 , Processed in 0.036030 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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