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

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

[复制链接]

157

主题

361

回帖

6821

积分

管理员

积分
6821
金钱
1939
贡献
4364
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
9 [2 i  `! ]% ^) A; q/ D9 j. b3 e- o) g
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。: J2 F, V* E9 a. v7 u; J; J

5 J: t9 b& X; j; {9 x! s3 F
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。6 b. d" v/ v: g/ e, o9 H
  2. //2 {/ v6 C4 H4 M
  3. 8 d+ q: L9 b; R3 i2 Z- d
  4. #include "stdafx.h"4 m$ ], t7 ]9 |3 I$ ~& T; I
  5. #include <iostream>0 o* e: I! c/ P4 x% q: c0 Q
  6. #include <Windows.h>7 S" e4 r* w! N2 `: u
  7. #include <io.h>1 W- ]# S. x6 Q: j% s

  8. 2 z% W3 A/ n( E2 e3 P% T/ V! S

  9. + K6 W3 F/ r; p% c
  10. int _tmain(int argc, _TCHAR* argv[])
    ( R" o, r- z- a+ z# r0 I
  11. {
    0 z* F, ?/ v" h- R  n0 z
  12.         printf("Dekaron-Server Launcher by Toasty\n");8 G1 l) o/ m1 r( k4 {8 n3 I0 d4 I

  13.   H. d: }1 U& s( M" @2 [; J
  14.         //查看文件“DekaronServer.exe”是否存在! v8 m4 Y$ N5 I$ S. |! ~0 T4 ]
  15.         if(_access("DekaronServer.exe", 0) == -1)& t+ `* P4 X$ w' }- |' L; V0 p# i# B
  16.         {  G6 z8 f. H. J$ Q5 \1 I' f
  17.                 printf("DekaronServer.exe not found!\n");
    # m7 V8 ]% w5 P4 V! {! {' J
  18.                 printf("Program will close in 5seconds\n");
    ; {; O( r+ f" I1 N: @' j
  19.                 Sleep(5000);0 T# A- }& _+ g
  20.         }
    2 A- s; S# S2 e6 ]
  21.         else9 r# _( x8 N3 U3 |1 F3 k" N$ }- Y
  22.         {* w- u  J8 Q) y, t* m" q! |
  23.                 0 @  G0 P; S% _1 v$ d$ w4 ~) d3 v6 [
  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
    - E7 b: R- @- e% v
  25.                 STARTUPINFO si;/ P3 h7 h- r3 D5 t+ _( T1 E
  26. 1 A+ @/ b* l2 C: P
  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# C& r. D2 M0 a. j5 `* n! q
  28.                 PROCESS_INFORMATION pi;% g5 u0 u: M9 g, u# t2 ^
  29. " d6 H3 G, H7 O3 f# i
  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).aspx3 r& ?6 s/ _4 ^5 ~1 P
  31.                 DEBUG_EVENT dbge;
    . m7 L  j9 A- X) b% `: L

  32. % b7 o; X" b/ _+ V, d4 v- a3 V6 ]
  33.                 //Commandline that will used at CreateProcess2 b' C6 P! R% {1 X# h" H+ W7 \
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    ! w, ]; X! L# ]; N

  35. 0 I' ~6 P' [+ m4 y- ^! E3 {
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)+ R2 u$ I1 @! }4 K" S# t
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)3 L' u1 F2 c. J) L! J0 d0 t. \
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)" ^; ]5 R$ b6 r8 M+ I) X+ T
  39.   ~! N* C1 M0 j' H* z

  40.   x9 ~' a" u7 x( s: B0 O
  41. 5 ]1 Q' d2 M& {& T: S! M
  42.                 //Start DekaronServer.exe 7 W2 b# Z! U( b
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    & o; M* _* E- l: \( b1 y5 I
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)# W$ d( m5 U4 |+ n& w
  45.                         szCmdline,        // Command line
    0 @! y7 o* ^. y2 Q, F# q  a! I( y
  46.                         NULL,           // Process handle not inheritable: {# F% q6 e" y0 C- c
  47.                         NULL,           // Thread handle not inheritable
    , E% ^" d! a8 @9 L; r  q% h$ i
  48.                         FALSE,          // Set handle inheritance to FALSE
    8 I& m: \! T) H" @0 ~% E# a" m
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    ( T/ G0 P8 Q7 T7 g2 G' K5 n* H1 g! F
  50.                         NULL,           // Use parent's environment block+ @+ p0 p. R6 I2 F6 F- O9 O# o
  51.                         NULL,           // Use parent's starting directory 8 ^3 o) a) `  c3 u; I$ _* U+ z
  52.                         &si,            // Pointer to STARTUPINFO structure6 [9 M0 E( r( T; ], C; M
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    / k5 D# V3 q. l- h' |. Z; x( r! X
  54.                 )
    3 Y7 A/ c, y; o4 h+ z, S, J# z  `4 z
  55.                 {
    4 m* B' f% G6 N$ g6 a1 C% X# z- q
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );: D5 F3 y  ~3 l" ~8 i9 I& U" p
  57.                         return 0;
    : v$ E* Y; v4 o  w) c& Z7 U: U- Y, W' `- a
  58.                 }
    5 Q# Z( c8 B# C- L% \. ]( x* M
  59.                 //Creating Process was sucessful; `$ P3 I& k0 ]
  60.                 else
    ; p4 K3 u+ R" O
  61.                 {
    7 z* H; V& \/ j+ s% C% |
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    8 m% K7 k" P( w( b0 n- D

  63. % T3 `8 M& j6 A0 ^
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure! N4 f+ @$ w4 B, p( Y& i
  65.                         dbge.dwProcessId = pi.dwProcessId;
      f1 z# P. E' S3 L
  66.                         dbge.dwProcessId = pi.dwThreadId;
    5 k9 x3 ~- z7 L4 ^7 \% h$ B
  67. ' l7 p) [4 w. D- \$ A
  68.                         while(true) //infinite loop ("Debugger")6 R( U1 {* A$ u% e' v; h7 }6 y
  69.                         {
    ! y. W5 N, m! C. m
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    # l* }! C) M2 w
  71. + j  a/ P2 K% \
  72.                                 /*' C) T/ i$ z8 p; C) X1 I% _* ~% ]
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

4 @; u( S2 O. w" r2 D; d; M/ {
; @$ O5 L0 E5 T/ s0 K; Y6 I6 o( d
& X' K5 Z0 ^3 y% x
商业服务端 登录器 网站 出售

15

主题

256

回帖

1268

积分

金牌会员

积分
1268
金钱
871
贡献
121
注册时间
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

回帖

1268

积分

金牌会员

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

3

主题

102

回帖

6481

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-12 08:17 , Processed in 0.066311 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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