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

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

[复制链接]

160

主题

381

回帖

7327

积分

管理员

积分
7327
金钱
2109
贡献
4677
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
8 c$ W/ F5 T6 u3 U; @1 r4 V  h) l2 C) t0 M4 z0 t' Q
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。7 Z; f5 }7 E. {4 Y) F
: S" \' F& e' ?# ?2 n
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    : }, R$ |3 o  w  {- g* X8 Q3 B
  2. //
    % ~* F) W# Z! V9 ?* K- y
  3. & a9 Q  ~4 R2 ?& E. C
  4. #include "stdafx.h"
    " ]9 \# H$ \; {1 h0 l+ i
  5. #include <iostream>
    ) v6 k! R( E  Q: v( U: C
  6. #include <Windows.h>1 {9 S1 n& _& Z% j% B3 m7 ~
  7. #include <io.h>' n) b" @# \) m" `" s
  8. # ^1 _4 x( \1 I' j8 C
  9. ! C  ?& r0 |9 A* q  s" Q
  10. int _tmain(int argc, _TCHAR* argv[])
    0 e* S/ N$ Q5 S* F
  11. {0 a7 I4 M6 n, M
  12.         printf("Dekaron-Server Launcher by Toasty\n");4 p9 Q* x9 Q" |) f1 Z' O+ Q
  13. 1 G' Y7 {1 D' i, [) P
  14.         //查看文件“DekaronServer.exe”是否存在1 S  V7 O, K0 n: J2 V$ h) Y+ {
  15.         if(_access("DekaronServer.exe", 0) == -1)
      P9 Z+ ?! L! m4 @
  16.         {
    / [+ W! W2 i5 J' D0 \4 [
  17.                 printf("DekaronServer.exe not found!\n");
    ( O' }) y" ~) L9 K1 p
  18.                 printf("Program will close in 5seconds\n");
    6 n; U7 n1 a- o/ x9 }
  19.                 Sleep(5000);0 g+ J1 e% N" P9 v/ a( {( [$ `/ q# h5 ?
  20.         }
    1 z8 e1 V; C. T' b& j) L3 `
  21.         else3 `5 r, {% Q  h, k! c/ P( ]
  22.         {9 f- s9 n+ i5 v" I. i
  23.                 # a5 z7 z, k) `) j- E: u+ [, G
  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 }, q! t. ~/ e- T! B1 x8 G
  25.                 STARTUPINFO si;! A# M: M( K# g% @  O4 a
  26. 7 C5 G/ ]! _$ g& l( [% {. n* v. b
  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
    ! F3 j' p# l6 A; ~& U( c7 q
  28.                 PROCESS_INFORMATION pi;
    + Z3 x/ @! ]1 v

  29. 7 A3 T2 V$ T2 v
  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
    7 M5 B8 d* J5 G" G, f# u( i
  31.                 DEBUG_EVENT dbge;
    : ^+ _  B; Q- U' y& M# @$ w

  32. 9 S* b/ H1 T. ^, ^! J' E
  33.                 //Commandline that will used at CreateProcess: A* _# z5 _8 K: p6 }/ D3 b" S+ Z0 I! v
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    / ], U+ N+ {2 Z$ B/ x: v

  35. . [1 h7 {0 \+ I/ |1 w3 x4 ]( I
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    0 ?( E, C8 |9 y. C7 j( ?/ ^; u
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    , B0 y0 Y7 L# |' t! b
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    3 B! N/ b. T( L
  39. , ^! {3 @' i7 S/ ]+ C
  40. 7 B) k; w* r0 e/ E
  41. 5 G& P3 E' L& [% v0 J4 y9 p  D
  42.                 //Start DekaronServer.exe 5 C( ^& c% |& H, {7 P8 @
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    ( y* i: D! u  K' z
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)7 c0 h% f) x5 ~+ u8 N' Z
  45.                         szCmdline,        // Command line: h$ ?+ M* ?$ {2 h4 F
  46.                         NULL,           // Process handle not inheritable/ S' F. H) u; e/ k( E
  47.                         NULL,           // Thread handle not inheritable
    * ^; w% g) z+ W1 g. Q+ A
  48.                         FALSE,          // Set handle inheritance to FALSE
    6 q  e& D' ?+ {1 V& [& _
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx4 `* M" F! t6 T3 N" ^
  50.                         NULL,           // Use parent's environment block
    0 ?! d. |+ o( |% h* F) W
  51.                         NULL,           // Use parent's starting directory 4 W4 r4 p+ t) d. f7 U
  52.                         &si,            // Pointer to STARTUPINFO structure2 u/ n8 v# D$ x# m4 ]  _
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure! ~" A; a; ]1 A: w- F
  54.                 )   a' y! M/ F4 f: ?. T- |
  55.                 {
    4 U- X9 O7 p& o: u; Y6 D0 x
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    9 V$ r( J$ [. O7 L1 G" w$ N) L
  57.                         return 0;
    , k* ~: k& ?. G3 P& k* f
  58.                 }5 S  `9 b7 k, a0 s
  59.                 //Creating Process was sucessful% I- [/ W; D2 V& C+ ]
  60.                 else
      j+ k+ }! }8 {2 {# s' y% [7 M
  61.                 {
    / E- M- M2 E9 p' X7 F
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    . G/ f/ r/ f7 u, Z
  63. : }) j6 J7 y& c2 g0 I* t6 s" {5 ^* [$ m* X
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    * f  f0 z, B1 Z6 K  F! K
  65.                         dbge.dwProcessId = pi.dwProcessId;# N+ b, H1 q  A4 j8 I. a$ {( l
  66.                         dbge.dwProcessId = pi.dwThreadId;
    , ^3 s0 [0 L. E# c: {9 E+ Z) f( y
  67. ! u4 L/ X% f' x1 Z- Z+ U4 l( L
  68.                         while(true) //infinite loop ("Debugger")
    7 Y; F# C" Z! C0 v4 q  q
  69.                         {
    4 o* v! N) K) Q" F9 t
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    & `$ j2 G8 I3 ?0 `. t) K

  71.   K4 u& n" {( {3 z. b6 f
  72.                                 /*
    : q' v. s* {1 X1 u# a
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
( J) d$ |! }/ a0 d
7 M. B! j( T- J; b

1 D# |4 N" v$ |) p' i$ u# `  v
商业服务端 登录器 网站 出售

15

主题

258

回帖

1270

积分

金牌会员

积分
1270
金钱
917
贡献
75
注册时间
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

回帖

1270

积分

金牌会员

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

3

主题

102

回帖

7717

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-22 02:02 , Processed in 0.037692 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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