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

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

[复制链接]

157

主题

362

回帖

6843

积分

管理员

积分
6843
金钱
1944
贡献
4380
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
& r5 {- ?! h9 h! F5 t0 d0 ~. i1 j( e  m
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
0 t1 e! M1 x, d
$ Y- U( [. i- l6 ^( V" i
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。9 Y" s. X+ T1 g* [+ H- d7 X
  2. //' Z8 e' D: I6 n; b# g

  3. 0 d0 p$ }: a" e" o
  4. #include "stdafx.h"7 D: Z) `2 p" m' b3 w- z9 j& Y  q
  5. #include <iostream>
    ! X" O! @0 E+ X  r
  6. #include <Windows.h>! k" Y  ]* q5 u2 U& H
  7. #include <io.h>7 q8 R/ \5 q  c  X

  8. # c9 q8 d; i, e# ^0 M. U' s/ ^
  9. 0 p' v2 @* _& e
  10. int _tmain(int argc, _TCHAR* argv[])" X) m  p% x. l# J" N* q' J- k, @; |
  11. {/ Q0 U. c4 w5 j
  12.         printf("Dekaron-Server Launcher by Toasty\n");, ]6 k3 |' T* s8 [) }& `

  13. ' Q$ e% ?3 s! E9 x
  14.         //查看文件“DekaronServer.exe”是否存在8 e7 P# e; s; R( Z
  15.         if(_access("DekaronServer.exe", 0) == -1); j0 e: Z$ V$ @7 a. D, a/ d
  16.         {: R; o. h" ?& e8 C0 o  S. o- w3 A0 }
  17.                 printf("DekaronServer.exe not found!\n");
    8 y' U& ?/ v) b
  18.                 printf("Program will close in 5seconds\n");7 G3 f- q) W% Z! s) @0 l
  19.                 Sleep(5000);6 Y. D1 b9 ]% @0 c) b3 b8 W
  20.         }
    & R3 o/ x' z; ^5 ?6 c) q
  21.         else
    4 }; S! w6 j1 r3 g1 |3 ~
  22.         {( N& `6 ]3 Q. X1 _3 r
  23.                 4 q* b: o1 D+ _. _) i& I, n
  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).aspx2 w' k1 w5 f  [4 @# ^0 a1 t% y* s7 l( L
  25.                 STARTUPINFO si;
    & q" @, d  n# L5 a9 K5 y
  26. ( v5 h; ^. C$ r# Y! g/ V0 i
  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
    , e& ^. K) _" ]/ s* a" d
  28.                 PROCESS_INFORMATION pi;
    1 ?$ z5 h; z6 a8 m

  29. / f5 J5 _: g+ D0 R# x& Z
  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
    2 Y$ Y+ \- @2 A" w/ a* y8 K9 @4 x8 X
  31.                 DEBUG_EVENT dbge;
    2 o0 ^% |1 @3 E5 U
  32. - }- T$ h. o5 k! ?  D
  33.                 //Commandline that will used at CreateProcess
    7 d0 s. C  l, C( e8 J
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));6 a' b* L. t# e

  35. " A; l( X; I( Y% l
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    . g+ D: }1 T: L8 V
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)% q: r9 m8 S/ Y
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    * G% H. V; w, [& }$ S
  39. " j* e2 l- {: e$ I$ Q, K

  40. 4 r0 W0 d- p8 G: n
  41. ( m1 \# j: A* Q! ]' K) r
  42.                 //Start DekaronServer.exe
    : w1 X+ p9 i% R. [6 L9 K
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    ) o1 k9 C2 m- E% c
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    . }4 u1 ^4 q& u7 |/ G0 Z) |7 e$ ]
  45.                         szCmdline,        // Command line
    : V' y3 p# Q3 ^3 u+ t; T( }$ s" h
  46.                         NULL,           // Process handle not inheritable* Z: g( c) G8 f- Y: s( O0 k! |
  47.                         NULL,           // Thread handle not inheritable
    / c* r( O0 C- C: H0 J7 l: @
  48.                         FALSE,          // Set handle inheritance to FALSE
    ( m8 }+ e% B6 m) y4 V. G
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    9 f& q- f# k& q% J/ g- [: R
  50.                         NULL,           // Use parent's environment block
    " `* x5 a9 X3 N* W
  51.                         NULL,           // Use parent's starting directory
    5 c/ y9 Q7 m# t6 ?3 W% {
  52.                         &si,            // Pointer to STARTUPINFO structure
    , t+ h5 c) O. @4 Y/ f8 w) i: n
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    0 j5 p% [9 Z1 n  j. X
  54.                 ) - q- b( C" i$ S' ~3 k
  55.                 {8 c  I5 s5 o% [. P
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );" c: ]) J) v7 O  ]
  57.                         return 0;
    * K: ]6 @( |0 E/ G9 M+ i$ |
  58.                 }) _9 ?& r1 ]2 L& G$ t9 u
  59.                 //Creating Process was sucessful
    6 u6 b2 `$ D) r$ q& H7 y
  60.                 else+ c1 @5 }: q# m
  61.                 {
    , v% e, Y4 l0 E, Z6 C/ m
  62.                         printf("Sucessfully launched DekaronServer.exe\n");4 w+ q6 V4 G- g. a4 w6 N/ g

  63.   h  `; G9 u# U9 @$ `+ x, l) a. t
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    ! b# r$ D# ~9 t# e7 l7 A6 v# K
  65.                         dbge.dwProcessId = pi.dwProcessId;5 f% d7 ~- H& v
  66.                         dbge.dwProcessId = pi.dwThreadId;+ \1 a1 I6 |2 E( v

  67. 8 `1 ^: X) l% M* _# _1 Z$ p9 N. c
  68.                         while(true) //infinite loop ("Debugger")" e1 ^6 x- F5 S' y: @+ Q
  69.                         {9 y6 S; p6 i* g& G% I9 E) H5 G
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx6 d/ W; N/ k. c; P
  71. . a$ y" u. N7 k8 |) E" k$ \9 ]7 [
  72.                                 /*
    ' S! e* B! B9 c) `
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
' q1 U  M/ _6 p: H5 Y7 u9 \' P
# j7 u- q7 {. M' X7 q7 y

1 D- h& x' F* N( r8 {; y. u
商业服务端 登录器 网站 出售

15

主题

256

回帖

1271

积分

金牌会员

积分
1271
金钱
873
贡献
122
注册时间
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

回帖

1271

积分

金牌会员

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

3

主题

102

回帖

6541

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-16 10:44 , Processed in 0.066438 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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