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

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

[复制链接]

154

主题

340

回帖

5821

积分

管理员

积分
5821
金钱
1830
贡献
3497
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 1 ~1 Y) _% M0 R

: b* ^% z) U# I( l& }' L虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。/ |) f) A9 a3 L$ _

, Q, h2 I$ x1 W# J/ r; C; j  @
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    1 \# e" o$ Z' w* @
  2. //
    7 X' w* z' b- e  A" ~$ t

  3. : L8 r4 s! E; n
  4. #include "stdafx.h"- J. \6 }# b: _* n+ w6 P& j
  5. #include <iostream>
    8 {. i9 O5 r6 d; c" t, [' U5 g1 F
  6. #include <Windows.h>$ h8 g( m& Z4 p  S( ]9 ~4 D
  7. #include <io.h>  [* f) R# s1 U2 u# `3 ?4 N

  8. ; F$ B1 E; n- a/ c6 s# r& @

  9. 6 b8 ?/ d# l! _# z
  10. int _tmain(int argc, _TCHAR* argv[])3 g/ z. ~7 q9 H1 x' \1 T$ ?
  11. {
    % y5 {; e! F8 F6 l$ V
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    ) w0 \  O& V# W: Z

  13. 2 X7 q8 k, r8 |( l
  14.         //查看文件“DekaronServer.exe”是否存在
    . v+ y1 y  i+ g1 l
  15.         if(_access("DekaronServer.exe", 0) == -1)  d& m$ [1 }6 C
  16.         {, x" q# q( O: d2 Y$ X
  17.                 printf("DekaronServer.exe not found!\n");8 p' `' L; I1 X4 ~  d: m& M
  18.                 printf("Program will close in 5seconds\n");! z5 ?  h8 K5 k9 Y1 T& n* u
  19.                 Sleep(5000);
    2 z- P9 v4 P" ]& m! G
  20.         }8 V3 l# ?8 ?- }* u7 t6 K
  21.         else
    0 F/ f& r7 r: J* Q: _2 g
  22.         {: ^; [, U, _2 j; p5 [5 h: w. V
  23.                
    6 B  A7 j4 _* A! Z# t( h- g3 B  u1 a
  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
      o( W& d  V! K/ t! T& x0 [. b
  25.                 STARTUPINFO si;
    8 _, x2 G0 _  Y( s* G  }
  26. - O5 x; V  M, L# D! L' K% W4 w
  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
      H% \, B4 i" b2 l# q2 G6 G# R
  28.                 PROCESS_INFORMATION pi;
    ; N( T/ z: }( e2 d% R

  29. # v/ _: _. E9 v! s/ f
  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
    ( G0 t) e# S8 [' v
  31.                 DEBUG_EVENT dbge;- s* j' o/ `3 B3 d" q' R) p
  32. 8 ~: W6 T. m4 F7 Y/ A& P* v* g
  33.                 //Commandline that will used at CreateProcess
    ) d+ A5 o" x3 s. _  Q0 K% G  n
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    $ i' k0 f8 l% H) Z7 `( o" D8 k
  35. 1 n! N. |1 @# R5 Z& T
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)$ D6 l1 ~5 i  z; p( P; y1 x! v
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    4 q8 @' a' z) Q/ V$ i' T
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    / |; L% K- P8 M

  39. 0 U5 K  J& Z" o9 m2 b

  40. 2 \# x4 i/ m7 ~, `% I
  41. , n8 B6 f2 _' c" Z
  42.                 //Start DekaronServer.exe 1 X/ `( [' l; t- u) |
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx: D5 [+ [2 p; ^6 d5 C
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)2 R* t: I' g, }. e
  45.                         szCmdline,        // Command line
    & a% }) U: w8 ], R! n0 t% A8 G: o
  46.                         NULL,           // Process handle not inheritable
    " u: B3 p# j. p& N4 B( r# W
  47.                         NULL,           // Thread handle not inheritable
    7 s; w! k0 ~9 H+ l. c/ i" T/ A
  48.                         FALSE,          // Set handle inheritance to FALSE
    7 G. Q  \1 Z# ~- y+ U: R! U2 ]
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    4 f% B5 K$ P- G
  50.                         NULL,           // Use parent's environment block
    # P. K* C; W( \. M7 \) p* `+ W
  51.                         NULL,           // Use parent's starting directory 7 u) D' f* V6 |6 c* \
  52.                         &si,            // Pointer to STARTUPINFO structure
      s8 m% N8 Y1 G5 H) p5 D# F1 ^
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    / z3 h/ S. m4 J( D- i
  54.                 )
    3 q+ e  ^- j, X) O! A4 h" T' i
  55.                 {- ~) P$ z  I& F2 [0 @% o
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    1 B9 U* \& Y# t
  57.                         return 0;) ~, ~" d4 x0 w- ^  h% J7 w
  58.                 }
    $ p8 ]: x: p- b' l
  59.                 //Creating Process was sucessful
    " J" j% r( v; N0 {3 a. @. E
  60.                 else
    " p( Q2 W7 f9 b0 [' K/ Z' L0 T7 ^
  61.                 {
    * e/ O6 ]8 Q1 V: f8 ]4 ?
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    7 H8 Q+ ^1 L: ?  O

  63. 1 m7 F3 q) U+ I
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    / o( s0 v$ A1 E! A  q. m. i
  65.                         dbge.dwProcessId = pi.dwProcessId;8 I0 q( E* u" H' d% u4 t: `( E: x
  66.                         dbge.dwProcessId = pi.dwThreadId;
    0 v2 X' Z% F( A' ~" I

  67. 6 y+ r! I- j" C! G  P/ N! n4 `
  68.                         while(true) //infinite loop ("Debugger")! o* z* C/ G4 }1 V, Q
  69.                         {
    , q3 h. e( k2 s( o. E7 X4 l
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    # G/ S+ j8 V1 K. q7 Q7 X9 n

  71. 9 \% y' U; ?) ~% J' m
  72.                                 /*/ D. j* ~& q$ O
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

3 I) B! Q! W4 i& |- o5 z9 z: T/ s! z4 ]
+ V# t: ]1 c6 m" G+ x9 E8 H
商业服务端 登录器 网站 出售

13

主题

251

回帖

1249

积分

金牌会员

积分
1249
金钱
796
贡献
184
注册时间
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

回帖

1249

积分

金牌会员

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

3

主题

99

回帖

5353

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-8 21:06 , Processed in 0.060413 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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