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

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

[复制链接]

153

主题

333

回帖

5695

积分

管理员

积分
5695
金钱
1795
贡献
3414
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 4 d+ h5 s. u4 D6 Z8 N9 c9 d1 y; m
0 R' a7 B9 G5 a7 n2 Q8 ~
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。9 ?+ z) O9 u! Z6 K! p
" R4 o5 H9 G+ g6 y
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。5 Y+ K  u! H9 G& L# r  U3 Q/ x
  2. //
    ) G3 z- \) a7 x. f6 B- s% ~

  3. " @$ r' W8 U# ?
  4. #include "stdafx.h"% \$ C6 @$ u/ y. b8 Y
  5. #include <iostream>3 B( B0 N7 `' }. q4 o; \
  6. #include <Windows.h>
      u* ?% {; p9 O6 n% ~4 M" z' E8 V
  7. #include <io.h>; G0 ?, x$ D6 u5 j
  8. ( i- ~: F; ^0 a# c# H

  9. # [" {' N0 @5 ^: h! f/ o5 p: k% G
  10. int _tmain(int argc, _TCHAR* argv[])# r- j, C6 Q2 e# \
  11. {
    * s) \; w4 a$ f, F- L- ^; T
  12.         printf("Dekaron-Server Launcher by Toasty\n");% a* q. a: v# m
  13. 9 E! D+ X% F! f5 H
  14.         //查看文件“DekaronServer.exe”是否存在0 I( `! I9 Y  l! i* i
  15.         if(_access("DekaronServer.exe", 0) == -1)
    ( x0 y% ^/ l* l$ I9 r4 W& f
  16.         {$ I' ~  @1 o8 g2 W4 @6 y$ |
  17.                 printf("DekaronServer.exe not found!\n");! C% G( b% i" B" s- K
  18.                 printf("Program will close in 5seconds\n");
    ' O+ C0 z. n# K& ^
  19.                 Sleep(5000);9 |/ d% ]7 b/ B8 {
  20.         }/ f2 T9 y$ a3 g5 U1 E8 m
  21.         else8 j) y% D! w) O- B# z+ o/ a6 K6 k! K- y
  22.         {
    2 d- J% K) F4 T
  23.                 ' m7 f* `& x* o  o
  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
    $ e' @9 H5 p* z: d& @; j- N3 H
  25.                 STARTUPINFO si;9 d  |- V, L- K/ w+ l
  26. & |! o6 |' b( r/ q, [; k
  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).aspx0 H% |' N: Z) X6 c. Q+ g
  28.                 PROCESS_INFORMATION pi;
    6 r9 |! @) r8 _" @% O0 G$ Q) w

  29. : q% h; d6 c, s/ \- _& b' L
  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# k" _( s0 `: L, J0 Y
  31.                 DEBUG_EVENT dbge;' s( E6 A: V: m8 N, Q, y
  32. 0 N9 \5 g+ c: h6 X7 U
  33.                 //Commandline that will used at CreateProcess2 ]. E( D! F: [$ l& p4 \/ A  n
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));  n0 I$ Z6 p( f" f
  35. * O4 s' b8 a& I. h' G8 Z, x
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    9 n# x3 M4 Z" R
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)! z4 X  a1 C5 M" H+ I1 N
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)  m( {- o9 K5 T( [, v8 \
  39. % s, ]+ a% D$ l" n

  40. $ L) t; g" _9 _  |! q2 D
  41. . y( S: k5 x6 _' g
  42.                 //Start DekaronServer.exe
    0 u& _( V+ r3 B3 z/ u
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    0 W3 |* d7 G. E' F3 i8 |
  44.                 if( !CreateProcess( NULL,   // No module name (use command line); ?3 q$ Q7 E/ X2 Y7 y1 C
  45.                         szCmdline,        // Command line
    , G% y8 B/ \& s2 z; F) a+ _  U
  46.                         NULL,           // Process handle not inheritable, d+ G+ D8 S$ K9 @! ?# g) ?
  47.                         NULL,           // Thread handle not inheritable8 K3 b2 R. S& R1 u. a
  48.                         FALSE,          // Set handle inheritance to FALSE+ B5 l( `! X0 Q
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx$ A- i; Y; W* b3 W2 Q
  50.                         NULL,           // Use parent's environment block
    $ Y) g3 R% m' F
  51.                         NULL,           // Use parent's starting directory * F, \* A% C( F
  52.                         &si,            // Pointer to STARTUPINFO structure; ?; {1 V, t' a# U+ @  d" i6 V  ]& H1 y
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    ' S5 m' U" \0 w1 p8 M4 a! T
  54.                 ) 4 e$ P1 F0 u( E; T0 E0 K
  55.                 {; M  V% [2 I6 `9 P5 R& _' K
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    & }4 S; j, P/ k* o* b0 X
  57.                         return 0;
    & A: k9 w# c  r! E& x# w; ], }
  58.                 }& ]" y* c: p# h+ k2 R1 r
  59.                 //Creating Process was sucessful
    6 g3 z. g: c$ w1 g
  60.                 else
    3 V8 |" _4 C( q" h! @- E
  61.                 {% @1 \; f' S$ d% I% x
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    ' Q0 e! G& c/ A# k0 j

  63. 8 o; C+ X& m9 L/ z
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure' p4 |+ B& s$ P6 H$ T& n% w$ Z
  65.                         dbge.dwProcessId = pi.dwProcessId;6 S) L: H- S' m
  66.                         dbge.dwProcessId = pi.dwThreadId;- s) E7 ], I( F- x1 {' j' M+ |
  67. 9 N: j! k8 }; {
  68.                         while(true) //infinite loop ("Debugger")
    5 s; _& p: B$ l# s  Q$ K9 I
  69.                         {
    5 k" l7 h! [% [  {$ 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, v8 |" _9 C! D9 d4 T; c

  71. . r# L3 Z' f. m- d) s# ?
  72.                                 /*: a1 n! }" ^# s' H7 b$ c6 Y! O2 @
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

. B" v$ e' k3 r( P9 G2 L; s  H( E: E- v1 t0 i3 b6 [- H2 k

  Z. t# ~! k; |$ ^/ }2 z& ~5 g3 r
商业服务端 登录器 网站 出售

13

主题

250

回帖

1214

积分

金牌会员

积分
1214
金钱
775
贡献
171
注册时间
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

主题

205

回帖

345

积分

中级会员

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

13

主题

250

回帖

1214

积分

金牌会员

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

3

主题

98

回帖

4945

积分

金牌会员

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-11-18 11:32 , Processed in 0.074305 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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