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

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

[复制链接]

160

主题

384

回帖

7382

积分

管理员

积分
7382
金钱
2118
贡献
4720
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
$ u" ]* R5 t( r# F1 }% T
& @) Z$ d& x5 o6 T虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
# ?# a$ w4 [/ B" g. ~& ~$ C! _% M2 J6 l2 h/ K0 O: ~" V$ l. z
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。: Z- t$ I+ p) }% q' s9 [7 n
  2. //
      ~9 k+ J- G2 b$ L) h' E8 B0 D

  3. 7 L7 X5 s0 H& \5 K; d; b
  4. #include "stdafx.h"
    9 K: L# A3 ?8 A/ M! m
  5. #include <iostream>
    " U2 p% N( q- t# F5 [# ^
  6. #include <Windows.h>* p8 s1 f# ?# f! y. X! K4 }' o0 b
  7. #include <io.h>
      f8 q. l" X3 F8 W
  8. 4 q+ N* W: g. x7 z+ [
  9. : _: n3 m/ j( a/ v0 [( L  G7 H
  10. int _tmain(int argc, _TCHAR* argv[])6 j/ Z7 u, L( B! Y' k: D  U
  11. {4 ^$ g/ Z, U5 s* P2 k
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    ' r* J& k) r: p: f, {- `
  13. 5 W  ^5 v1 J5 E* i2 v9 @/ e; {
  14.         //查看文件“DekaronServer.exe”是否存在
    - C0 S( D  j/ \
  15.         if(_access("DekaronServer.exe", 0) == -1)1 o4 i, c/ g, k/ O4 K6 G$ }. o
  16.         {
    + s8 J) E( H* f8 ^. q
  17.                 printf("DekaronServer.exe not found!\n");& \( L1 m6 O9 \2 r3 p1 E3 W
  18.                 printf("Program will close in 5seconds\n");
    # S6 B- G0 I6 [) W" Z7 ~" z  f8 k" C
  19.                 Sleep(5000);
    ' {' r) S( o3 m. d6 f8 R! T$ R
  20.         }
    - X) t* E- ^8 L) H4 ^# k
  21.         else
    ! @7 {0 p, w4 y; u. u* p! l
  22.         {0 p% f: u1 b+ c; D
  23.                 , b( ]. R+ ?  J
  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).aspx9 I. A! {  L, W/ Q- ^% _5 z
  25.                 STARTUPINFO si;
    5 U8 A- c0 y; \. l( z  T
  26. 8 u9 k0 Y4 n0 |3 l( N; p' U! I8 l
  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- o# Q3 ^, O9 F. c1 {" f
  28.                 PROCESS_INFORMATION pi;
    ; Z# ~" G! ^6 X# L+ D

  29.   S0 J5 R1 ]& x9 l& 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$ F7 b& I: k( }# n. [$ N, k& F5 \% n
  31.                 DEBUG_EVENT dbge;
    ( x! F& z/ Z0 h- S

  32. 9 t* ~  l, H1 d0 K" J
  33.                 //Commandline that will used at CreateProcess
    . x& P8 }8 y5 c
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    5 y% b- N- ?0 F: q  S

  35. 7 \" O9 E3 I) i& k; |. Y. ]
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)* d4 V- T+ y0 B
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    0 D* @# X! {! X' ~* T
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)) Z! d1 Y* w5 _7 Y# A
  39. ) b1 a: F" @8 E8 e: e! ~

  40. 6 g" n0 B( D- y3 a3 Y% N% r
  41. . D* s3 ^" A$ `+ K2 k
  42.                 //Start DekaronServer.exe $ t/ z: U0 D& D; \* i- m
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx. ]6 C, N4 G8 @2 x: ?; K
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)" |  ^* x5 l/ P9 _  t! Q$ j
  45.                         szCmdline,        // Command line- X! R( h0 P5 ]1 [
  46.                         NULL,           // Process handle not inheritable% b7 J6 b8 \5 T3 q9 z7 J
  47.                         NULL,           // Thread handle not inheritable
    4 K6 S6 w3 D. {, o3 _) l
  48.                         FALSE,          // Set handle inheritance to FALSE
    9 i2 y- `* r& X1 ~& B* z
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx+ @; R6 ^* v6 b9 r) ~# E5 T+ t
  50.                         NULL,           // Use parent's environment block4 {. a$ z2 R+ _5 |1 ?
  51.                         NULL,           // Use parent's starting directory
    . k' Y& ^4 N. W6 @5 J. D5 A
  52.                         &si,            // Pointer to STARTUPINFO structure0 B7 B( z3 h5 Y% g
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure+ `' N. p# G5 u' e8 h3 u; D
  54.                 )
    ; i  K8 N7 P$ h, g- b$ N7 v6 Y
  55.                 {
    : [' k) d) S2 c7 ?5 J
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );7 k! Q$ P( s6 H$ c4 a& Y
  57.                         return 0;
    . e+ S4 @* g: h, k0 p& r, \
  58.                 }
    * i5 l+ d! }/ A; K2 B0 i9 b/ W
  59.                 //Creating Process was sucessful) Q; g( y9 g5 J  f  {9 P6 ?
  60.                 else
    " o# ~  p% z- x5 J1 @; U: E1 G( N; P
  61.                 {' M7 \+ V$ _! ^$ s3 U
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    % ]  l: K0 E& }, d' a" X+ H0 e

  63. ' W# w0 D1 k) j& S1 |' v# x) C
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    ( }3 C# Y, P8 H: w9 {3 x/ C
  65.                         dbge.dwProcessId = pi.dwProcessId;" Z* @" U1 w0 s" H
  66.                         dbge.dwProcessId = pi.dwThreadId;
    0 @$ w- O0 Z( B5 i: Z2 L* d9 i

  67. . C5 y* `1 I+ g& ]
  68.                         while(true) //infinite loop ("Debugger")
    ) V5 A9 _9 F( f4 L9 s8 Y
  69.                         {
    . t: k# ?+ d1 }! J* ^
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
      O; U; Q- d( g+ J) P/ {

  71. 0 K! a" \0 ]* `& d* I
  72.                                 /*
    2 {& I" s8 _/ i  e
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

( h7 y. S6 a; L% q3 ~5 Z) Y; s7 ~5 b5 j

3 p' w' G# E# F/ q; i' h
商业服务端 登录器 网站 出售

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

回帖

7777

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-25 07:21 , Processed in 0.056126 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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