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

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

[复制链接]

154

主题

340

回帖

5818

积分

管理员

积分
5818
金钱
1828
贡献
3496
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 2 v3 l5 f& @! v* M: X. a* p0 O' X
! R4 m, _' D, j7 ~& n# @9 d
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
! K( G3 f+ L2 g5 z
; U8 A' x/ z9 K( j& I
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    + r4 y( B# G: ~3 e$ L
  2. //9 Q" r( ^$ t! |$ ~' Q; J5 z0 D

  3. + x( W# T7 T9 k, }' ?
  4. #include "stdafx.h"! d4 S0 y0 U/ I% A5 h) S
  5. #include <iostream>, N4 C0 l; v9 O: o6 r1 j5 y
  6. #include <Windows.h>
    ! X0 l3 F% }" z2 L* q# H
  7. #include <io.h>
    9 m6 i8 c7 R" S

  8. : e5 {  w9 W" `5 c+ J/ D
  9. + {- F0 V/ q6 o: _
  10. int _tmain(int argc, _TCHAR* argv[])1 i$ H" y: C. n$ \, |
  11. {
    5 f8 z! N: O  }# U+ b# [3 {8 `5 c
  12.         printf("Dekaron-Server Launcher by Toasty\n");" ^% M! T. C, M
  13. + I! ?; n( {3 c/ @' _  _2 J* ~1 z
  14.         //查看文件“DekaronServer.exe”是否存在
    : f5 w. c& `+ `* u6 r# E! U
  15.         if(_access("DekaronServer.exe", 0) == -1)+ a; m8 {0 q) x" m& M. ^9 R* w
  16.         {9 j/ B. e6 J1 }2 b4 `& u- Y; u5 Z
  17.                 printf("DekaronServer.exe not found!\n");
    4 l3 Y- w$ \3 Y8 Y9 o* e+ F: V
  18.                 printf("Program will close in 5seconds\n");7 u* A0 [0 c" m. w
  19.                 Sleep(5000);
    2 s$ e: b. [! q, ~
  20.         }. I- H% X1 }2 {* t1 {
  21.         else' m- T8 U/ \7 C% N  k
  22.         {
    * s+ Z' Y# Z, _( Q# P
  23.                
    6 n3 H  R6 l8 H2 F
  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
    ' b* K" C. V7 S
  25.                 STARTUPINFO si;0 V# f( O! Q; u: X8 P, o* a+ r! M

  26. / {8 V1 p' R3 z4 D! V
  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* t+ [( z7 T% d" d9 V8 F% r
  28.                 PROCESS_INFORMATION pi;% P; |5 w1 D2 |9 Z

  29. 0 R% L9 ?, ?4 n" V6 b4 W6 O
  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).aspx9 z! x; Q: d' l; p, ]  g
  31.                 DEBUG_EVENT dbge;- Z; i: G* G, D- y% R1 w9 y

  32. 7 t4 T9 Q( O+ x* w! c. H/ k
  33.                 //Commandline that will used at CreateProcess8 c1 |; {1 b4 X1 j
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));+ s% N: j5 E/ W  C2 L( Q8 z( {. U
  35. / q1 H5 M6 P" {# |2 _
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    / e1 L: b% p7 ~
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)9 C! O+ g! R, j% v: h
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)* C, S& P6 ~2 P* Q( d) {* W

  39. ( y! C7 u. n% p

  40. $ C4 Z! m, P: }. @8 E
  41. ) C2 F7 x* \& e9 r9 z; I7 Y
  42.                 //Start DekaronServer.exe ; Y$ S9 ?5 P/ W5 N
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx( h! z: O/ O, S( g2 Y! O/ y
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    ! {. C2 m. r# q6 S  |
  45.                         szCmdline,        // Command line
    3 t0 V: G; ?/ E* H
  46.                         NULL,           // Process handle not inheritable
    2 f- X2 e5 p* M1 ^* Y
  47.                         NULL,           // Thread handle not inheritable6 X# K* ?& n' O6 s
  48.                         FALSE,          // Set handle inheritance to FALSE
    # i" ^2 V, C+ g+ U
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    * u1 _  L% z4 F+ @7 l$ m1 q
  50.                         NULL,           // Use parent's environment block
    & _8 C2 |+ l1 S
  51.                         NULL,           // Use parent's starting directory
    ; {  o# M1 v* t
  52.                         &si,            // Pointer to STARTUPINFO structure
      X( o! J5 \' [' [. K+ v
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    7 Z/ O' x$ I( a) K2 p
  54.                 ) , b! A( g! ]* P( ?' h4 S7 @& J
  55.                 {$ o7 C, z; l' ~7 C- {( i# ?
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    2 Y8 ]) o3 e$ H) |2 _5 D; j9 w
  57.                         return 0;/ K! N9 e# x" \( h1 X
  58.                 }
    ' M( {& n3 t' u6 ^- F
  59.                 //Creating Process was sucessful  }0 R  @0 }2 x- y* e1 j' M
  60.                 else6 T3 |: P$ E( b' p( K" l2 m8 y2 h
  61.                 {
    1 a. ^2 h, o. w0 G( p
  62.                         printf("Sucessfully launched DekaronServer.exe\n");9 A; {4 M/ ^: @" K
  63. / l( `  b" N. f, Z4 d8 O5 C! h5 Q
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure2 ~' t/ N. I! f! J2 _7 T+ T
  65.                         dbge.dwProcessId = pi.dwProcessId;
    0 Z0 x* r+ u* W# l% N: D1 q
  66.                         dbge.dwProcessId = pi.dwThreadId;9 X, X" P* y/ x0 ]3 ~

  67. 6 q' [0 C) ]4 T, Z! X0 Q
  68.                         while(true) //infinite loop ("Debugger"). [1 V5 h& o. K: B8 _3 C
  69.                         {  x3 ]# G, l! ^5 c' _
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    $ l# _" ^; u9 y* M7 f! W" N

  71. 3 [, A- }0 [( o0 M
  72.                                 /*
    3 L2 X( e8 u& C/ Q- f0 y
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

) [9 T1 Z( N4 g& U1 l4 @7 U
3 [. J- o' d' B
8 ~+ a) z. a, S6 K9 d% `
商业服务端 登录器 网站 出售

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

回帖

5333

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-8 07:14 , Processed in 0.068581 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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