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

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

[复制链接]

154

主题

343

回帖

5865

积分

管理员

积分
5865
金钱
1837
贡献
3531
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
! ]7 E) L6 ?. e$ q# V! G
3 Y5 s8 Y1 ]4 K- W4 d+ t! ~# i虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。+ @8 q3 F/ Z7 L8 G/ G5 i
* a9 n$ ]# G+ `1 b- w# U" J) U" {4 F& I
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    2 n9 H) q, k% {1 C# S: T
  2. //
    + b+ j& t7 q% K; g9 I6 c2 @3 d( b

  3.   V! {0 l  G0 \# Z3 g% c
  4. #include "stdafx.h"' O& p6 v7 Y- ~+ f0 n
  5. #include <iostream>
    8 k+ |' v+ {; Y2 D$ Z$ f2 n, C( l& h
  6. #include <Windows.h>1 l& E% i4 |: z* l9 x, z5 v
  7. #include <io.h>
    / Q8 N) g* F! x3 ?/ C4 f3 \
  8. $ ~7 \. _! ^1 L- I0 Y' ~

  9. 2 i  N/ L3 \% I$ A8 ?
  10. int _tmain(int argc, _TCHAR* argv[])) B. s) H6 m8 O: r: R9 f3 b, R
  11. {
    . A  B7 l( @( [! ]) u5 B6 _# @
  12.         printf("Dekaron-Server Launcher by Toasty\n");+ G" i  M; ?/ ~

  13. 2 e# C2 R. ^( p$ O0 E( e
  14.         //查看文件“DekaronServer.exe”是否存在2 F- q2 g3 x+ {1 L  S3 H
  15.         if(_access("DekaronServer.exe", 0) == -1)
    8 u& f8 D5 [, M! w0 _
  16.         {; c, W1 Z4 d0 v4 A
  17.                 printf("DekaronServer.exe not found!\n");
    8 p: H% O6 R# P  z) n* |$ h
  18.                 printf("Program will close in 5seconds\n");
    0 H( k0 m& J# c: r& Q2 e0 ^" M0 n5 a
  19.                 Sleep(5000);, M8 @1 X& i% R5 t/ W1 B# V
  20.         }1 @& p! |* G  `) f% j# ~, i. Q
  21.         else
    . S4 b: }+ z" Y& H& P
  22.         {+ U$ s! v& {& d( t2 x& T+ f
  23.                 5 y7 u" }1 _4 t6 m- ]& t
  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).aspx6 l0 ^/ f. s, ]% [; k8 x
  25.                 STARTUPINFO si;4 j; A1 E, ^9 i. Q5 p
  26. 4 k2 ?1 L1 r$ J" {( j( b
  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! [" P( Y2 {' k+ S6 f9 z5 g6 a# [
  28.                 PROCESS_INFORMATION pi;1 @5 R' {6 ]6 b" B! Q

  29. & s8 N1 A1 N; j9 @- g0 Q& I" _$ Z
  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
    7 L4 H& ]4 y8 v  X2 P$ h2 k6 |
  31.                 DEBUG_EVENT dbge;
    % _" z: a7 I/ P, ]
  32. % y+ r1 I1 x+ e8 e* K) F
  33.                 //Commandline that will used at CreateProcess
    . `  V" z7 F) F0 R8 v4 q2 A
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));, f5 z7 u1 u3 Q5 a* t. N+ F4 K

  35. / |! N7 y5 m- E% h' `
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made). ?1 a  P" r% f1 z! z1 x5 v
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)5 @. F5 `6 y7 E% `3 P3 v
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)% {, T& F0 }. m% A" i; P

  39. 0 X4 R; B5 D6 P" r( S5 c8 Y

  40. 4 A1 s2 m/ t) {8 Q3 ]& Z' {4 Y
  41. 1 U4 V5 b( @. q$ V+ o
  42.                 //Start DekaronServer.exe + H& Z$ y2 v" k6 n/ U- C
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    ; `" F+ k, `5 P, j6 m; v
  44.                 if( !CreateProcess( NULL,   // No module name (use command line). P( f" @' e: N# v# r" K! n+ _
  45.                         szCmdline,        // Command line
    ; E( Z9 x1 J2 c. n6 n7 f
  46.                         NULL,           // Process handle not inheritable+ f% N( M  y6 Y. }, z# g  A, ~1 z
  47.                         NULL,           // Thread handle not inheritable
    1 X% @* f, [. V/ m# B1 m
  48.                         FALSE,          // Set handle inheritance to FALSE8 x6 A0 Z7 G  v% \/ X1 u7 a* ?
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    6 ?  {7 I7 V* F! ]/ P
  50.                         NULL,           // Use parent's environment block3 t; c4 g5 @) k) A
  51.                         NULL,           // Use parent's starting directory % x3 A& ?1 ^7 _  t* o& g4 U
  52.                         &si,            // Pointer to STARTUPINFO structure/ E* I9 j- N. y+ v1 ]
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure" k* S! ~7 \* p  o8 q7 s
  54.                 )
    5 Y1 A, H0 p5 V  q5 z
  55.                 {
    ; l/ J8 M3 ~4 M% [: j
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );  e" j8 z9 U, r' \* v8 |
  57.                         return 0;
    6 Q9 C2 n- u5 H, o/ [1 L: `5 T$ y; F
  58.                 }
    3 d# G9 z. x7 E" ?7 @3 P3 W
  59.                 //Creating Process was sucessful
    : b0 G, M5 @5 X/ J+ r. P
  60.                 else+ n6 I; u- s' _" o& E
  61.                 {; J$ q. I# y/ Y7 @% m8 ?0 q7 M
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    $ t' h: ?7 z& d# L$ w/ q# ~

  63. 6 b& n: P% ^. Y, x
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure+ V7 X0 \  j. I% t7 l) z
  65.                         dbge.dwProcessId = pi.dwProcessId;
    ( l$ S2 Z' H# s3 j
  66.                         dbge.dwProcessId = pi.dwThreadId;
    # e# S, c  _& V6 X1 ^

  67. 0 ~. Z& T0 Q% V( o2 a
  68.                         while(true) //infinite loop ("Debugger")
    ! U8 S; J' ?; T) Y4 i# i3 M! v
  69.                         {
    + r) u3 a0 w1 _; m" Y% Q" {
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    4 q: _2 W* {" h4 G+ e4 ]

  71. 8 [7 z/ `6 e/ M! [
  72.                                 /*5 A% E; g# \- C- k
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
9 b. w* r, k7 q. J

/ R' h4 m& F- }2 u% F0 d2 \$ X6 P& `  \# q# f2 h9 F1 D* b
商业服务端 登录器 网站 出售

13

主题

251

回帖

1255

积分

金牌会员

积分
1255
金钱
800
贡献
186
注册时间
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

回帖

1255

积分

金牌会员

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

3

主题

99

回帖

5413

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-12 02:15 , Processed in 0.071900 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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