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

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

[复制链接]

153

主题

334

回帖

5706

积分

管理员

积分
5706
金钱
1802
贡献
3417
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) ; Y& [" B  \1 v0 R  Y; D9 f$ ]
# Y" g: ^0 \$ ]" y
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
, v% k. j+ ^+ k8 v. G/ `3 j5 O" `8 j; Y4 }) c+ E
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
      d* U5 X5 k% L0 G, }
  2. //
    4 X/ H* x" E" ~7 x

  3. ; \' X# J$ r) x0 d
  4. #include "stdafx.h") d( }* F( ^# b2 y
  5. #include <iostream>  h( f2 `# U; I) U- X
  6. #include <Windows.h>8 ~' q# t+ M& h( M( p' v% g; A( S
  7. #include <io.h>
    . x& k: X1 _2 Z5 e
  8. / ]4 s; s3 ^6 ?; x
  9. & m8 Z1 G4 O9 I- b% e* R* X9 ]& m5 c
  10. int _tmain(int argc, _TCHAR* argv[])# r0 `& o, H; x7 F! @, D4 E
  11. {
    - y" w; N3 d$ U4 _+ x3 s$ O; _" w
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    ( `  j1 T# K, m- V3 u' c$ ?
  13. & [4 {7 u7 i" b$ p6 R% s
  14.         //查看文件“DekaronServer.exe”是否存在# Z/ K) Z& Q! d& z6 R# Y, G. [
  15.         if(_access("DekaronServer.exe", 0) == -1)
    + R  Y9 {" g' v; V0 k* B9 L0 \# [
  16.         {6 k! W, j/ ~  D6 F
  17.                 printf("DekaronServer.exe not found!\n");
    1 v/ @6 ~" w/ d8 I: b9 p& [
  18.                 printf("Program will close in 5seconds\n");
    - A% O* T" K, |0 J6 N  }  H& H
  19.                 Sleep(5000);
    - g$ k* z! t6 `# v9 s  ^3 A
  20.         }2 [6 d" _! t2 }" n
  21.         else
    / t0 M0 D% t) H* A3 s; ~% Y+ l
  22.         {: @3 |! K& i0 [- E
  23.                 0 N6 b( U" _' f; B
  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
    7 _2 e) d  \' B" m! I1 T! p7 v
  25.                 STARTUPINFO si;3 `) p" f( X, ~6 J, C5 K8 |8 ^
  26. * A0 U* A  w/ E# [  W! P
  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
    5 W, \8 J6 k) j2 P0 J
  28.                 PROCESS_INFORMATION pi;
    ) m2 R* @7 U. {5 a/ z5 a) f
  29. & {/ `3 h* F% B0 M  c, G9 O
  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
    3 A3 n8 N  @" C0 S4 w! B& F
  31.                 DEBUG_EVENT dbge;% z5 D  O2 F! ?
  32. 2 V6 m" n4 h6 U8 E  V  W
  33.                 //Commandline that will used at CreateProcess
    : G( a" ~$ m5 M% [
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));5 \1 _6 U" U8 e; }0 ]( `
  35. 2 U4 c/ g1 g! [/ a" H
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    & {/ v3 I  W+ h: a- I/ V
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)8 y/ d' D/ D, H' T5 j6 w3 Z0 H
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made); u  y; K2 Y6 Z$ t; e+ Q: K

  39. $ h8 B. v" u) E0 A5 p; }9 P
  40. % p  Q$ |) l" t" E+ o0 u

  41. 1 z6 @6 E& I2 _# e1 c3 f
  42.                 //Start DekaronServer.exe
    - S7 J% Z7 y6 @$ h  F/ I$ J3 I
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx% ]8 y- b. @- X6 z/ a8 Z" y7 r
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    / `9 ^& I( d$ M& n
  45.                         szCmdline,        // Command line
    & Y0 a$ k- S* ^$ h
  46.                         NULL,           // Process handle not inheritable, W/ w& ?7 o4 d
  47.                         NULL,           // Thread handle not inheritable
    6 n. h. a/ y3 h( A5 G$ A; {5 X0 Y
  48.                         FALSE,          // Set handle inheritance to FALSE' l; ~, F7 V# r1 ?$ ~! }* e- D) a- ^
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx; G9 y) c* v. Z# d, c
  50.                         NULL,           // Use parent's environment block8 r) V  @# N0 l: r# z
  51.                         NULL,           // Use parent's starting directory & Y+ V" N& ~: E0 C, _
  52.                         &si,            // Pointer to STARTUPINFO structure8 z7 }6 }: h; P7 ]- s7 i
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure1 V9 Q( u' G' ~% u# A
  54.                 )
    0 d2 W0 V+ H% @- j- A
  55.                 {: d4 \& ~! Q8 ]% B) D6 J
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );; ^, ]+ V: q7 T' J4 m; I6 Y
  57.                         return 0;
    + Q# `+ x  _' ?( I4 \6 z' L# W- Y
  58.                 }8 P1 h* v( E4 f; p' h& f
  59.                 //Creating Process was sucessful) V  L: |; `3 D  D, H4 K
  60.                 else
    + a7 A$ I( J9 a
  61.                 {
    ( s2 Z2 c, @+ C  d+ b! u
  62.                         printf("Sucessfully launched DekaronServer.exe\n");5 S& ]8 ]1 W- p

  63. ' x6 Y# N& ]0 m5 b* ?
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    7 C' o; Q: M: L. l! V% |1 J( s
  65.                         dbge.dwProcessId = pi.dwProcessId;, K  E' A  [* ~- R
  66.                         dbge.dwProcessId = pi.dwThreadId;
    8 G; Y. z; c% N0 Y
  67. " B0 s; `+ s/ J4 R$ s
  68.                         while(true) //infinite loop ("Debugger")
    + o% p- \7 k1 k( [
  69.                         {
    # l) K" v+ r+ u, `
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    0 o# ^; ^2 v5 Q% N9 S3 Y% z

  71. + j8 I! ~4 R9 `; J. Z
  72.                                 /*
    $ u8 ~: R% n3 S0 @) i8 R1 j  S
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

0 ]; u4 W: ~9 T+ i8 x$ v
8 C) H" X$ Z# ~% I8 [$ q
- Y* o* }7 ]! f4 l! |. R
商业服务端 登录器 网站 出售

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

回帖

5051

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-11-24 10:36 , Processed in 0.079393 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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