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

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

[复制链接]

154

主题

335

回帖

5751

积分

管理员

积分
5751
金钱
1811
贡献
3451
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) $ d6 _" T0 B: K0 j: i  \
' M1 J) I$ w( ^, A4 s
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
' j/ l% r, Z9 J  y0 {8 O! L2 v/ `2 ?2 o9 ?" n3 Z" T
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。5 U* g7 N6 D2 {. J, @
  2. //
      e' A$ y5 u$ Y- D2 M3 S
  3. / z- |5 z" H. N/ Q2 g
  4. #include "stdafx.h"
    ' [+ i8 N6 j% R$ v. Y# v7 Z
  5. #include <iostream>' w* [7 l/ q% b& R5 o
  6. #include <Windows.h>% F/ \7 P. m$ A! _* q- t
  7. #include <io.h>7 D, C7 _& }) G# V
  8. ( S2 t! {- |  x* I, K7 @" m

  9.   f: c/ _: s) J9 J9 b
  10. int _tmain(int argc, _TCHAR* argv[])
    5 T2 c8 ?# U! i5 Y" q+ v
  11. {
    : G) Y% N, G) }% ~2 E  c9 ^
  12.         printf("Dekaron-Server Launcher by Toasty\n");& d% M! s7 f/ e) t! y2 r

  13. ( {& w+ G8 X( |! n
  14.         //查看文件“DekaronServer.exe”是否存在
    $ D# a. B, Z5 P% L* R
  15.         if(_access("DekaronServer.exe", 0) == -1)
    ) Y$ j% k2 b$ ^  u7 i3 n# s) k
  16.         {
    # ~& M" N3 V- f
  17.                 printf("DekaronServer.exe not found!\n");& L! C) U2 N# I$ ~
  18.                 printf("Program will close in 5seconds\n");
    # w- A( u; t' Q. W
  19.                 Sleep(5000);0 A2 @8 H% B' K9 A) [& h: I3 W5 u. _
  20.         }! s9 {& `9 \# T$ s; Z0 |. }. K
  21.         else
    # P2 ^" w' S8 _# ^. Z( i2 {- y4 k
  22.         {$ i5 C1 H2 s# @$ Q3 Q
  23.                 8 G5 V, {. O9 c, J9 \# Q
  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
    - Q9 ^$ U9 ^4 F- x
  25.                 STARTUPINFO si;, T) |4 }' P3 r2 o" X6 }) d" T
  26. * C2 {+ {8 V: 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' M: W, l6 T8 v$ c, j9 m
  28.                 PROCESS_INFORMATION pi;% ]7 {) y, V/ @# }8 A6 _) [' Y

  29. - r) V; L: T: J7 j1 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
    9 m  r$ [5 r7 k. s
  31.                 DEBUG_EVENT dbge;' u( ~* m6 o* |9 o& y  Z1 e% f

  32. 7 i+ f$ U+ ^# Z; [3 M7 m
  33.                 //Commandline that will used at CreateProcess
    " D2 i. t2 h9 B; [" o! ~
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    + M0 F4 n' `1 w' A
  35. : \: x" {- w! |  P1 }9 z2 |0 g
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made): ~; V, ?. C, V  u2 V) v
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    1 b0 d: R2 f, O: h- C: ?
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    / E* Z: J3 x) P) d% c
  39. 8 @! h3 a* I) \6 W: {1 y" V" c( f# \
  40. % o* H- X% F6 Z  ^7 N2 b) @

  41. 9 f- c2 B/ n0 \$ [! R: o
  42.                 //Start DekaronServer.exe $ @( d- d. V: k$ b; ^9 a9 o
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx- I  ^4 m! k( l6 c$ Q
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    6 I) W1 x7 d& N" X4 t- f
  45.                         szCmdline,        // Command line; P9 L6 _. `7 e3 w/ Q
  46.                         NULL,           // Process handle not inheritable# K& j/ P+ n$ m% ^3 y
  47.                         NULL,           // Thread handle not inheritable. ~* s* z/ b; O' D8 P. U
  48.                         FALSE,          // Set handle inheritance to FALSE8 s2 k+ k- S* W6 r: o% W- F8 j
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    ) \" v- u* L; _; z
  50.                         NULL,           // Use parent's environment block
    : `# ?, n: ?- W; k' d9 `
  51.                         NULL,           // Use parent's starting directory
    + Z( P& u* e, F' ~/ r% N  y
  52.                         &si,            // Pointer to STARTUPINFO structure" {: M1 T# D/ z/ t8 j9 q% T- P
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    $ _; ~9 d8 O: b* L3 d
  54.                 )
    $ t; ^' V) f: g( ~, L
  55.                 {
    7 ]% V) ]- @  v/ z# \
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );$ \. Y. A, [! V
  57.                         return 0;
    / R, n0 W# M% d
  58.                 }2 t/ x5 [8 V% ], u- O
  59.                 //Creating Process was sucessful9 r& R8 ?( S( C( t9 p1 `
  60.                 else
    / Z2 |" l+ u& j8 V
  61.                 {
    $ U& s' [6 f) _
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    1 ^% H* Q  p% [/ Y& w
  63. 6 G! o' Z9 j* m) R
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure& _6 L' v/ a6 }  x# @
  65.                         dbge.dwProcessId = pi.dwProcessId;1 i) m  f! r( H# J% I
  66.                         dbge.dwProcessId = pi.dwThreadId;
    ; j) j' a: \/ v) V

  67. $ g. W6 _5 {" U. ^, R2 d
  68.                         while(true) //infinite loop ("Debugger")
    ; e7 N( z3 Z9 m' ^/ s
  69.                         {$ a, v, w  O3 ?- K
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    ' ^+ p- z4 |6 E' [
  71. # L" p$ F1 ]+ A! S6 A
  72.                                 /*. x" [: t! V6 j8 U' c# H5 q7 [
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

; C7 H# `6 q- C/ S4 Q7 v
* m, s& p: g+ u+ m4 @: \% h1 C% e% C& o7 z
商业服务端 登录器 网站 出售

13

主题

250

回帖

1226

积分

金牌会员

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

回帖

1226

积分

金牌会员

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

3

主题

99

回帖

5153

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-11-29 03:55 , Processed in 0.080095 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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