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

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

[复制链接]

157

主题

365

回帖

7036

积分

管理员

积分
7036
金钱
1997
贡献
4517
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
1 x- z# |) Y9 j/ U% \% l7 H" V$ S
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。  B4 A6 e, u/ |
8 F9 Z2 r1 i0 T/ o" L0 A1 l
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    ; v/ J" B7 r  D$ p7 o9 L- T
  2. //
    2 d# m- U% ?5 |. k" z

  3. / P+ h6 O9 b2 u' o
  4. #include "stdafx.h"- q9 E7 G) m* s: s
  5. #include <iostream>
    # l" L" ]7 s, V9 `9 }8 {" _
  6. #include <Windows.h>, c3 M& U0 O& `$ E5 _% B5 ]% ]2 B
  7. #include <io.h>5 J. h" d; j( I2 _( Q

  8. " U1 t) P& @" M# w3 @

  9. ( D3 U1 R& H: o. ^. s
  10. int _tmain(int argc, _TCHAR* argv[])" g9 w' J, G/ d" V+ I- f- q5 R
  11. {# }1 H# h7 y7 ]. F
  12.         printf("Dekaron-Server Launcher by Toasty\n");0 T7 v* K" A2 W- N# \9 l

  13. 7 `* N8 q4 w0 e4 M' u
  14.         //查看文件“DekaronServer.exe”是否存在' p* A0 Z: e2 S7 {( T$ o; q
  15.         if(_access("DekaronServer.exe", 0) == -1)
    0 F4 N' o& Q6 ~/ `: P  L' {
  16.         {
    " s# u4 R5 [! `. l- E4 I8 w
  17.                 printf("DekaronServer.exe not found!\n");
    7 J* m4 t, b: }4 T% r
  18.                 printf("Program will close in 5seconds\n");8 y6 ^  c+ u9 m6 Y' Q" A
  19.                 Sleep(5000);/ L  I0 \" O) L4 C- X3 [
  20.         }
    7 C$ `4 P- w! u2 W
  21.         else! K8 b: u4 s4 z& q, F
  22.         {
    2 [" ~. ?" i/ W+ d
  23.                
    & D& A7 d  ~  p, P5 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).aspx4 `4 c7 l8 w# ?$ {$ ?2 D
  25.                 STARTUPINFO si;
    3 F& W- [: y9 g0 m
  26. 4 t7 Q8 ^8 t! u5 F) D" D
  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
    ) b. {: i. b8 ^/ Z
  28.                 PROCESS_INFORMATION pi;& ~0 U9 a' _' M  ]

  29. 2 W5 z+ p/ ~- k5 e
  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
    : L- |3 l! e/ U; E
  31.                 DEBUG_EVENT dbge;- |" _8 Q9 N" K- i- @! q" E
  32. 9 j# P! p8 H7 X0 _
  33.                 //Commandline that will used at CreateProcess  N' B4 N; J) y; `8 N0 P8 i" \+ F* I
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    8 O2 H/ i, b- M4 Q( e- n* S* X& m
  35. : b9 Z& l1 ^# {
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)4 ?- T9 i1 R& \/ d1 @; m
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)* f; a8 r: @  Q& u4 L1 l
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)8 `( s+ G8 U) C+ K' X1 J2 B7 u

  39. 1 C+ a. M) i4 Y' j+ O; _3 o

  40. 5 m# n3 N2 K1 G- J0 O* }
  41. 4 H+ }. A" h# `
  42.                 //Start DekaronServer.exe 8 q8 j! {1 ~+ l6 p
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx5 N7 M- R9 ~& M0 w; x
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    9 r( E" @$ F7 L. e& [  O% t; E
  45.                         szCmdline,        // Command line8 O6 i" l7 z# j1 M4 x
  46.                         NULL,           // Process handle not inheritable
    : b* q: k+ ^8 c  Z
  47.                         NULL,           // Thread handle not inheritable  X1 C0 t( Y9 j4 ~% z
  48.                         FALSE,          // Set handle inheritance to FALSE" l# K, \" `5 c/ [% Q' B
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    7 {6 h7 q6 H* X: w
  50.                         NULL,           // Use parent's environment block( u( |2 ~4 R6 C8 X- e/ K
  51.                         NULL,           // Use parent's starting directory
    9 K% j) d8 V: ]- s
  52.                         &si,            // Pointer to STARTUPINFO structure% d9 G: j% U& F5 A4 J' Z
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
      Q$ d: n2 _" }3 b) r
  54.                 )
    . N7 P2 `1 w9 O( E
  55.                 {% M6 |( a/ q5 }& ^* ~
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    ! r- e9 @' d9 g( a+ v8 B& l- |
  57.                         return 0;; X, }% ~" Q! v5 U
  58.                 }
    ; ~. j$ H/ l& N6 q$ G
  59.                 //Creating Process was sucessful
    9 n% \( u/ X; _  l# U- ]+ o
  60.                 else0 B% \; Q, p  T
  61.                 {
    / E$ x7 c& z  h- i
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    6 ^5 h6 }9 ~, z! C" }) \: ]# G3 `
  63. 1 ?& N' D; k* z% T2 q  z0 U1 C$ ]) s( C
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    - U5 R# E, k* \8 ^& M+ h1 a
  65.                         dbge.dwProcessId = pi.dwProcessId;
    7 F! N6 K1 O4 D3 ~( N# M9 A
  66.                         dbge.dwProcessId = pi.dwThreadId;
    " E0 E8 X: X& C

  67. - E$ {7 C  b) u2 e  l4 \/ f
  68.                         while(true) //infinite loop ("Debugger")( ?" d' V# P4 ^% I& k5 B. C
  69.                         {7 A- x* P, f: ~/ b! X" q5 y
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    & }6 S! N0 h7 N- q; e

  71. 4 Z$ U" P# Q( l% E6 O) S
  72.                                 /*
    8 d) n" g4 _- R, ?
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
" |7 |* K1 ~3 ~, X$ ?- D+ f9 o$ ^1 Q: W

' i0 O3 M: o0 r4 h6 E' A" l9 r/ v6 R4 e4 f5 S  u: T
商业服务端 登录器 网站 出售

15

主题

257

回帖

1231

积分

金牌会员

积分
1231
金钱
894
贡献
60
注册时间
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

主题

207

回帖

352

积分

中级会员

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

15

主题

257

回帖

1231

积分

金牌会员

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

3

主题

102

回帖

7117

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-3-22 14:06 , Processed in 0.039187 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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