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

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

[复制链接]

156

主题

354

回帖

6508

积分

管理员

积分
6508
金钱
1906
贡献
4092
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
$ d- V: l/ I# ?+ h0 H
4 C& c' b6 X9 l$ F' p虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。& Z4 S: a" g! J+ f5 K$ F& G
: g, V/ V' u2 m
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    : g+ i9 H. G- _: D( M# X/ r
  2. //
    & G- m) \# O/ K. _% X9 K& g7 s- p
  3.   q" Q% R! ?& h7 N
  4. #include "stdafx.h"
    0 h2 B; q& C# L3 s0 Q
  5. #include <iostream>
    ; P5 A# @0 q: U+ L9 l+ u4 E) _
  6. #include <Windows.h>/ y/ K) n, ]% T% C9 F
  7. #include <io.h>: Q4 ]  A* X% b2 x

  8. % l$ D: W5 i; v; ~

  9. , j6 d$ a) }; K* {, @  Z
  10. int _tmain(int argc, _TCHAR* argv[])
    % g0 c& g7 _: {% m+ P3 h
  11. {1 ?" _% ]/ ]4 O5 ^$ D. y; Q6 k
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    , S; J4 ~. N5 {0 v5 {: T
  13. ) i. x. q7 K' A# Q2 q' o2 E3 m
  14.         //查看文件“DekaronServer.exe”是否存在3 k. x1 p( m* n% c
  15.         if(_access("DekaronServer.exe", 0) == -1)
    / c1 o' Y6 x, Q' \# K% L
  16.         {1 k1 M2 Q$ F# R( n  _9 S7 p
  17.                 printf("DekaronServer.exe not found!\n");
    ) e$ @. M' o% k9 n% b$ _
  18.                 printf("Program will close in 5seconds\n");
    ! i$ X9 ?9 E# ?% j, I$ m' }
  19.                 Sleep(5000);
    4 ?$ G  g$ z1 h9 W/ p
  20.         }
    ' U- F4 n0 [( x
  21.         else) s1 K$ {# E2 h% d7 k5 [( H$ k
  22.         {2 N7 A. N5 ^3 {' l9 a
  23.                 % \5 C3 f9 e# k- Q1 G$ ]
  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
    # K* ^# L( T$ O, V  M7 K
  25.                 STARTUPINFO si;
    ) R% e  L! Z/ H
  26. 3 E9 S: C& s0 S; ~
  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( h$ D" A8 M) T
  28.                 PROCESS_INFORMATION pi;7 i9 t/ E( W8 ^4 T, A
  29. ' |- L' w  Q8 a' U5 S- }! ^
  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
    7 M# W. c8 z2 T7 l) y& {
  31.                 DEBUG_EVENT dbge;
    # S9 d" X/ V9 z! T

  32. , m; }. ?  I8 k$ {, i: |& i
  33.                 //Commandline that will used at CreateProcess) s4 k2 Y! a3 u4 s  ]4 ?' C" B
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));! I6 Y2 ?5 q( }: ~

  35. / N$ ~( i1 A; n# v# h) @1 D
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    * Q& D% w% J) q1 u. B
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    8 k+ C3 g# Y# y) ~
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    3 l8 V$ {% \0 x9 R

  39.   V! j  a# }# w9 {4 B4 u

  40. / ]- d9 C! z8 }8 K/ O. N- I

  41. " s0 Z$ q) h! n  m* x  b( m' B
  42.                 //Start DekaronServer.exe ! t9 d9 e7 w% F2 Y. p4 v0 K' D
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx9 e7 `/ v6 `, b% F0 h$ x  D
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    / c8 P0 e, L6 e0 C# p
  45.                         szCmdline,        // Command line8 y. W, B$ n* d" L/ m
  46.                         NULL,           // Process handle not inheritable+ a. o: T1 \9 z) V; h4 D: l2 L
  47.                         NULL,           // Thread handle not inheritable( ?" Q& ]6 R/ `7 L* z0 Z
  48.                         FALSE,          // Set handle inheritance to FALSE0 J) k" `# U9 U4 W) I" _
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    : u0 Z+ A3 W; V$ r
  50.                         NULL,           // Use parent's environment block
    + @* }- v4 g, x2 K5 X: }
  51.                         NULL,           // Use parent's starting directory
    2 _$ a% E2 V  }3 A: |1 j
  52.                         &si,            // Pointer to STARTUPINFO structure
    3 m1 @* R# g) _/ S( D1 w" J
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure% h$ c' r# K' T/ |$ f7 B" ~' s6 @
  54.                 ) , m) F9 n0 ~- `: {
  55.                 {
    # e- ~- k. y; E- f* u" b
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    . L& {; V- P" \5 M8 O  Q2 |6 k/ y
  57.                         return 0;- x7 x, N0 c/ a/ y( @
  58.                 }/ ~2 @. h$ C  J+ g: |9 T
  59.                 //Creating Process was sucessful, x6 o8 K9 j4 |  J8 `! {" t
  60.                 else$ |; l! e* u: }6 \
  61.                 {- ?- G* p9 H" ]5 r4 U* m- Q; j
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    : s0 l! K6 \: k: }
  63. ( D& K: W/ P% x. D8 ~2 g2 J* ^
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure* x% h& f- P& q" Y
  65.                         dbge.dwProcessId = pi.dwProcessId;7 ~& T' I* p- G: S! ^4 m- U$ w
  66.                         dbge.dwProcessId = pi.dwThreadId;" n/ B% M# o; V  E3 q. d
  67. ' U, g  ~# ~7 s
  68.                         while(true) //infinite loop ("Debugger")
    $ A9 Z8 ?0 A3 F( W( r
  69.                         {
    0 T8 j. i$ _! s* W, U  y
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx, N6 ]9 p& R# n" u5 u

  71. * C8 q7 l. J" Z! L8 J" ]) ^
  72.                                 /*
    . ?" `; t8 S1 J) w" i
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
7 ]6 I& T$ v  o- H
4 K8 }: q+ Y0 U3 Y1 I7 ^
1 Q- t4 T$ Z! X: B* a4 R9 R0 w1 A
商业服务端 登录器 网站 出售

15

主题

256

回帖

1241

积分

金牌会员

积分
1241
金钱
853
贡献
112
注册时间
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

主题

256

回帖

1241

积分

金牌会员

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

3

主题

102

回帖

6081

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-24 07:10 , Processed in 0.076960 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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