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

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

[复制链接]

147

主题

281

回帖

5125

积分

管理员

积分
5125
金钱
1637
贡献
3060
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
/ e$ R" Z) x1 u* J* c
* A8 T* k9 s3 ?. l8 ~( \6 b虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。" u1 ~- P5 y8 \; A6 r8 }. W

( [! O% {/ ~$ R9 _/ [5 X; ]
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    ) w% O, C$ y; s8 S1 ~3 E# @
  2. //
    & H6 ?9 S; Z$ [
  3. ' H9 O0 V3 R7 ?$ M; n
  4. #include "stdafx.h"& l# J- d* |6 X
  5. #include <iostream>
    5 R& F2 U/ E, A
  6. #include <Windows.h>* V: S  G3 t) y: \2 R5 T) @, q1 a
  7. #include <io.h>: Z! N$ W% S0 t# M$ T- b' p
  8. ) T) Z+ V. W( s: Z7 R
  9. , R8 a- c- x4 ?. N
  10. int _tmain(int argc, _TCHAR* argv[]): o" J2 b0 Z& @& `& t
  11. {
    2 i9 \" V& H' \* Y: K
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    . T4 z  x' i2 l  l: n1 [( n2 D
  13. ' b/ J6 f9 y9 W+ r9 R3 v- [6 F* c
  14.         //查看文件“DekaronServer.exe”是否存在" {# P; s+ s. L+ |/ n: L! k
  15.         if(_access("DekaronServer.exe", 0) == -1)0 v- X1 S! o4 l* {' P$ V* e" p
  16.         {# W' @+ W, |# ^5 [4 Y  D% y
  17.                 printf("DekaronServer.exe not found!\n");' W9 B! v- ~4 v8 j9 V
  18.                 printf("Program will close in 5seconds\n");5 p# |1 j0 J( a
  19.                 Sleep(5000);8 T* g0 T3 W9 s
  20.         }1 C) N4 t' ~5 e% _! o, t
  21.         else
    ! p; }9 n  W1 O: {
  22.         {
    4 u! A8 z( ^" W5 v# d/ ]
  23.                 4 g& J  w9 i+ G$ j  `7 H
  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).aspx3 K: A, c& ]) O* Y
  25.                 STARTUPINFO si;' B' f4 N/ X5 F/ j; h9 L
  26. : O8 C$ R2 M6 M2 u
  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
    : d2 y. v! C; t( j! ]; Y
  28.                 PROCESS_INFORMATION pi;& L5 E& q, l. u9 H$ e
  29. / L5 K; p2 Q! 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  ^& |- s- c* A
  31.                 DEBUG_EVENT dbge;1 v5 |! H1 a7 r2 Y- L% b

  32. + r2 ~/ H  B9 F, y5 |7 s9 {% l4 n8 w
  33.                 //Commandline that will used at CreateProcess
    5 P# X8 F6 X0 `; a& X
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    ! y6 J0 w2 I4 ^5 l; P  m

  35. 9 X. P: X$ ]2 t' D
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    $ b6 y% D/ x2 r6 H
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)! D0 K1 o# o( b. R
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)" ~; @& x/ v. W6 Z" O
  39. . |" E; P7 |$ Q6 [+ Z0 }, F, B
  40. ! T5 j; {1 D# Z, I' ~4 ^

  41. ; D5 g$ P0 b- n  R
  42.                 //Start DekaronServer.exe
    8 w  z% F, q- r' R# n- ~. p
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    + S5 k& g; E, J6 `. O$ e
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    + D1 o& a, g. V0 f3 I% Z
  45.                         szCmdline,        // Command line! I6 Q. U6 j, p% W  q% n% t) o  J
  46.                         NULL,           // Process handle not inheritable# F4 ^) c7 [3 D
  47.                         NULL,           // Thread handle not inheritable# S/ u7 S; g9 e; y- z, o
  48.                         FALSE,          // Set handle inheritance to FALSE% H1 q; N* ^4 \+ i% ~
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx: D1 w! C+ B" H% R
  50.                         NULL,           // Use parent's environment block
    ) o4 P3 O+ d+ ]" s. Y0 x2 P$ t
  51.                         NULL,           // Use parent's starting directory
    2 J8 r4 ~8 x; s+ v; I! l4 o+ g# h
  52.                         &si,            // Pointer to STARTUPINFO structure1 b7 ?) H  E! ^/ r( L5 D, D$ e1 x- _
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    " K6 Q- v; T, w
  54.                 )
    . k: A# E/ t2 V% U
  55.                 {
    ; E2 C! S2 J( f1 C1 W
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );+ _0 F' n  F- z, s/ q- t
  57.                         return 0;" u% B# f* @$ o& F/ ~
  58.                 }( V0 r- d; E5 N& m; R
  59.                 //Creating Process was sucessful/ D. M  W6 L4 [& i0 \. E, r$ |! ^
  60.                 else
    ' ~1 o, \' C: k$ G$ b
  61.                 {
    ) |/ {  g/ _" N( O$ s8 }$ D
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    - M, u7 y% X9 F* _- Q$ o- Z
  63. ! T. S" r# X! ]9 j
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure- D% o1 _" z. |+ C
  65.                         dbge.dwProcessId = pi.dwProcessId;
    " \0 {' k7 T4 e% n7 t- ]3 H) Q
  66.                         dbge.dwProcessId = pi.dwThreadId;" [8 u, m/ T* D, ]# ]

  67. ( D9 d& b' w, W0 Y
  68.                         while(true) //infinite loop ("Debugger"); e" c$ T0 F, F9 u) |4 Y! Y3 s; p
  69.                         {
    ) |9 k/ k( v* n8 O1 m3 d
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    1 k2 w& _$ Z* m8 C& t& G# \
  71. 7 k8 ~  M& ?4 J5 `8 y8 Z: p
  72.                                 /*& A3 O. L% m5 ?5 f
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

) a$ O$ q; j3 H9 m1 o2 q; g+ d% |, X! V( |* z1 h2 J
, m& o8 H, \; S4 L/ L
商业服务端 登录器 网站 出售

10

主题

243

回帖

1106

积分

高级会员

积分
1106
金钱
700
贡献
148
注册时间
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

主题

204

回帖

340

积分

中级会员

积分
340
金钱
133
贡献
3
注册时间
2024-5-14
发表于 2024-5-14 15:56:57 | 显示全部楼层
学习学习赞赞赞

10

主题

243

回帖

1106

积分

高级会员

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

3

主题

97

回帖

3759

积分

金牌会员

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

本版积分规则


Archiver|手机版|小黑屋|EGameol

GMT+8, 2025-9-11 21:58 , Processed in 0.048602 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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