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

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

[复制链接]

157

主题

364

回帖

6930

积分

管理员

积分
6930
金钱
1966
贡献
4443
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
+ v. D) e  u6 _8 L& f+ N. ~: H6 i$ q3 d  i9 T( o. j( t) N: A4 s
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
+ k& R9 Q6 U1 g! K5 N1 m3 L* H7 ?: E: `' ~
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。4 Z3 W8 \, {! L9 u# z5 N
  2. //- ?* U$ _% p, ]# N

  3. $ D- t2 \. L. h- d
  4. #include "stdafx.h"
    7 S" F2 @# a, @* v
  5. #include <iostream>
    9 M5 p% ]3 [8 o, M( F
  6. #include <Windows.h>+ J1 R+ _) A9 b" e" ?
  7. #include <io.h>+ D) H5 z' A& o5 w2 ?, ?# {+ v
  8. ) t6 v1 ?- j' H# W' Q4 ]

  9. 1 M1 e6 I% a- v0 y. S7 Q% H
  10. int _tmain(int argc, _TCHAR* argv[])- \0 b, c3 j3 X7 P( R5 `: A# k  M0 o
  11. {9 c& [2 I. V& w3 ~; l9 D
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    : x: _0 J( }  T+ C
  13. 1 {9 k  [$ e8 O0 i8 {
  14.         //查看文件“DekaronServer.exe”是否存在
    , h& ^/ ^" C, y
  15.         if(_access("DekaronServer.exe", 0) == -1)
    5 ]0 I5 {( C+ g$ K0 v, C
  16.         {
    & p" ]) T) A$ K- g4 m: Q
  17.                 printf("DekaronServer.exe not found!\n");& l3 I  p1 o  S% n' C. q: F/ F) P
  18.                 printf("Program will close in 5seconds\n");
    ' w" r) i7 W) P) Y! U
  19.                 Sleep(5000);! O. K2 U  C' z$ [
  20.         }
    $ @0 C4 I( W/ o! l3 G) D: W
  21.         else
    & k! ]' O5 V; j8 v' P# ]" m& S
  22.         {
    / a1 k2 |  m7 `+ j
  23.                 ! r$ L. E; u9 [* Q! X
  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
    ) t0 T( i, q; {. t" |. y; x
  25.                 STARTUPINFO si;
    1 N/ q  ]5 a* {6 P' i
  26. : U4 A" C. E5 o/ \
  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  w, l7 v7 K  P3 O9 s2 z1 \, p
  28.                 PROCESS_INFORMATION pi;
    , r2 a8 R( X" F% x9 d5 `' y! y/ P
  29. 8 K; |) R- |7 g9 E
  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
    / f, W4 Y! |9 r' W
  31.                 DEBUG_EVENT dbge;
    % y4 v+ j" P- x& A5 d6 _
  32. " j4 j2 S3 a/ c! D$ y6 h# w  Q" z
  33.                 //Commandline that will used at CreateProcess1 [! v6 x! U6 ^+ J; S/ B# o# B. j
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    - w3 h% \5 }, E; Y

  35.   E6 z1 x# d: J* F  L: ^
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)4 X; f" G. R1 D/ n
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)+ \' z7 ?. X+ I) g( r
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)7 \( z% g9 \0 {) A3 B- Q% c
  39. , m- J' p" M! ~3 j6 s: R5 @4 e# {. a
  40. 9 p4 T) m1 r) P. P
  41. 8 B6 O: C4 T& n! h
  42.                 //Start DekaronServer.exe
    2 c/ G7 d, k  W+ w2 P! X' O" \
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx: R' O6 e% S- P! q7 w1 j
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    3 x% v2 k5 U' O! R  ?- ^/ o2 H
  45.                         szCmdline,        // Command line
    6 t$ U5 x; K# P  X$ n! x( b
  46.                         NULL,           // Process handle not inheritable
    - A9 U% m0 C2 l4 [" s
  47.                         NULL,           // Thread handle not inheritable' c0 X: T6 P* [" W
  48.                         FALSE,          // Set handle inheritance to FALSE7 d, U0 l6 U, l
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    . [: I# p2 U8 \) s7 k
  50.                         NULL,           // Use parent's environment block
    # ?! u& S0 x; q. z3 m0 K
  51.                         NULL,           // Use parent's starting directory : B' O8 u- v4 q! }) F
  52.                         &si,            // Pointer to STARTUPINFO structure4 T$ R8 w0 G1 r( B
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    ' H7 H! k' e0 y1 A$ y7 }* ^
  54.                 ) ) K0 O% Y2 d* Z" x  q
  55.                 {, \& e& @% t& R" r/ ^0 T  r
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );$ v% S, ^7 L8 r7 r5 x' S* m
  57.                         return 0;) G; F. _" |! [% C3 }
  58.                 }+ X1 @- h: f  y& p  b& J( S8 u
  59.                 //Creating Process was sucessful
    : \" n0 g/ W. K1 a" u: `# m
  60.                 else# f4 J- u4 Y  ~  x9 _! @+ L8 G
  61.                 {* Y1 ~9 L/ ^1 w7 A2 |
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    0 z4 X( q# M8 m, r

  63. * ?7 y- K( [2 t$ z: e8 U" ]
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure8 M4 J2 B+ v$ _4 ]4 T3 P7 }
  65.                         dbge.dwProcessId = pi.dwProcessId;: x5 q0 J; u+ y: B( t: i: `
  66.                         dbge.dwProcessId = pi.dwThreadId;1 @+ y) a! a: O: `

  67. ) e, x1 o3 h# ~$ T5 N& }
  68.                         while(true) //infinite loop ("Debugger")( v9 e$ ^; L5 f0 R9 K: F, Z
  69.                         {
    ; p( i1 d% U/ E7 X0 f
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx( [3 ^3 _% o  m* [

  71. , Z8 K: s! z; f: ]# w
  72.                                 /*
    9 U8 r( s7 _, @- m
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

7 b) F1 I1 Y1 f- x: W+ X
  O0 m' o! j9 N* A4 S  }; ]' U% k! m3 q2 H7 w$ L: R
商业服务端 登录器 网站 出售

15

主题

257

回帖

1226

积分

金牌会员

积分
1226
金钱
886
贡献
63
注册时间
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

主题

257

回帖

1226

积分

金牌会员

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

3

主题

102

回帖

6812

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-3-6 06:05 , Processed in 0.053357 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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