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

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

[复制链接]

161

主题

385

回帖

7437

积分

管理员

积分
7437
金钱
2139
贡献
4748
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 9 N0 K: d  e" U6 Q. a0 I

; H# t  ~% F* Z  ?5 L虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。. I  ]% f5 b, X" |8 u

# W1 G- y3 q  e
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    7 e# x! a+ z" Y9 U/ i
  2. //
    8 L# \. w4 O* k

  3. 3 W, o' W3 }' {' t* @. _
  4. #include "stdafx.h"! m4 \. n) a& s; a- F& h) C  }
  5. #include <iostream>8 l& s1 x  ^2 C! M0 B& ^5 l; s
  6. #include <Windows.h>
    " {' e- n$ R, V, h; o0 I: v- U/ e' _7 j
  7. #include <io.h>
    * l) x# M5 A  l6 G2 O

  8. 2 E0 D) \5 N9 _3 \
  9. ; x9 s+ \% S+ @
  10. int _tmain(int argc, _TCHAR* argv[])
    & ^% E$ w) k4 i  D6 p2 X
  11. {
    7 B. [, t6 V4 e
  12.         printf("Dekaron-Server Launcher by Toasty\n");! y7 ]2 F, I& p, c
  13. % c, S( X; N$ e/ K" A' W& H; G
  14.         //查看文件“DekaronServer.exe”是否存在, E5 T4 d1 t7 Q' L( @
  15.         if(_access("DekaronServer.exe", 0) == -1)4 H& U* o; b9 }1 u8 {8 W% A
  16.         {4 W& U( [6 o) k
  17.                 printf("DekaronServer.exe not found!\n");
    9 H/ ^9 v* @7 D) q
  18.                 printf("Program will close in 5seconds\n");
    : r  D4 S. b7 r1 l& D1 p
  19.                 Sleep(5000);# i+ ?4 T" f7 b/ H
  20.         }* l# P) R6 d- p5 \. R$ e
  21.         else
    ( {8 V- S7 R+ f$ F7 Y$ n. i8 d# X) j. ]
  22.         {& A" v8 r3 U7 V3 r
  23.                
    8 Z8 `$ G$ \- M8 @+ W6 S
  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
    , k7 E; h0 o3 ]" Q( Q
  25.                 STARTUPINFO si;. m; `# ]! F6 {( w' a& `0 o
  26. ( G: p, w4 E: T2 O1 E. C! A1 }' b. W
  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- x1 c3 r/ Z& x' m! {8 p( H
  28.                 PROCESS_INFORMATION pi;9 D) |0 w0 L  M6 }
  29. + z" h5 n4 I6 B: z$ S, q
  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
    ! V  P. [# d$ Z2 i# ^/ f# ?
  31.                 DEBUG_EVENT dbge;  Z: m; L7 N' p, \
  32. " D: k# d5 P0 g& }: ~+ w& W+ a2 m
  33.                 //Commandline that will used at CreateProcess, |: U, [+ `8 o8 l
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    / t  J2 S5 A4 p5 A- \" H
  35. . O' W+ \& Q% @4 z; N/ ?! U& c  e
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)$ _0 x! W" z6 ^
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    ; }/ `' O+ V8 n2 ?, t
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)  Y- Y% z& S: X( f
  39. $ f; U) N! C' D! o
  40. ' d5 b- U: I3 X+ Z  {: t4 {! w
  41. * X# d2 W3 x# b8 K# N' v, k
  42.                 //Start DekaronServer.exe # T$ ?0 P" y9 H4 }& }
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx2 q% c8 |! ~& B' x
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)" c) M! q% B7 H) q5 o5 q; ^7 W
  45.                         szCmdline,        // Command line
    8 a, U/ x6 @9 T" k7 K$ Q
  46.                         NULL,           // Process handle not inheritable
    7 r1 l' i: {8 `) t& Z3 V
  47.                         NULL,           // Thread handle not inheritable) W% M6 p8 C, n. ~. h  T! Y% D+ s' V
  48.                         FALSE,          // Set handle inheritance to FALSE( ^' X# {1 Q/ p0 o% |( ~/ V3 H% N: g
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx; V% c$ f- `8 U4 g, d
  50.                         NULL,           // Use parent's environment block9 `8 }5 c9 Q/ c/ v* b$ h
  51.                         NULL,           // Use parent's starting directory ' i% J5 E) o; Y2 ~! v0 t  g
  52.                         &si,            // Pointer to STARTUPINFO structure6 c% m# r! z/ r5 Q+ C. P
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    9 k% V7 M, e" n* c! F* ]4 H
  54.                 )
    ! l; [0 [; M/ ?) w& O# p* [
  55.                 {0 Q) H$ \& F5 @9 N1 J/ y  ^/ y3 m
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );& E- B. Y& E1 o6 G$ b0 F
  57.                         return 0;
    ! v  E, x/ o& U" g6 c" i- W8 n
  58.                 }
      {7 [% ]# _6 t( @& \/ [
  59.                 //Creating Process was sucessful# |3 v# g6 X! p
  60.                 else8 q: Z$ |+ k( {% D7 n
  61.                 {, z: p5 J1 J& O6 P( W$ g
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    $ p4 Z+ R1 o- j: S2 K

  63. 3 b, }+ y0 r' j9 q% ]
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure9 B" K- i$ G# x0 g9 P; |
  65.                         dbge.dwProcessId = pi.dwProcessId;5 A3 A5 U, I1 ~& G& l
  66.                         dbge.dwProcessId = pi.dwThreadId;- t$ \8 C2 E/ x4 A; F3 b; d
  67.   `7 ?7 _6 p4 E+ J
  68.                         while(true) //infinite loop ("Debugger")
    + _5 G( M% ?$ [8 G9 e
  69.                         {
    % T& s. V: T, ^! A+ c9 }0 A
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx1 |9 B/ e/ y3 Z6 h; F* j

  71. 8 b6 `' E- L  C$ o
  72.                                 /*
    ) l; Q7 l( Z* b6 I) Z9 ]
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

9 M6 a' H. G; l' h3 t. k$ w, x1 |8 ^+ Y2 N: g0 @8 n2 M

- }. a4 X8 M4 H/ m5 `6 w$ T; _
商业服务端 登录器 网站 出售

15

主题

260

回帖

1298

积分

金牌会员

积分
1298
金钱
935
贡献
83
注册时间
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

回帖

355

积分

中级会员

积分
355
金钱
142
贡献
6
注册时间
2024-5-14
发表于 2024-5-14 15:56:57 | 显示全部楼层
学习学习赞赞赞

15

主题

260

回帖

1298

积分

金牌会员

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

3

主题

102

回帖

7997

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-5-5 11:15 , Processed in 0.033865 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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