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

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

[复制链接]

149

主题

294

回帖

5195

积分

管理员

积分
5195
金钱
1666
贡献
3086
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) . H  I1 F, M5 m) {% ?7 J( z7 B3 f$ [

7 c+ ]7 w4 I$ s0 u4 p/ m" N虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
$ E3 u: t7 p: A/ ]8 X( ~, i3 R4 v2 x4 B* m; ?. _( I+ S8 ?
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    0 G" l" Y) X. I
  2. //
    , r' K& h# c% [$ L) A
  3. - \& F6 [6 y8 P( {" B
  4. #include "stdafx.h"& o1 P: L* h. j: d
  5. #include <iostream>6 k1 v! b8 g9 x9 H$ m9 z
  6. #include <Windows.h>
    2 I/ Z2 I+ j6 @( T# U" F# G
  7. #include <io.h>
    3 v+ C9 Q  r2 v7 s
  8. 6 ]: P! R/ _# u* _4 B2 p
  9. ; v% W* j% P# |; M
  10. int _tmain(int argc, _TCHAR* argv[])
    1 z  d" f. [  p- Z
  11. {
    " r/ L- {: j# C& K. i- |$ g+ u! b- z
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    1 i( Y, i  |- b) f6 r3 \
  13. & h+ j% r/ E2 i6 W; }: H+ X. y& g
  14.         //查看文件“DekaronServer.exe”是否存在
    $ X# U' U( Q4 a8 k) o& c% q
  15.         if(_access("DekaronServer.exe", 0) == -1)
    $ z: ?+ F! I% H; ?
  16.         {
    0 o. n" U$ U+ H* n% G" b% u
  17.                 printf("DekaronServer.exe not found!\n");
    5 \/ s5 L: \3 f& @2 \2 I% b0 Q
  18.                 printf("Program will close in 5seconds\n");
    " @7 ~6 Z. W% w& l
  19.                 Sleep(5000);
    ! w7 U# q$ Q1 `0 S6 ?$ Q) B, Y" u
  20.         }
    * R, b( \7 k7 e9 S$ i/ C
  21.         else
    ; F8 t5 ~& G% j; N. h/ [  b
  22.         {- k$ w9 g& L. ~& H" G- m) J( g0 n
  23.                 $ k; p+ C* V9 s2 _
  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
    1 L$ Q( [. |8 a8 h6 u5 }
  25.                 STARTUPINFO si;
    ' N: o3 D5 ^3 N0 Y
  26. % d+ f' |' b7 I9 O
  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).aspx3 O. ?1 w! q# M" ?* Y7 C
  28.                 PROCESS_INFORMATION pi;' n7 R4 R1 k/ y$ Z. l( v5 U& l

  29. / n& l4 D% o, o- x
  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
    : G( y- h, y* X( X) X8 X# ~
  31.                 DEBUG_EVENT dbge;
    ! I2 H$ m9 n& Z4 c$ ?2 |- ?
  32. # y9 y5 Q% ]# u! k8 k) t
  33.                 //Commandline that will used at CreateProcess4 e, U( H( |9 S/ Z8 S
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));: t8 W' ?0 W* C' W5 x% Q/ s

  35. , H; y0 q; f  e4 @! Q' b- T
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)0 A0 G7 Z7 v1 m9 ?, R7 x
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)+ E& O2 m1 i9 [
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)$ E$ F+ n& V& v& e, K5 O6 _. R

  39. ; G- I0 t! I. Q$ a
  40. # E' T& k  G3 ~

  41. 6 b4 T( F- Z$ M5 Z0 V# Y
  42.                 //Start DekaronServer.exe ! l4 n+ q* k  ?, }. Z
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    7 I8 y5 A6 X. E1 Y) {4 i
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    " L! {! }/ o, Y& _# |9 V
  45.                         szCmdline,        // Command line
    ) N( \) e3 `, e5 U1 i& [
  46.                         NULL,           // Process handle not inheritable
    2 p# q7 [( ~& S3 u' H9 Q
  47.                         NULL,           // Thread handle not inheritable
    , c& F! a$ {- n0 h5 n
  48.                         FALSE,          // Set handle inheritance to FALSE
    % J6 ]' ]5 Z; k) N
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    6 C6 @9 A/ x4 D! W' u
  50.                         NULL,           // Use parent's environment block
    - |; l% S1 \, z- u8 }5 K
  51.                         NULL,           // Use parent's starting directory
    + N1 }: ]7 H  X2 e( R6 |% N$ z
  52.                         &si,            // Pointer to STARTUPINFO structure
    # M+ S* l8 D1 a- E( l7 P0 P
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure4 ]: }4 G) Q9 F, W3 o* W+ u
  54.                 ) % d9 g8 D2 b* m% B
  55.                 {
    2 C7 i$ j# c; u' @9 o
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );& |1 k" i: X) _6 u6 h" o5 A
  57.                         return 0;
    # ?( S7 r6 D+ N4 J+ A# w
  58.                 }2 }: d8 u# x' }4 Q1 J- g
  59.                 //Creating Process was sucessful- M0 S6 g9 d0 @% U. H/ v$ ~- I( J
  60.                 else, I; G$ M/ P# z
  61.                 {
    . q" \4 y8 o( M" o
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    $ i7 w1 \* ~/ L6 ~
  63. % }% Y* I5 @7 `$ C: M
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure% H3 e3 C! i5 o. P% \% w
  65.                         dbge.dwProcessId = pi.dwProcessId;
    " _% o3 W6 q4 }" e1 j
  66.                         dbge.dwProcessId = pi.dwThreadId;
    5 k& t7 ^* K; r

  67. 8 h0 G# ]7 k% M- m8 h0 T$ N$ y
  68.                         while(true) //infinite loop ("Debugger")
    8 G: h' ~/ e4 x+ l8 c- E
  69.                         {
    / Z8 f) v: k6 E+ x% b' z5 K6 a
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx) i+ T* \5 z+ }% I

  71. 8 E  i4 R4 e& r9 p! n$ {0 c0 v
  72.                                 /*
    0 L/ q' I/ n2 [6 s$ M6 m# |1 Z
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

$ X3 B4 w  z. A9 [. S0 p* m( ~8 Z5 |# a2 y
6 [' ?: ~2 w  a* }
商业服务端 登录器 网站 出售

11

主题

245

回帖

1124

积分

高级会员

积分
1124
金钱
712
贡献
151
注册时间
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

主题

204

回帖

340

积分

中级会员

积分
340
金钱
133
贡献
3
注册时间
2024-5-14
发表于 2024-5-14 15:56:57 | 显示全部楼层
学习学习赞赞赞

11

主题

245

回帖

1124

积分

高级会员

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

3

主题

97

回帖

3919

积分

金牌会员

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-9-19 22:17 , Processed in 0.049874 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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