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

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

[复制链接]

155

主题

343

回帖

5879

积分

管理员

积分
5879
金钱
1843
贡献
3538
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
6 E# y# ]! L4 U. L; u$ [
9 q. V3 y0 C, {$ l& d* R虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
) [: K. l3 s) s4 @
: w' `- H) l* t
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    / N2 s3 @" `2 k& l- `1 Z
  2. //( Q! {' U4 ?+ t
  3. 1 C' C+ X9 f2 x8 E
  4. #include "stdafx.h"' Y- Q, L9 K  U" C" \& o+ k
  5. #include <iostream>
    3 T- Z2 s0 l  y+ B! j9 @
  6. #include <Windows.h>
    % z& K+ t5 w6 x
  7. #include <io.h>
    ) _/ z0 j; k/ S! t/ d8 J, Q
  8. ; q/ B2 J  f4 r4 e* O3 \, n

  9. 6 E5 {7 f! v5 C- J( q7 e: d/ ]; e
  10. int _tmain(int argc, _TCHAR* argv[])
    / A* r2 [! b# i
  11. {
    8 Q; S; ]1 N' j6 V- b
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    2 V1 t: ~5 M0 x0 d
  13. ! I: {0 m0 g8 a( H
  14.         //查看文件“DekaronServer.exe”是否存在
    4 [5 P4 N# N* [9 j  G7 K9 m0 x3 v: S
  15.         if(_access("DekaronServer.exe", 0) == -1)
    9 P: z6 m4 E# {) D& _4 b1 ~
  16.         {
    + ^  D$ G( l, {" V0 b
  17.                 printf("DekaronServer.exe not found!\n");
    5 b/ ]$ y1 O/ s; V# n* K+ Q
  18.                 printf("Program will close in 5seconds\n");
    ) l& Z, `# L- S5 g1 x. {! O
  19.                 Sleep(5000);
    % W0 i; l5 r& n0 f% @
  20.         }
    * G& W' j8 y0 t& q" ]6 K
  21.         else
    5 j6 A3 ?+ M  q7 Q/ q5 n. c$ B
  22.         {
    : ~( I  h4 L7 Y% Z0 C3 ?! Y  i
  23.                
    4 C. G. n: x# L* T6 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
    0 A7 B7 o- G/ h$ O0 S9 b
  25.                 STARTUPINFO si;* c/ s( W& k6 P# N
  26. * `/ j* f1 C; w' }/ j4 ]
  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
    " i' {" I6 s1 H  [
  28.                 PROCESS_INFORMATION pi;) P/ s$ N! X! r; }+ ]

  29. 5 J5 G: s  n. S0 ^2 t7 g
  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
    ) [2 u8 E6 A* J$ [" H
  31.                 DEBUG_EVENT dbge;, J- U. V/ g# b

  32. # Z/ i- F4 N8 ^4 e+ n3 |
  33.                 //Commandline that will used at CreateProcess
    - g3 a0 U* `, Z0 }
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    9 \$ e) i" t4 A- m' m
  35. 3 Q3 x" h: d) M/ @+ Q) t% ], ^+ d
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    + Z9 S' X8 q! L" V7 R; R
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    1 D6 b8 V: z3 F
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)" c1 C5 ~2 K  \* h

  39. ( @/ z! N5 F6 m% s

  40. / Q" e+ C) n% m: x

  41. . r8 D# i" W7 ?
  42.                 //Start DekaronServer.exe ; Y  P' A1 D2 N! [- ~/ l: J
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx' U( _7 c  k: O# O9 Z
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    - @9 z$ f% ]: E* o  @
  45.                         szCmdline,        // Command line" |. Q2 J* a5 K
  46.                         NULL,           // Process handle not inheritable
    8 E8 d# \* L! F/ R6 U7 m4 R
  47.                         NULL,           // Thread handle not inheritable7 D1 C" X! u# R  z) I$ J
  48.                         FALSE,          // Set handle inheritance to FALSE
    ) N, g% k  U% u4 o% `9 g* n
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx/ y; e; m8 A' v$ d5 i6 _
  50.                         NULL,           // Use parent's environment block
    ! |0 t7 k/ y9 r7 l8 d9 E7 T
  51.                         NULL,           // Use parent's starting directory
    # [! f' P! N' [3 k2 v' I0 M" k6 ^
  52.                         &si,            // Pointer to STARTUPINFO structure
    + {1 @* c( [" u, Y2 W
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure5 e) X# t' i0 d9 E" j
  54.                 )
    - ]) k+ P* |" A5 d
  55.                 {* E2 c7 H8 s& j' d; u; Z2 A, r
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );3 g. S" q3 |5 t0 M; d
  57.                         return 0;
    : r1 C, X' Y' u4 N2 ]1 g! w
  58.                 }! ~$ G# _: C, K1 J5 \6 U6 ?& v1 P
  59.                 //Creating Process was sucessful
    3 S& T5 N. c" ]* ^3 z
  60.                 else5 t/ a4 L4 e2 @: o+ ~  f7 X
  61.                 {
    & H2 }9 B. [# e2 m( c  K
  62.                         printf("Sucessfully launched DekaronServer.exe\n");/ A3 G7 W% _7 `0 e" w8 |
  63. $ {* ], E8 E& Q" Z/ @  }* x- P
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    / w  F" s# C# F$ a2 U5 r
  65.                         dbge.dwProcessId = pi.dwProcessId;
    9 \" E3 ]: W& t6 ^
  66.                         dbge.dwProcessId = pi.dwThreadId;
    + ^( D( o5 }) ?& L, w* N  J

  67. ( H8 T; M5 G' R  ~. p/ G3 i5 O2 h
  68.                         while(true) //infinite loop ("Debugger")
    . T( v( g. F; i, N3 p; {
  69.                         {4 I  \! X& Y0 O( b$ @# 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
    3 j& w& s6 Y, c- ?

  71. ' h1 C; f7 `4 R- S
  72.                                 /*
    9 Q! z3 i+ o( P0 w8 I5 g) W
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

7 ], d9 q0 @6 j8 e- w" l$ z! E4 P
7 I% `1 a& n$ X; i# f, L2 n4 `: ]2 {4 G4 |
商业服务端 登录器 网站 出售

13

主题

251

回帖

1261

积分

金牌会员

积分
1261
金钱
804
贡献
188
注册时间
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

主题

251

回帖

1261

积分

金牌会员

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

3

主题

99

回帖

5533

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-18 07:10 , Processed in 0.077684 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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