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

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

[复制链接]

160

主题

385

回帖

7389

积分

管理员

积分
7389
金钱
2121
贡献
4723
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 1 C/ y  \8 U. s: m% z( n) Z
; F2 K$ X; [' ^3 l; B$ Q" H- [5 S9 w
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
2 U9 a+ t* E# |0 R
& [2 T8 p) P, {- K' w7 n# W3 H  p
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。1 n+ Q' I# x2 y0 z; g2 ?
  2. //0 ^7 ]+ y9 S" w8 u
  3. # k. x* h" q$ G; S
  4. #include "stdafx.h"+ Z* ~  r  G6 U" M# C5 B4 _" o4 e
  5. #include <iostream>
    % K0 j( l! D1 F. |3 A7 r! m
  6. #include <Windows.h>
    # _" u9 _, h8 C3 A0 a, m) |
  7. #include <io.h>$ N8 N! f1 ?( w+ A' b2 A

  8. 6 M) e/ A7 r" ?! N% B

  9. " O$ l! b* J* t0 l& H6 a) @9 L
  10. int _tmain(int argc, _TCHAR* argv[])
    8 I% A+ ~% D# t0 n
  11. {- V9 D* M1 t& n+ M
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    7 G% W, f: r" A( y6 X: n

  13. ; v5 s- c3 s. ?/ {- V
  14.         //查看文件“DekaronServer.exe”是否存在, H& W7 x: ~" d) ^5 d' X) R
  15.         if(_access("DekaronServer.exe", 0) == -1)( C& f6 j+ h5 s$ N
  16.         {- t6 K7 g0 E& U
  17.                 printf("DekaronServer.exe not found!\n");5 _1 K- v$ }$ ~1 \8 Y- s0 |3 t2 }
  18.                 printf("Program will close in 5seconds\n");- R) b. n$ J, {9 ^( H" e6 k" R
  19.                 Sleep(5000);
    8 Q' ~1 A5 Z( b: [' p+ _; Q
  20.         }
    ( X1 F) M0 [. _  m
  21.         else# ?1 Q$ A5 Q7 c# t+ ?* l' N1 X& c
  22.         {  j/ c" l8 B) N! J# y. p
  23.                
    $ f% I& g7 I) i$ J" o7 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. p% L, W7 d, }+ |0 I; M" D" _2 f
  25.                 STARTUPINFO si;4 c% A" |6 g  V5 w# V2 m* d

  26. . ^. h6 F+ L2 s* ~0 i5 B0 M
  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+ Y( E4 Z6 T1 C. `' U
  28.                 PROCESS_INFORMATION pi;1 D" \  e! n, P& g% p
  29. ' v5 ], K9 `8 k; W3 ~( J2 S
  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: X3 p5 M! }* P  U
  31.                 DEBUG_EVENT dbge;
    7 }# ?4 h& y$ M. Z) I. z

  32. 4 Y# L/ u* ~" E2 [0 q, v6 I& ^
  33.                 //Commandline that will used at CreateProcess
    1 u; j, L+ y6 c5 a5 m
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));/ @: U, p& c- q2 z9 U! n
  35. , H/ ]: t# H7 e4 j
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    0 J3 B3 O( F' w! a/ }7 S! H. z
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    ( x3 v+ ]' x0 |. ]; E$ G1 _  p
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    ' q4 w' n. G( G# _' f% I

  39. . I/ \) w6 z  A& `" ~0 R

  40. & O- ^3 w2 N' k
  41. - d% i) K1 o- c. {) E' I
  42.                 //Start DekaronServer.exe + @% x+ H; n, X
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    3 w8 B$ E$ S1 m* G% u, P3 Y9 W
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    * ]  y: t4 B/ s
  45.                         szCmdline,        // Command line
    - f: I% _* d# q- J% t' M, `0 J% D1 T8 b) q
  46.                         NULL,           // Process handle not inheritable
    ) d" i) ^4 r; T
  47.                         NULL,           // Thread handle not inheritable
    8 ]- _  r/ M- z# U  C, _! y
  48.                         FALSE,          // Set handle inheritance to FALSE1 ~  R' [6 [: e+ }- O
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    $ h2 E% b$ Z- l- t) {
  50.                         NULL,           // Use parent's environment block
    " c" R1 L+ W( D# N+ l+ Y+ [
  51.                         NULL,           // Use parent's starting directory 1 `0 _4 M4 {/ ^7 r5 B4 r
  52.                         &si,            // Pointer to STARTUPINFO structure7 e4 B/ ^& o3 A% X! h$ U& @
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    ! T+ Y$ c7 l: A5 ]+ E
  54.                 ) 2 t1 `/ ^1 W- h/ L2 p. x
  55.                 {! ~# P0 g" T# }8 P
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    . l: m% p4 ^5 a
  57.                         return 0;7 s# Q* ?: K0 g( ]
  58.                 }& l: |" J) H4 n" L9 g. S0 k) l
  59.                 //Creating Process was sucessful
    ' t* e$ Y8 f9 o( u8 R$ s9 }( j# C7 [# @
  60.                 else" {, P4 c! R+ E$ w) {! q
  61.                 {
    # r+ v7 O$ F# m$ n# }) X
  62.                         printf("Sucessfully launched DekaronServer.exe\n");9 V7 e5 O: G6 g) f% P8 }# o' p
  63. ) M; j- ]6 y+ t3 }5 I$ j0 ^
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure* v' H2 {0 v; Z
  65.                         dbge.dwProcessId = pi.dwProcessId;( k$ V. H& o8 A+ }$ [4 ~$ V
  66.                         dbge.dwProcessId = pi.dwThreadId;' L: n2 ~# G0 N$ r7 m
  67. " ~- }4 F* H3 B( A7 M  e
  68.                         while(true) //infinite loop ("Debugger")
      C9 d3 n. `) A1 ?
  69.                         {
    6 C/ |+ _( m; o! W( z5 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
    : ]" ^2 ^- l: f' c4 T
  71. : e* g9 w7 C. p6 B' ?/ }# }
  72.                                 /*3 P4 J. o# I7 g3 A
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

% e) m7 ~' k4 X
/ t! ^2 c; F2 K3 h, B+ {5 V+ D4 m) Q# @: ]# x9 L
商业服务端 登录器 网站 出售

15

主题

259

回帖

1275

积分

金牌会员

积分
1275
金钱
920
贡献
76
注册时间
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

主题

259

回帖

1275

积分

金牌会员

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

3

主题

102

回帖

7797

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-26 11:02 , Processed in 0.036303 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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