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

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

[复制链接]

159

主题

378

回帖

7300

积分

管理员

积分
7300
金钱
2098
贡献
4665
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
/ t- B7 q/ A% A
+ p  i; y3 a& o. I虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
" e. X) e" f+ t$ t3 w1 X- y
: H3 @; w: h$ K2 s
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。( [+ V0 @4 f7 }" L
  2. //9 w( l: K8 P! m% F
  3. ) R% ^$ d1 y% s! G- d9 z
  4. #include "stdafx.h"/ B: `5 C" b- K
  5. #include <iostream>
    7 `" u$ e( p) Y7 r$ m
  6. #include <Windows.h>9 `  v3 f, b& q2 Q0 y6 ?# `
  7. #include <io.h>" j" P' N. m4 J# C
  8. ' x3 V" K+ s: p% c: c9 n. K

  9.   @; s3 W: {+ o( A' l0 E) P
  10. int _tmain(int argc, _TCHAR* argv[])  s- x$ V8 t6 K( m
  11. {
    5 I0 s. D3 {6 e- H* z0 x, l
  12.         printf("Dekaron-Server Launcher by Toasty\n");1 O7 I! ^' X; Q4 U, ~
  13. % n4 U: @# U9 P" X
  14.         //查看文件“DekaronServer.exe”是否存在1 [1 V4 L1 {9 u" O; z2 b3 H* O) N: A
  15.         if(_access("DekaronServer.exe", 0) == -1)
    1 b. l; m: y0 H* j2 v
  16.         {  ^6 _/ d. z7 q5 S, [+ G; C
  17.                 printf("DekaronServer.exe not found!\n");5 [' O: z0 i% F# @& Y
  18.                 printf("Program will close in 5seconds\n");
    4 G- G1 }# e, P5 L( D7 n" v; I
  19.                 Sleep(5000);
    / m8 _/ L9 w7 f$ ^& K
  20.         }
    " C1 ^2 V0 ?" @) o9 W5 ]$ ^/ {
  21.         else
    & d2 p. W0 N0 H/ h; a; |0 B. O
  22.         {
    & X2 `/ C! A: Z) W/ Z: y5 C! d
  23.                
    - z$ ?9 T- x1 w
  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).aspx4 M4 X  X9 {3 o  q
  25.                 STARTUPINFO si;* A* V" _$ A4 g" q. I

  26. 8 Y7 g9 R' k+ B+ M
  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
    7 l- s, i9 t- |0 s( V8 ~, U- s5 j
  28.                 PROCESS_INFORMATION pi;
    3 h6 w8 M& z2 w

  29. 4 T1 C( ~$ c8 |) E) k7 P
  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
    " ?; j, u6 X) T( \! K( P/ v5 H* D
  31.                 DEBUG_EVENT dbge;" E7 d7 }, I6 \3 V

  32. ) a) ?$ m' q6 e0 m
  33.                 //Commandline that will used at CreateProcess
    " p  K2 r) w+ U: o6 |* |1 P
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    % |; o  G2 d. p! D3 [

  35. 3 I+ w& y, g# j2 I5 ]- U
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made); w/ ?2 r' L3 [+ \/ y
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)2 t& |. w& _. I' b$ O& o
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)3 f! M0 k8 A9 n9 D' p, x
  39. . U7 l" d2 \& R, A6 ^; \- i

  40. 0 x* ]' D, ^& ?4 [  [8 ^: i4 F

  41. $ }9 A) Q  @2 X9 b0 \' x
  42.                 //Start DekaronServer.exe
    3 I7 O6 i, a  |  _. l6 J" x. `
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx- t( z+ t& T/ l% ^0 M
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    - J3 c" q3 ^* F3 j( O
  45.                         szCmdline,        // Command line4 }- v  L1 t1 c/ @1 Z2 N. d. d
  46.                         NULL,           // Process handle not inheritable. ^! i$ l) G' }3 g! A
  47.                         NULL,           // Thread handle not inheritable
    % T1 \$ s: R% G& _) ]. h& Y
  48.                         FALSE,          // Set handle inheritance to FALSE
    4 M9 H& [9 T7 Y5 J- P
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx8 j& Z; ^: p# p' {) l
  50.                         NULL,           // Use parent's environment block2 V; k0 H1 [5 I/ G! e- h6 `, a
  51.                         NULL,           // Use parent's starting directory ! W5 d: f9 H; Z2 C. M6 `5 |6 E
  52.                         &si,            // Pointer to STARTUPINFO structure
    ; [1 A2 [% m7 S& x& k+ n+ c( r
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    7 u: n" M+ M8 M& s& z% h. D% v
  54.                 )
    5 ]0 S8 ~& R: N' Z4 X7 s
  55.                 {
      z2 ^/ A6 {  b3 C! w3 E$ K! S
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );2 [, e" d; P3 h6 j8 R
  57.                         return 0;7 E0 |, n* H' s
  58.                 }
      I- i6 [* ~& S3 {: n
  59.                 //Creating Process was sucessful7 m( Q  O/ E5 T' h2 U# j; F
  60.                 else
    3 M. d+ F; s5 E
  61.                 {
    : d' `2 k% P$ M5 `3 c
  62.                         printf("Sucessfully launched DekaronServer.exe\n");  E' L) r3 [* u
  63. ) j8 ]- n# w2 z! G1 K
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    : w# U0 [! e4 P+ i% F) L- _2 T
  65.                         dbge.dwProcessId = pi.dwProcessId;' G0 v4 a" ?& c+ S8 l) D$ S
  66.                         dbge.dwProcessId = pi.dwThreadId;
    / h" x! v0 w$ ?& a  f8 W$ x8 r
  67. / \2 n: L$ A% g  n$ `( [, B
  68.                         while(true) //infinite loop ("Debugger")
    $ W- H8 ^. h3 L4 m/ I9 o
  69.                         {
    * S7 W" Y: o8 x6 V
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx& P8 {6 z' q! ^' u6 E; W# u
  71. , I: F+ a* K& n- ]! J, b
  72.                                 /*0 y; C0 t5 D9 }/ l: o  h
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

8 \- Q  b9 J/ x# w0 H% [5 s/ k! o. z) c( ]9 Q) g  Z; w
# C6 C9 [& O$ @& J
商业服务端 登录器 网站 出售

15

主题

258

回帖

1267

积分

金牌会员

积分
1267
金钱
915
贡献
74
注册时间
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

回帖

1267

积分

金牌会员

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

3

主题

102

回帖

7597

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

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

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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