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

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

[复制链接]

157

主题

369

回帖

7145

积分

管理员

积分
7145
金钱
2049
贡献
4570
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
! Y7 C' e. i& x6 k! g8 l7 r$ v2 w( q' Y2 t( B" f* f2 l( A: M7 v
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
; {' O* A+ W, B* m6 Z0 u% Y' k* U( `1 ?% I2 u- f3 u2 S. T* r
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。/ ]; g5 e$ U1 p; T" [" Q# T
  2. //
    9 D7 H( k' A, |6 S

  3. 0 L! O, Y. e# q5 ^: t& I
  4. #include "stdafx.h"
    ) K6 E8 `: @- w( V* W; R
  5. #include <iostream>6 n2 ^4 {/ r! H5 U( Y
  6. #include <Windows.h>
    , m3 S1 W& _, b; l8 H
  7. #include <io.h>6 |) o$ n4 o: W6 ?
  8. # M. O+ R" @0 E
  9. . v# ]$ j# `0 @
  10. int _tmain(int argc, _TCHAR* argv[])
    " s9 m# D5 Z# `& i0 [
  11. {- h+ V# f% K9 k" w
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    7 s( N' m# |" C0 e8 S

  13. , a6 d/ W' ^' Q6 _
  14.         //查看文件“DekaronServer.exe”是否存在* L5 N2 Z; Q1 t+ e4 I
  15.         if(_access("DekaronServer.exe", 0) == -1)0 A* m2 }- p2 K% [$ ~# l
  16.         {
    8 S: z" X9 {. g# T6 v
  17.                 printf("DekaronServer.exe not found!\n");
    ( G3 w) ?( r  M
  18.                 printf("Program will close in 5seconds\n");( {4 l- p) ]8 [" T; F
  19.                 Sleep(5000);, v& L; g+ D8 X+ j% E
  20.         }
    : W( m/ X! ~$ \/ Z: l
  21.         else
    1 @, s+ e$ d' G5 H8 S1 z4 S
  22.         {
    6 F0 [, N2 h8 @+ M$ q
  23.                
    8 h1 S9 E! }( W3 [# `0 e( ]
  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).aspx9 h# y' |% H7 x& t9 {- M+ [8 C
  25.                 STARTUPINFO si;. d* n8 r- n$ U/ c3 z1 b
  26. 5 y; }5 e* i/ q0 R
  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
    5 I, u: B; i% i  Q$ X
  28.                 PROCESS_INFORMATION pi;
    0 [9 _; k& S3 v6 n/ Q3 b
  29. 2 N8 i+ M5 R  X! S3 ~- l- o5 m
  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
    ' {6 w5 `7 m' f
  31.                 DEBUG_EVENT dbge;
    / m+ X% L/ L1 W3 p3 B& [5 g
  32. ( h- v$ E; |8 Q. T; e" g3 j
  33.                 //Commandline that will used at CreateProcess& q% }4 A3 Z# ^: c- M
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));2 i9 B3 X  O6 W6 f
  35. 1 `* W7 N9 p3 I( P7 P
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)+ u- W* a: Y) v
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    & f& U) Q6 Y# m1 {- A( t4 i# Q$ [
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)5 F; k3 ]4 h% j, m- e2 W
  39. ; l& p0 f5 U* C' `

  40. , O/ S/ |. w2 R1 d
  41. + y9 \7 e4 `9 I7 C
  42.                 //Start DekaronServer.exe / E( j. |9 I& R6 ^+ ]7 l1 H
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx& U8 d, l, V5 d$ }# o! H: l
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)  e& @( t' }( M% F
  45.                         szCmdline,        // Command line
      w& O% M# ?4 S$ A. k; U( A) K4 g
  46.                         NULL,           // Process handle not inheritable
    % F0 T& ]* d3 D  d0 N1 n6 Z
  47.                         NULL,           // Thread handle not inheritable
    + T$ |. `. X/ W7 p
  48.                         FALSE,          // Set handle inheritance to FALSE
    " f) J) J6 M4 D
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx9 c4 k! v7 U$ i' l. ~
  50.                         NULL,           // Use parent's environment block+ M, a1 i. _1 @! _! @& Q5 H
  51.                         NULL,           // Use parent's starting directory $ H0 c: E, L' D: c
  52.                         &si,            // Pointer to STARTUPINFO structure( k& w6 B/ }, }, G8 z
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    : v- R+ p) b, d5 l
  54.                 )   i, S* u' Q" H3 Q
  55.                 {
    & s8 c2 |! ^1 w  j9 _- p& I! z, ?2 ]
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    & v6 @8 l# R9 ~5 S
  57.                         return 0;
    . C' h# m0 k: n9 o, @! Z1 O
  58.                 }( N- V. p( S8 j# `7 v
  59.                 //Creating Process was sucessful
    9 L" x! V- b9 T
  60.                 else
    & c( A% Z# X0 m2 v7 ^
  61.                 {
    ! ~: }0 \: O% _( v) l
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    2 h$ F7 B6 v( g) P7 F
  63. , e0 p/ U' v" v0 ?: A: ^6 S9 M
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure$ C: u0 N. a9 s
  65.                         dbge.dwProcessId = pi.dwProcessId;2 I$ q7 q3 b+ [' ]1 y7 i  X+ c
  66.                         dbge.dwProcessId = pi.dwThreadId;
    2 k: T3 {. ~9 |+ N* u
  67. : K7 ^! p* {7 H4 k& u+ N8 A
  68.                         while(true) //infinite loop ("Debugger"); }; r& {9 C) j5 M/ @! ]6 `  _. k
  69.                         {
    % y; E( G9 H0 R6 Q. S
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx5 x: q6 [4 C8 R5 Z9 C

  71. " j, e7 Z3 x$ U. |9 t
  72.                                 /*5 k$ A3 `  R* e4 J# e
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

7 u6 ?( q6 G2 t4 y( |/ G/ g+ Y8 t1 v& m- \: w# w) o( Z

( z5 x: ]( \& o% w) b" p, v  d
商业服务端 登录器 网站 出售

15

主题

258

回帖

1245

积分

金牌会员

积分
1245
金钱
903
贡献
64
注册时间
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

回帖

1245

积分

金牌会员

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

3

主题

102

回帖

7417

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-6 21:49 , Processed in 0.035217 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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