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

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

[复制链接]

155

主题

346

回帖

5944

积分

管理员

积分
5944
金钱
1856
贡献
3587
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) # [9 M2 v! d1 l3 O) X8 W
, B4 i+ }' j2 H% o) Y
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
/ i$ C0 d; T1 [% ]& T
! u9 `3 c) |, e- T0 B! C7 b+ x
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。/ l/ U0 y4 T: X! U' |2 |# e8 c
  2. //
    7 n2 H. ?7 L# m; q1 h# a

  3. " o$ r, x( c; K# P5 ^
  4. #include "stdafx.h"
    ( D% L8 ^! R9 [' f. g
  5. #include <iostream>0 z5 f' r7 B4 ^0 l( T  t3 u
  6. #include <Windows.h>9 \5 G0 h. e6 {9 i2 p1 H9 h
  7. #include <io.h>: u- g1 {' m& c3 ?, i) [' y& K" P; q
  8.   H; E; n& A2 y  z

  9. # K; P4 t1 k# P4 X" q3 H! A, g: _
  10. int _tmain(int argc, _TCHAR* argv[])2 h2 Z* D' k4 o. i' d/ U2 n
  11. {
    * q2 }- H' g" i6 V2 {9 s8 t; r
  12.         printf("Dekaron-Server Launcher by Toasty\n");3 p( B. D; L4 M/ n

  13. - N$ T& S* @& A  W3 v' T
  14.         //查看文件“DekaronServer.exe”是否存在
    - G9 @6 S- X; j
  15.         if(_access("DekaronServer.exe", 0) == -1)
    # ^! u3 B7 m% _3 m2 e0 N% d
  16.         {0 D9 {) Z$ z+ `9 b# j
  17.                 printf("DekaronServer.exe not found!\n");
    ! {/ Z( W- U% a0 ?' X7 B
  18.                 printf("Program will close in 5seconds\n");
    - j3 A, G) _6 r! J
  19.                 Sleep(5000);2 H+ }# H% i& I) X( R4 `
  20.         }  d4 s! z6 e$ E  @/ q. r& x/ z
  21.         else
    4 J9 ]8 P& z  Y. u
  22.         {2 X% j, O" P# t* v
  23.                 / u! Q1 `9 ]/ U3 G% c$ a
  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
    6 E0 B0 C% n6 a/ \
  25.                 STARTUPINFO si;
      a* [' W5 C% j* ], j+ \- {* c. B
  26. 7 @  e* s* L8 G! z: g7 S7 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
    , F( `9 |: b  K2 }+ x
  28.                 PROCESS_INFORMATION pi;
    / `3 N0 `- R6 G& s1 J  s

  29. 9 W$ n' H6 e" u+ z3 t; i" M
  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- z3 U( z  a6 F. q4 ]- `
  31.                 DEBUG_EVENT dbge;/ X9 X; O/ E  E& G* F
  32. 5 R, z  z* t+ D  T
  33.                 //Commandline that will used at CreateProcess
    3 z3 a, ]( [9 i" x6 a5 C5 E) l
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    $ n( [4 ^& e) n$ n4 v
  35. " c5 H' ]9 {( C& Z
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    , |( D, Q  d, t/ ^2 v, L) ~$ c* |
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)  K& G' B+ q6 a. F
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    6 ~" n# l# k) _9 q2 X7 N: s
  39. , x5 N* P3 |1 F8 N  n# B& @/ S
  40. 0 g/ `' Z# ^2 G7 i& l
  41. 4 v1 d5 _- h6 w# X
  42.                 //Start DekaronServer.exe 0 x0 J0 K3 O! I+ e! G- _
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx8 }* U6 o5 s& j& |
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)( h* U: ]! o5 J) g
  45.                         szCmdline,        // Command line5 f1 C; E6 v( c1 F& ~. a; l  F4 W
  46.                         NULL,           // Process handle not inheritable- u7 r: p" |7 W9 L  Z
  47.                         NULL,           // Thread handle not inheritable' q3 F  {+ \. ?  z
  48.                         FALSE,          // Set handle inheritance to FALSE
    ) T, w" V2 f' s8 k; Z% y
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx, ^/ `) v9 M- @) F" D, ]& j, J
  50.                         NULL,           // Use parent's environment block
    : d4 N' I6 }( k
  51.                         NULL,           // Use parent's starting directory
    , W6 }9 o$ A" J' W( D7 R
  52.                         &si,            // Pointer to STARTUPINFO structure
    " `2 h" h% [' C
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure' E% f: S6 s. F$ F  a# X
  54.                 ) ; H& i% b6 B" R7 E/ ?: L4 n
  55.                 {6 f0 I6 _6 I8 L" U) B% T
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    . [  {! s0 R0 S+ k; _! J7 x) @8 N
  57.                         return 0;. h# _$ M' ~- x
  58.                 }
    2 _1 X% j$ @5 I7 B  G6 Z( F* r: ]% H
  59.                 //Creating Process was sucessful
    6 g3 G: s! l2 C2 C) z& O
  60.                 else" i4 }# O7 C8 {, P
  61.                 {
    & I: i; F: B6 h( Z
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    # N9 j6 {, Y8 B
  63. . i* G+ v; D$ k4 d+ l% I
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure7 ?) ^  ]) W1 S  b* J' ^
  65.                         dbge.dwProcessId = pi.dwProcessId;
    ( \0 p' x, A; s# w7 t7 H- X: q
  66.                         dbge.dwProcessId = pi.dwThreadId;9 q: f8 D. Q- {6 A) a3 m

  67. # a7 i, E+ [9 U. {" E; D0 A
  68.                         while(true) //infinite loop ("Debugger")
    ; Q7 Q& s1 J% K, ~
  69.                         {& g$ y6 D$ Q5 A* H2 T1 Y
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    ; |$ x6 \# ~" ?( X7 R* {/ q
  71. ! \8 T( M; ?: M9 H+ D( {2 ^  @" y
  72.                                 /*
    ' c2 u7 e5 v4 K2 i1 C+ B7 U
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
2 B' W9 a3 x; I. [

$ H* ], d/ a3 U- [7 ~
: f( U+ K3 n2 n1 g$ q$ Y
商业服务端 登录器 网站 出售

13

主题

251

回帖

1233

积分

金牌会员

积分
1233
金钱
808
贡献
156
注册时间
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

主题

251

回帖

1233

积分

金牌会员

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

3

主题

99

回帖

5653

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-23 18:34 , Processed in 0.078445 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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