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

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

[复制链接]

157

主题

367

回帖

7122

积分

管理员

积分
7122
金钱
2045
贡献
4553
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
6 f: `8 O- h4 W. V- a5 V" P: h$ w; s3 h' ~' S7 o
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。* O. y5 S  i0 T. U$ T

- O5 P0 G0 m% K! F7 \
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。3 ?) ~+ j$ a: O. k+ u
  2. //
    " c5 A( A) }' X+ [' R: J

  3. 1 f2 V( H; x; G7 F8 S9 J7 K
  4. #include "stdafx.h"
    9 y" U8 |- ~( M
  5. #include <iostream>
    ' \0 I0 u0 i/ w* j2 d& g6 W2 D
  6. #include <Windows.h>' K7 e! f9 h% A8 M/ P+ O. ~6 Z2 h  M
  7. #include <io.h>+ I, n& X9 D( ^
  8. 0 @6 z. b9 W/ {9 Q) G* _/ P( q. c

  9. 7 Z+ Y$ ^) `3 U6 \
  10. int _tmain(int argc, _TCHAR* argv[])6 \- o+ X8 A8 S# `4 E
  11. {
    9 ]3 X9 c" ]6 @( d
  12.         printf("Dekaron-Server Launcher by Toasty\n");" m0 _# S6 g% ?

  13. " Z. ~5 g! D  O4 G$ C- A) T. y/ J
  14.         //查看文件“DekaronServer.exe”是否存在* h# v/ z2 C5 x6 j- z8 [  V  m2 _
  15.         if(_access("DekaronServer.exe", 0) == -1)
    6 U% [8 D4 F2 P( {5 E" {2 d
  16.         {6 Z8 f, g" c( F# B
  17.                 printf("DekaronServer.exe not found!\n");2 i  G# s' \. L5 w
  18.                 printf("Program will close in 5seconds\n");2 N/ h0 q2 C& u7 m- G: K
  19.                 Sleep(5000);
    3 j6 }$ _5 y8 Y- o% ~
  20.         }
    , t5 c1 I+ m& J
  21.         else
    ; u5 r4 M. D0 b: T7 X
  22.         {
    + n$ ?. \+ {' ]
  23.                
    1 d  ^, n2 ]% M) I' }  @4 i) e
  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# U$ Z, Z2 O" J6 ?
  25.                 STARTUPINFO si;( m% t$ L% E- m3 f) N6 Q4 F1 B

  26. . T1 W' `  K: P# @9 U6 i
  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
    9 y5 W; G- z6 V& |( k
  28.                 PROCESS_INFORMATION pi;
    , q8 V+ A  k8 @+ K- P

  29. % x1 L) Q9 p8 ~* w+ I9 _
  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
    3 P/ d, g1 K* o8 M2 a& x
  31.                 DEBUG_EVENT dbge;
    . p, w' s( R8 u* g1 Q
  32. 6 Y7 Y8 L, Z# I' A: q2 j( z, m
  33.                 //Commandline that will used at CreateProcess$ M1 E% T5 Y( c
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));5 k5 h" i% x/ W# @6 E! W) a: ]2 X
  35. 1 b5 Z- C  [7 C8 I$ m/ C
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)1 v* d- e7 W( T2 c/ h& u
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)1 K: B" S, j  l/ a1 q
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)* c' m+ n# k6 R* A8 ?

  39. 4 ~* Y* N4 |0 g0 p
  40. 9 K+ z" p3 W  \- \" y$ @+ _
  41. 2 {6 l, G, U; }0 w- i5 t7 I3 E
  42.                 //Start DekaronServer.exe ' E) y/ D. H7 J; a7 @5 E+ e2 Q
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx+ Y/ @5 {9 ]: {) Q  \3 ?; g
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    5 Z% n- G7 C" ]. C5 H' g0 J- P0 U
  45.                         szCmdline,        // Command line
    & c: B5 I- b. K; [3 u& C8 v
  46.                         NULL,           // Process handle not inheritable6 [1 B! w+ u' G3 B& F' H
  47.                         NULL,           // Thread handle not inheritable  R  J! Z7 |6 B7 m) b
  48.                         FALSE,          // Set handle inheritance to FALSE& T" ?9 a2 b+ t/ I7 |  X" a
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    1 g( p8 D8 A( c; F$ c) V
  50.                         NULL,           // Use parent's environment block
    $ d; n' g8 m+ e& M: x) Y
  51.                         NULL,           // Use parent's starting directory
    4 g: e3 e- ]0 n1 e- Y( E1 B$ e
  52.                         &si,            // Pointer to STARTUPINFO structure
    ! Q0 o' @- }0 M$ _% E
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    * y( [: z" A% W6 M8 A0 f* T& U
  54.                 ) 6 |0 W; ~; b) m/ K+ M* g% G) A
  55.                 {
    6 Q+ S8 n5 \8 Q4 y. S. @8 s; h0 T
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );0 [" |# ~5 p0 O" d6 w
  57.                         return 0;
    / r4 g/ R( R1 M' S: Q/ M  E
  58.                 }  V4 m4 c, }; v6 _) m2 f. n
  59.                 //Creating Process was sucessful
    4 E% K2 V) ~/ s+ f+ t0 E
  60.                 else. Z1 A+ p- T% x( o) l+ C
  61.                 {! N/ ?3 i' T' E/ i/ P5 M
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    : U+ C/ ?4 b% r& B3 l
  63. + T0 z3 O+ r3 z
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure( N& x. G$ ?5 a
  65.                         dbge.dwProcessId = pi.dwProcessId;" x' l/ ?' P7 r* I/ y- _( n$ H" }
  66.                         dbge.dwProcessId = pi.dwThreadId;
    2 [* r! ^  i8 l* F5 `: u9 i

  67. 8 u; k* s* R+ f+ X, K: T
  68.                         while(true) //infinite loop ("Debugger"): r* a) ?8 ^3 d
  69.                         {
    5 ^' s4 r, {  Q; P
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx, t! |" l; |' p9 C! t' P

  71. 9 e$ Z; m+ n/ k+ o: a& B
  72.                                 /*$ x# i3 q. Y* M' P3 z
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
) G- j# ]  V  ~$ D/ [& G- n

8 v( b, q. i8 y, ]9 Q
+ x( \8 I) z1 c4 R
商业服务端 登录器 网站 出售

15

主题

258

回帖

1245

积分

金牌会员

积分
1245
金钱
903
贡献
64
注册时间
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

主题

258

回帖

1245

积分

金牌会员

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

3

主题

102

回帖

7377

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-4 14:46 , Processed in 0.046693 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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