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

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

[复制链接]

136

主题

168

回帖

3153

积分

管理员

积分
3153
金钱
1030
贡献
1819
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
  [0 I$ g% E% ^3 S% f& G9 w
4 F' x. O1 C& ^) z1 c: W3 K虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。% Q3 ~7 I- _. {9 M

# j+ N0 Z5 M8 d/ X
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。9 J! O8 Z9 w! L  t( h
  2. //5 V; M! x! n6 T4 M9 h

  3. 4 C/ g1 |. `1 d, A, K+ R5 i
  4. #include "stdafx.h"7 I% J' V$ A0 |. g8 ]" }
  5. #include <iostream>
    0 e" z1 e& F/ p7 k5 H* P! j' b
  6. #include <Windows.h>+ O- V+ s! B" c
  7. #include <io.h>2 [6 c$ J  u1 B5 f6 w& V* C: m

  8. - H6 H# I% J3 z
  9. $ R7 _$ l0 U, f  _# r
  10. int _tmain(int argc, _TCHAR* argv[])& q$ }( y1 x) R' S+ F6 W
  11. {
    2 s; T, x9 I4 f  @
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    ' E1 I, m. V0 A% }( e: X" c& |! q$ v& A

  13. # ^& R2 n# R0 y$ L
  14.         //查看文件“DekaronServer.exe”是否存在
    3 q' i+ w6 W6 o4 k% U0 h& a, ^
  15.         if(_access("DekaronServer.exe", 0) == -1)+ |, U# J" O; Q, q
  16.         {
    * s( v7 Y. t9 G0 z
  17.                 printf("DekaronServer.exe not found!\n");
    $ U9 ?0 D2 c3 R
  18.                 printf("Program will close in 5seconds\n");8 E& X9 \% G; f; E  s
  19.                 Sleep(5000);% T# |6 v% n. w
  20.         }) w8 T7 X" M, U# F; y
  21.         else& A2 H% }2 [- F$ @% n" n( y1 e! D
  22.         {* i/ }6 P' {8 h* x, @' B- c; H
  23.                 4 t1 T! s5 H. C$ x+ M
  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' m9 s2 p7 w9 X5 n( `/ d% R8 b7 f9 G4 |
  25.                 STARTUPINFO si;8 M" Z6 j  i/ j: ^$ q" Z, S2 D  }

  26. ; p% P$ y! k1 D9 }+ t
  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: L" @0 d* V0 O# D, b
  28.                 PROCESS_INFORMATION pi;
    9 k+ ^' H7 p7 y/ |8 B

  29. - w: l6 Y; G2 B
  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).aspx5 T/ F5 I4 N$ \
  31.                 DEBUG_EVENT dbge;
    % O, d7 V9 A6 Q1 O) C
  32. & X2 Y- a+ l4 Y  b. ?& V5 K! B
  33.                 //Commandline that will used at CreateProcess# x) Q. }% `5 z' X" S, J
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));: S/ ]- W+ ~+ y" \5 x
  35. " |& _1 C; w# o# B3 F/ ?' b
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)' O% J* _1 D) s  \% E' l/ A
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)' a" V; X! a6 @
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)3 @  W0 f3 U" a. Y; U3 P
  39. , v9 |& b; N8 H7 e4 J

  40. & A& M7 D: N1 H
  41. 9 g3 l5 j4 a7 q: U& Z1 T0 o
  42.                 //Start DekaronServer.exe
    9 K2 b( `  p, u0 W: l
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    ( B, v7 r2 t9 {% ]9 N6 ^
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)2 g3 m" |3 \; B6 e2 m, J
  45.                         szCmdline,        // Command line) F1 W0 F7 _- }" [& M
  46.                         NULL,           // Process handle not inheritable  \' I/ J- L* ]
  47.                         NULL,           // Thread handle not inheritable
    / _( J% u0 v5 V7 w, D- m) t) @; v: m
  48.                         FALSE,          // Set handle inheritance to FALSE
    0 i' z' g$ o$ b/ R. z- W3 {/ l
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx3 Y$ v" i# K5 t% F  G' v  m
  50.                         NULL,           // Use parent's environment block9 X* N, h( s/ n4 Z1 Q
  51.                         NULL,           // Use parent's starting directory
    + @! B- n+ F3 m: Y4 h* L
  52.                         &si,            // Pointer to STARTUPINFO structure7 k# ?4 M3 M* f' O! x
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure. m- M" d& q, b4 B) a
  54.                 ) $ l2 U  |" V  \8 ~
  55.                 {
    2 E2 b- D# P  Q) g; R
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    5 Q% P& Q/ ~# D' l
  57.                         return 0;- E6 g1 B( H0 Z9 b0 i- W
  58.                 }
    0 {  ?" D2 L% L1 f: t" H) `8 p
  59.                 //Creating Process was sucessful
    3 Q+ f( w/ I6 z, k
  60.                 else0 w% O8 C2 m! ~! u2 o
  61.                 {
    ) e: n% q4 D( q- Q: P1 Y1 R
  62.                         printf("Sucessfully launched DekaronServer.exe\n");; r7 w4 R5 w( _* d; p. m
  63. . M8 R. M* B; ?! [( V
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure& U" J" @5 H- b
  65.                         dbge.dwProcessId = pi.dwProcessId;8 Y* R/ l/ ~: K; _2 y2 i5 _+ N
  66.                         dbge.dwProcessId = pi.dwThreadId;
    ( }6 G) l5 C9 `6 G: E3 e
  67. 1 t/ W0 N7 W7 X! X5 ^1 `
  68.                         while(true) //infinite loop ("Debugger")
    2 A, [) Z6 v9 r) M, A* i
  69.                         {
    7 @: |6 k7 [$ `. U$ s( N# M  \
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    9 A9 {2 u' P2 V0 W
  71. 2 S$ R- {# V8 |5 V/ A( e
  72.                                 /*! S$ N% A( ]5 V2 i1 X
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

* s. @, `1 [7 r# j3 G  @0 l
' e9 I4 W* {+ N/ X; p
/ i* t* I0 V2 T, T3 J* ^; _7 b% I
商业服务端 登录器 网站 出售

8

主题

230

回帖

816

积分

高级会员

积分
816
金钱
487
贡献
86
注册时间
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

主题

189

回帖

298

积分

注册会员

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

8

主题

230

回帖

816

积分

高级会员

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

2

主题

81

回帖

611

积分

高级会员

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

本版积分规则

Archiver|手机版|小黑屋|EGameol

GMT+8, 2025-2-22 16:45 , Processed in 0.049050 second(s), 25 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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