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

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

[复制链接]

157

主题

361

回帖

6695

积分

管理员

积分
6695
金钱
1935
贡献
4242
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
4 m& N& e5 n% `
) P. g# I2 K2 @虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
) W7 K2 ]8 u; C) T$ C4 A: D1 x- K# M2 P' I7 l5 g5 y: l
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。7 S) J5 E) V. a0 ?* H* T$ A( T; r
  2. //0 }! _7 p! r2 w6 K1 B- }

  3. 3 Y. C7 w( D. m( q  m, L- k. }
  4. #include "stdafx.h"/ `+ g  Z' A* n& P" s4 v
  5. #include <iostream>
    % a7 a' |/ V) p( i3 f3 J. m
  6. #include <Windows.h>( T1 S, p; p9 O, _+ f
  7. #include <io.h>. {5 d0 S( c( ^! L+ i- u

  8. 1 e: W# S9 t! a  b6 H( l; W

  9. ( J% v0 g+ P1 {/ E9 X: R  T
  10. int _tmain(int argc, _TCHAR* argv[])  o9 _7 N( z& V5 \7 p
  11. {+ S) ]/ d7 Z3 b5 s; _
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    ; G# C) G9 G5 ^0 H2 V8 o
  13. # Y, Z8 v$ z; q  _8 i5 T2 Z5 J, Z
  14.         //查看文件“DekaronServer.exe”是否存在
    0 h3 s" x4 r* {$ I# `2 H) R# d
  15.         if(_access("DekaronServer.exe", 0) == -1)
    4 k. q# R) @* Z0 Y; J
  16.         {
    6 X4 {4 P; R: A, e
  17.                 printf("DekaronServer.exe not found!\n");8 [. c1 z; x( y/ B  Y" B+ E7 i
  18.                 printf("Program will close in 5seconds\n");
    " Z4 ?# D+ X: u+ ?
  19.                 Sleep(5000);
    3 X, o. Y8 U" U( g' @
  20.         }
    ( o" B3 o5 T* _( N7 n8 O7 U3 w
  21.         else* _5 S. S' I* [0 A8 J4 S$ \
  22.         {* r" \+ J% i  b9 V1 Y
  23.                
    2 P% k; o0 h1 t; b( 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).aspx
    - d7 [* h% C9 E) t
  25.                 STARTUPINFO si;
    / N- C) w9 F, T: ~# f
  26. 6 V. k8 W2 E, W3 b: F8 h
  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
    " J5 {$ v3 B" ~" x
  28.                 PROCESS_INFORMATION pi;
    ; g4 s7 P4 a4 {* K
  29. * @6 B1 E0 {1 w" Y
  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
      o" d& t' _, {' T7 j0 e
  31.                 DEBUG_EVENT dbge;
      Z" D# i8 _! F5 t4 k9 I) W
  32. ( q% W; I4 p, T; D% c7 i# B
  33.                 //Commandline that will used at CreateProcess5 @& a# H, r" R5 y  h, W
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));9 x8 o: L# n- ~3 ^

  35. 2 X; Z! n  ?; |- f  N2 W8 C$ Z
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)# E8 x- `& o% U/ ~+ p& h/ v& J5 Z: ^
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
      f7 j& P' O. D# T* f. g! R4 y9 [6 n
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    ) `0 w/ i! O: y9 y' w+ D! t  ~+ ], e
  39. 0 X% [5 C" K+ a* c! S9 I5 t9 r4 V

  40. 9 t: \% l  o+ e# {( r7 S% G
  41. # ]# Y$ V/ X! S4 ]+ h1 p- @* N
  42.                 //Start DekaronServer.exe 4 d- E8 ]9 M6 ]4 R& v) v
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
      `: d% p* s3 Q7 a& \; ^
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)4 z& K) f1 w7 T1 f3 ~) z. C5 ^
  45.                         szCmdline,        // Command line
    & F# g7 `/ s# q+ s, Y# a$ L
  46.                         NULL,           // Process handle not inheritable( Y3 \. N9 {. t
  47.                         NULL,           // Thread handle not inheritable
    ( v2 d( V- |& U; ^' y5 G! y
  48.                         FALSE,          // Set handle inheritance to FALSE* }# q2 M. N: \, s* C
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx4 Y  v- _! _3 K; @
  50.                         NULL,           // Use parent's environment block* ]) N7 |& P; u& R$ A& {0 W+ R9 w
  51.                         NULL,           // Use parent's starting directory
    ; S6 y5 H: r& f+ u9 t! M
  52.                         &si,            // Pointer to STARTUPINFO structure
    ) K0 k3 w% ~+ j3 a, s& ~
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure4 O/ L; Q* w! ~& _2 f8 w6 v
  54.                 )
    9 L. \; k9 @( i0 S9 u
  55.                 {: Q  u/ M- o6 Y
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );" g: G  T  z+ I+ \7 e1 y
  57.                         return 0;
    . ~3 {$ L# T2 j7 Z6 d( R
  58.                 }
    + n1 D9 ~1 l& I3 t4 o) s- [
  59.                 //Creating Process was sucessful+ ~' C, u0 F7 v% ?. M) o
  60.                 else& r( Z: H. N. |% o) |, R
  61.                 {2 N( g3 k# Q" g% c
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    4 H+ Q+ i3 b+ ~2 Z5 W
  63. 2 R. G- Y+ B& R& [: v8 l! T% Q
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    - C) z5 i( F+ O6 a# t" N9 B
  65.                         dbge.dwProcessId = pi.dwProcessId;
    0 A& _% B- m$ F6 i  a5 c! G( c
  66.                         dbge.dwProcessId = pi.dwThreadId;0 O7 ?% u! }; J' @( E
  67. + \; F5 x" Q8 l; @
  68.                         while(true) //infinite loop ("Debugger")- i6 Y( f2 G. Z, j$ G7 e
  69.                         {, m" M' x; Y+ r/ d1 I
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    7 m+ t. }" L! G5 D( w

  71. : n( `5 I6 }2 M9 f. ?7 c
  72.                                 /*# U! H0 t2 k0 v5 m
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
& x  q% P- j. c: k/ h% N- c& u# t

$ ^# F" l+ u5 a0 I9 O, y# q: ?2 ~8 f
商业服务端 登录器 网站 出售

15

主题

256

回帖

1262

积分

金牌会员

积分
1262
金钱
867
贡献
119
注册时间
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

主题

256

回帖

1262

积分

金牌会员

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

3

主题

102

回帖

6421

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-9 19:21 , Processed in 0.068951 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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