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

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

[复制链接]

153

主题

334

回帖

5703

积分

管理员

积分
5703
金钱
1800
贡献
3416
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
" S8 v7 k1 P% r* O! Y' h( m6 r) I3 d
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
$ u0 V+ D/ ^) a. S, Q/ O' I. n4 `" I
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。: s& N! B6 I2 H) w
  2. //$ M  ?7 L- X: n' S+ g/ J1 O
  3. # h: l* V- I- z1 v1 v% m
  4. #include "stdafx.h"6 {8 F7 V. i1 g
  5. #include <iostream>+ V' A0 [3 A" b6 d6 u! }& f) p
  6. #include <Windows.h>
    - i  S- l5 l7 Z
  7. #include <io.h>
    , B( F* F8 q* @' R& ?# C

  8. % U) L7 L: O+ v

  9. ) q2 D/ b/ R% M$ `; K  f1 d
  10. int _tmain(int argc, _TCHAR* argv[])% {9 B1 W8 w! J( I$ U+ D
  11. {
    + p) j* z  s( h
  12.         printf("Dekaron-Server Launcher by Toasty\n");3 L1 {- G( x8 `% U

  13. ! r5 s; T+ q) d. Q
  14.         //查看文件“DekaronServer.exe”是否存在
    " R7 b4 n* X" C5 X
  15.         if(_access("DekaronServer.exe", 0) == -1)& q2 p- [7 N3 e' n3 X9 {1 i" ?
  16.         {5 X) X( m2 N& d
  17.                 printf("DekaronServer.exe not found!\n");# o* h8 P2 C3 B$ y; Q& m
  18.                 printf("Program will close in 5seconds\n");! B- p* Z! Y4 h7 P1 @3 T( p- ]; v$ L" f
  19.                 Sleep(5000);
    6 v9 L- ^8 z7 O$ p) h8 \4 U
  20.         }
    ( H1 q* k0 X8 `$ w( Q( i" R" A9 l
  21.         else
    % L9 @: V* t4 ^
  22.         {
    2 K* U: }" ~: b/ [/ r
  23.                 2 Q' ^! \* |/ N# c% E
  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
    : P! r7 j! e5 Z) e+ R: S
  25.                 STARTUPINFO si;, `& I8 C$ h, f

  26. 4 k" B4 \; i+ p4 M' r
  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
    % Q; o& ]4 }8 d
  28.                 PROCESS_INFORMATION pi;" b; u# O; l/ m+ s* d  Y
  29. & G  F* m0 a' ^+ _
  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
    6 f6 z! D+ C1 Z# m' e
  31.                 DEBUG_EVENT dbge;/ k. F7 W% I( O' U/ h, P3 m
  32. 6 U$ c" O; P& s+ |/ h2 F6 I( u
  33.                 //Commandline that will used at CreateProcess3 I/ |0 i3 m0 j9 g+ n; @3 |: j3 [
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));* W% P6 U# C' u

  35. / Y, o; M' V( d$ [
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)8 n: k  H% `: e
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    3 G1 L. w# c3 B" R
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    ( u* }- k" z2 m7 Z5 v( [# F

  39. - g2 N5 J1 Z1 W( e# {+ d+ y
  40. ( G3 O! V- w8 Y  P% u- p6 m7 X

  41. 6 ]' @% [" t: Y) u
  42.                 //Start DekaronServer.exe 9 G4 a2 ^% g6 k& r$ E$ [
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx# v/ ]$ y6 c6 l" R3 ~( g- [. ^
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)( d) ]% U8 X' k0 v: q- g1 |
  45.                         szCmdline,        // Command line8 B$ ^5 e5 g+ c- F5 g& C% C% v
  46.                         NULL,           // Process handle not inheritable
    6 ~3 }( _( n. g. r, ?
  47.                         NULL,           // Thread handle not inheritable+ g- Q5 n. \* J1 Z0 j& v- Z$ c
  48.                         FALSE,          // Set handle inheritance to FALSE5 L% c7 D, I- ]7 S
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    2 J2 C* v: X* O( C
  50.                         NULL,           // Use parent's environment block
    ! q: W+ f4 ]5 k& r
  51.                         NULL,           // Use parent's starting directory
    $ A' ~1 Z3 q1 t4 ?5 x. Q8 j* W( F; ]. B
  52.                         &si,            // Pointer to STARTUPINFO structure
    : Y9 U: O+ i2 R$ ^4 ]
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    7 e( ~" ~4 j+ }+ n" _* `" Q
  54.                 ) - A, s" I' N6 ?
  55.                 {2 k% m9 q* ]9 H7 Y$ R4 {
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    & g4 d7 v( |4 d
  57.                         return 0;
    . b+ r# ~7 T  {$ i( n
  58.                 }7 H9 P' M# T5 d% d0 H
  59.                 //Creating Process was sucessful
    ! w( d! D' m9 G! ~6 W1 ]# e
  60.                 else
    $ y) P* p% V' R0 C
  61.                 {2 {% v, C* g/ t" f) ~; P: k# ~
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    8 ]: f) I8 W. J5 q# P' ^9 c: N4 \

  63. ( u4 _4 c& ?0 ^9 f+ t; u
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    ) N1 M/ o! U/ r9 n3 g: u5 [& t- H
  65.                         dbge.dwProcessId = pi.dwProcessId;
    - G& {/ _) S: j& D' J
  66.                         dbge.dwProcessId = pi.dwThreadId;  E. z  }  g  W0 U3 c  o, L

  67. 0 X+ L& Y4 ?) |% V
  68.                         while(true) //infinite loop ("Debugger")
    . J$ m! i) B- ~! `2 _4 T% c" @8 D( G
  69.                         {
    2 ~$ V/ L# @0 f# j8 @, k' 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# }, |6 K& Z7 K( a  h9 B+ f

  71. 3 \4 C. T; l+ m' Y0 I/ U2 L
  72.                                 /*
    6 m' L1 N/ O5 M% p- I9 Z) V
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

; H! g" d7 }" {1 h0 f$ d: f$ W3 b0 D7 Z' l# h7 T
0 i5 q. x: T7 a. I2 F) w
商业服务端 登录器 网站 出售

13

主题

250

回帖

1220

积分

金牌会员

积分
1220
金钱
779
贡献
173
注册时间
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

主题

250

回帖

1220

积分

金牌会员

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

3

主题

98

回帖

5031

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-11-22 16:40 , Processed in 0.070487 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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