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

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

[复制链接]

152

主题

325

回帖

5593

积分

管理员

积分
5593
金钱
1773
贡献
3343
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
( [3 w; T4 O8 o. P( |- i9 i2 x: l
$ ?6 `) a7 [& P虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
2 D+ Z0 [8 S7 H& x) G) h; F5 C4 B. M3 }9 v5 a) Z. Z
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。) M0 o1 Y8 @: \8 J
  2. //( S; I0 P8 ^& c/ l$ Q

  3. + v1 p& p% m: w
  4. #include "stdafx.h"4 R2 K% t9 `0 y( H% D
  5. #include <iostream>
    5 n5 E( {- K# g' \: X
  6. #include <Windows.h>
    , U, D4 F- w( {/ u8 M
  7. #include <io.h>
    * E/ n3 z+ v- D8 ]

  8.   A4 t/ A  [2 V" M) K

  9. 3 b1 }  I, c% i" t$ q5 r7 Y' Q
  10. int _tmain(int argc, _TCHAR* argv[])6 J; A: n; ^! V
  11. {: S' C+ P$ E* P% |
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    : S8 S9 v2 D0 A3 u
  13. 2 E6 P! H- f0 B5 c+ o
  14.         //查看文件“DekaronServer.exe”是否存在3 `  v- q8 f2 C# Q! @3 c: e# N7 c
  15.         if(_access("DekaronServer.exe", 0) == -1)
    / J2 K  X1 Q! G# X  O
  16.         {* d" w$ ]& T. v: A% Y: j
  17.                 printf("DekaronServer.exe not found!\n");- Z" C" M: f" A
  18.                 printf("Program will close in 5seconds\n");. a$ O/ l" F, c. g/ l
  19.                 Sleep(5000);  W) x5 }$ \1 @  k1 \+ y
  20.         }
    ; Q+ H1 J! b' a4 c" B) ~
  21.         else
    5 C5 S8 }2 f2 a! m
  22.         {- X0 Z  _+ G% |4 w2 e8 K
  23.                
    ; k! I5 _  z  }3 |: m) K2 g( p( h
  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
    1 g# ~/ J* H. m; W& `, q
  25.                 STARTUPINFO si;" o& a- I! E" s% m: }* Z

  26. 2 \6 d+ k! n% u5 S3 \; e0 I
  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
    $ A4 R+ I8 x3 D/ q3 c% G) C
  28.                 PROCESS_INFORMATION pi;
    ' T& T! U! h: d0 P

  29. 2 z) e2 l, h0 m" b$ q$ w
  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
    - R, T% e# [& K7 J
  31.                 DEBUG_EVENT dbge;
    / P# J1 V& C( E! @+ D9 v
  32. ) u' u, E2 S9 \2 b
  33.                 //Commandline that will used at CreateProcess
    " l- T7 L# b& u- P
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    ! ~- u. c5 |: [9 K$ [8 K8 z
  35. 5 L: q: ?# h. A$ G% V# `8 O
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)+ p$ l: e# R- W4 b
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)6 b1 U2 S; o/ Q  l( W
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made); z3 V/ H# D' W! P

  39. ( x* z7 H; X- V/ C' ?& K

  40. ! M5 {8 g# G  f/ C8 j/ A, u

  41. & `7 H) g9 W5 }7 X
  42.                 //Start DekaronServer.exe 1 F8 c% O& r# k, [
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    6 G) ]- P- |  z1 U4 k
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)6 H: ^# a: }$ `, T- O
  45.                         szCmdline,        // Command line
    , l6 T5 p4 O6 O& c% ~
  46.                         NULL,           // Process handle not inheritable
    : u8 R7 q; x0 P9 G, R
  47.                         NULL,           // Thread handle not inheritable& {& u; c7 J% Y& a- l
  48.                         FALSE,          // Set handle inheritance to FALSE/ Y; [# H7 V- O8 ]4 f( z
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    * }- S5 q5 ?- R8 L! {( D& M
  50.                         NULL,           // Use parent's environment block
    # Z" V/ ]* Q0 U; C
  51.                         NULL,           // Use parent's starting directory 8 u6 z1 I7 H/ `) h
  52.                         &si,            // Pointer to STARTUPINFO structure' Q* x  q$ r, i" g6 M
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    ) w. O2 e/ J( L. ^3 M+ s
  54.                 )
    7 `% [) J" e8 l# w( D" S  P8 ~; l
  55.                 {
    , q% F# f0 n1 H9 Z
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    : T  r' X' a6 u5 }
  57.                         return 0;
    + k2 T( S+ N  h- m+ ^' t
  58.                 }$ K1 X0 L; e9 }7 ^# r: M- T# q4 S
  59.                 //Creating Process was sucessful: A$ @/ a# o1 O' P, [
  60.                 else3 K/ ]+ `! J8 A) N8 l% r3 ~/ w
  61.                 {- n& u& n8 }7 l
  62.                         printf("Sucessfully launched DekaronServer.exe\n");6 `# r+ v$ U/ |5 W2 F- T
  63. ( g' X! ]$ ?# h5 S) F
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure5 g" o) ?, j4 B0 }8 c5 B+ u) |
  65.                         dbge.dwProcessId = pi.dwProcessId;1 A+ w& F! z+ w; v2 y- W
  66.                         dbge.dwProcessId = pi.dwThreadId;: W! {  q% |' C( [& c7 a  S8 d
  67. 1 E7 N1 y  ~- E* U$ l
  68.                         while(true) //infinite loop ("Debugger")" b7 n- W* c- g
  69.                         {
    7 V! o0 s1 H& u0 V
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx" a# Q, C9 J& c- j
  71. ( m0 y8 t0 X; e
  72.                                 /*
    + B% ?5 `. @/ @1 b4 s1 m" U
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

$ C- j3 Y( x' q/ _1 `1 ]
+ e* [# I( k) ?" {3 V( G) t8 a; T# E0 {6 G9 ]" |$ I4 q0 ^4 B
商业服务端 登录器 网站 出售

13

主题

250

回帖

1199

积分

高级会员

积分
1199
金钱
765
贡献
166
注册时间
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

回帖

1199

积分

高级会员

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

3

主题

97

回帖

4811

积分

金牌会员

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-11-8 19:01 , Processed in 0.070126 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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