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

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

[复制链接]

157

主题

362

回帖

6843

积分

管理员

积分
6843
金钱
1944
贡献
4380
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
1 J0 t. C( d( M( A
! @9 ?3 J4 e0 v& b- u" }. ?$ \虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
( F: x& j7 p5 Z' [0 W6 l9 t* _, q0 _8 d7 b
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。* v1 k* \1 ]$ @/ d) c4 h7 r9 n
  2. //
    ; t8 u6 e3 {) w4 l; U, ]& i0 e
  3. 6 ]# [0 ?1 |4 N  S7 o
  4. #include "stdafx.h"
    8 @  r, J* s8 a% n7 ^
  5. #include <iostream>! i3 ^  J% ~8 |3 p5 |
  6. #include <Windows.h>
    # |- A9 c( ?" v8 E, R
  7. #include <io.h>
    1 o6 Z( H; c5 v& s0 |6 o# \, R) J
  8. 3 m+ A) X6 O% K" J/ E- {

  9. 3 g7 x. M# O+ T- U! `
  10. int _tmain(int argc, _TCHAR* argv[]); v9 k' I/ X: ~$ ?5 M
  11. {
    ) x- Y8 @1 _! [2 t7 Q( a
  12.         printf("Dekaron-Server Launcher by Toasty\n");. _  M( ~( H) l" o

  13. / k+ X$ L' R' e/ T$ x( O: B0 k
  14.         //查看文件“DekaronServer.exe”是否存在
    ) b! L* b/ H7 N" G1 @
  15.         if(_access("DekaronServer.exe", 0) == -1), y+ R- g( R$ v" ~; D4 u* M1 a
  16.         {8 d; f- d7 P7 J) p. z
  17.                 printf("DekaronServer.exe not found!\n");
    9 c+ K  P% Z+ y( r4 p( a
  18.                 printf("Program will close in 5seconds\n");  [5 N) @$ B. G6 n
  19.                 Sleep(5000);
    - h8 \8 g6 K# ^8 P. t! b- a6 b
  20.         }) h8 y) n( S+ U
  21.         else, V0 l; |  Y( f$ m8 G
  22.         {
    & @! p5 F8 c& v3 N" E
  23.                 ; {/ l. @- e" S$ ?2 `
  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
    ( s8 e1 d0 e# [5 F
  25.                 STARTUPINFO si;$ I# ]. d% a) g  `* y

  26. 1 p7 \: G! u6 Y5 y' E/ _
  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. T/ E3 ~2 ?; q
  28.                 PROCESS_INFORMATION pi;& M$ z* r1 r9 m& l

  29. 1 g2 P7 V4 U" ?& j3 [' 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
    ) K8 E" t# t0 B  [8 ]
  31.                 DEBUG_EVENT dbge;
    ! a% B, E0 K' @
  32. 7 j- v, e0 c) m2 a8 F" l0 @: F0 S1 H- V
  33.                 //Commandline that will used at CreateProcess8 N* h' l% e6 n! s4 ^! v8 |
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));1 O" F6 g5 I  K2 i
  35. # _& ?8 [3 U* Q& ~' ]" R; r
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    7 y5 a  _  R7 Z# Q: ]4 T
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)2 R7 q% ~9 `& P+ b& i, M* s1 ?# ]
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)7 C+ L+ T, n  h. P! K
  39. , U; C4 k. l- L6 F$ y: d0 d* a

  40. " Y! w# [* J! P$ x- c7 s
  41. . y9 d- E8 a7 C) t/ q; P
  42.                 //Start DekaronServer.exe
    + s, X1 K7 _/ s0 V6 e& n8 I
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx( x' _/ D2 T/ R- y. F6 {
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
      K# x/ Q" n  ?8 v
  45.                         szCmdline,        // Command line& x: M% \- Z2 y4 q7 ~# z) O* O: W/ O
  46.                         NULL,           // Process handle not inheritable( L& g% ~& b2 \" {$ }, W
  47.                         NULL,           // Thread handle not inheritable
    ' v# f- j( h  q: Y
  48.                         FALSE,          // Set handle inheritance to FALSE; D: a+ f9 U' t4 x
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx' X1 q* p6 ]. ]7 N  S' D* i5 h
  50.                         NULL,           // Use parent's environment block4 w& e; ^; u/ o4 E: E
  51.                         NULL,           // Use parent's starting directory ' `% ^9 M' s' F0 t
  52.                         &si,            // Pointer to STARTUPINFO structure
    % N9 k* e4 V# d( a( ~
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    ( o% m, c2 H7 n, g
  54.                 ) - b! I6 U) I1 C' w5 b1 t
  55.                 {
    % Y1 Z+ ~9 ?/ l
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );5 q; d* e( M8 a4 V
  57.                         return 0;2 y- r% @# U, t. V1 D- f
  58.                 }! ?# x# i8 B7 |
  59.                 //Creating Process was sucessful4 c$ n9 P* u9 j5 s8 Z  Y2 M
  60.                 else* ?6 x  u! c. O& _- y
  61.                 {
    ) i" a. _6 c) c
  62.                         printf("Sucessfully launched DekaronServer.exe\n");, U" R0 w7 q! }: b

  63. + r% A3 l' m9 @1 K2 k4 w
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure/ Q, e+ B7 Z9 A7 v9 G2 Z9 K
  65.                         dbge.dwProcessId = pi.dwProcessId;( x7 L* j% z, x/ b" m; b8 h
  66.                         dbge.dwProcessId = pi.dwThreadId;+ J2 Y! B% Y/ A% Y( x3 t. o

  67. ' C7 Q& e3 \7 q  d3 F  V
  68.                         while(true) //infinite loop ("Debugger")
    & |4 B" O6 L* F; W" E. R
  69.                         {: Q5 @  P4 A- ^1 Z" p: o6 g
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx( J. b  h4 c) D, c$ i" S* C

  71. : H" X0 u: I) m3 B
  72.                                 /*
    ! U6 b- T. g4 M0 C% m+ g1 P
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

0 j9 n9 ]3 M- ^
. N6 N' p) o, i! Z1 P! ~2 g) G* p6 I9 m' j! d' R
商业服务端 登录器 网站 出售

15

主题

256

回帖

1271

积分

金牌会员

积分
1271
金钱
873
贡献
122
注册时间
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

回帖

1271

积分

金牌会员

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

3

主题

102

回帖

6541

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-15 20:21 , Processed in 0.060238 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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