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

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

[复制链接]

157

主题

362

回帖

6846

积分

管理员

积分
6846
金钱
1946
贡献
4381
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) : y& A1 ]# \/ X7 t. w
5 ~6 h1 v4 F9 i* q: m  s! Y
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
  U5 k2 S5 y6 G0 [) b, j1 h- R5 g. [/ Z6 ?
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。0 a; o0 R$ |& {+ o% D
  2. //
    % A, s  a+ o  `2 [2 s2 n1 @

  3. , W& C  N$ p: h; G- G
  4. #include "stdafx.h"
      u% S$ s/ ~$ Y0 U) |' t4 x
  5. #include <iostream>
    0 s8 y+ W: ?3 I# ^3 h
  6. #include <Windows.h>
    & C% j' a8 m7 z. o4 }
  7. #include <io.h>3 h! \/ ^6 X% T2 v0 V$ A8 X
  8. 9 W" U8 L5 l6 f& b  x, d) `
  9. 4 ?6 _/ f1 G; ~. J4 [
  10. int _tmain(int argc, _TCHAR* argv[])
    / W* z- k8 P9 K9 }2 {7 ~
  11. {
    , U' i/ F( U/ Q$ Z1 b# c2 U
  12.         printf("Dekaron-Server Launcher by Toasty\n");* }/ ?; |8 J* p

  13. ; E: Y* X  F0 y1 `% {
  14.         //查看文件“DekaronServer.exe”是否存在' Q4 J! m$ x" x# C
  15.         if(_access("DekaronServer.exe", 0) == -1)
    6 U$ d6 Q) F* i9 L
  16.         {- ^: A% Q2 ?5 a1 a9 h; t
  17.                 printf("DekaronServer.exe not found!\n");5 Z3 |2 v2 a4 j: ?3 j& ]
  18.                 printf("Program will close in 5seconds\n");& I9 [- I2 k4 F+ L/ s6 g
  19.                 Sleep(5000);/ E9 S: z/ P- H, u, \0 m, u
  20.         }
    ( v+ W. J. M1 \% g7 |
  21.         else
    7 T3 Y7 k( o1 s5 R
  22.         {
    5 o3 X' U9 h! g" j- C
  23.                 0 r2 Z8 @' U  t# I: r4 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
    2 l/ j4 F) }, v, x3 E6 B5 z8 c
  25.                 STARTUPINFO si;
    # \" b+ A2 _5 R$ p3 ?

  26. - G' o" B4 v- D9 j. P. Y2 n' t* y
  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
    9 L: D6 L3 i! k9 W4 ^
  28.                 PROCESS_INFORMATION pi;9 r1 D( o, ]: N% _' P

  29. # m9 q* o4 T* ], K
  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
    0 d3 G/ R( M! x/ L$ u* j/ D
  31.                 DEBUG_EVENT dbge;. O# o  L2 r/ u  D
  32. ( s2 ~$ |7 S' K7 Y
  33.                 //Commandline that will used at CreateProcess
    ! O) K- E1 F8 f
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    1 J" N# w( K- f' e: K
  35. 0 r1 F8 w8 p. G
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)0 N" J' S9 _1 H7 Z) M9 M1 o6 \
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)# i/ d$ y1 l, ?
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)7 s2 I) c6 H0 z
  39. ; C5 C2 ^3 m1 Q  A( G. t2 k

  40. # Z+ y' q9 e" s- Y
  41. ; R1 d- y- X5 u. C* c
  42.                 //Start DekaronServer.exe
    + y' y5 x" ~+ E2 j) V
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    ) U$ C5 w7 \9 N) a+ T* Y
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)6 K* V8 n# A0 P; y  f) L% f0 x- q
  45.                         szCmdline,        // Command line
    5 F0 n$ n0 u8 J* ^, L/ G+ `
  46.                         NULL,           // Process handle not inheritable% J5 ~' A: R7 z
  47.                         NULL,           // Thread handle not inheritable
    6 L, q  T/ H1 e8 U2 Y
  48.                         FALSE,          // Set handle inheritance to FALSE: T- K, r! T3 h8 G
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx! m3 {  Z# J( D5 _
  50.                         NULL,           // Use parent's environment block
    8 S* C. P7 E' ?& ]5 d6 N# \
  51.                         NULL,           // Use parent's starting directory + K, V. {! C- Q: n1 j
  52.                         &si,            // Pointer to STARTUPINFO structure
    8 Q9 S7 G/ j8 R/ k% l
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    5 ^* M$ C% n/ L  j! Y7 \4 R5 H3 ^
  54.                 )
    3 S0 S; B4 B3 `" o# D* K% _$ f
  55.                 {
    - ~9 U1 S7 U  y% d' o
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );1 Y3 m% r  e- U% `. @7 }
  57.                         return 0;
    + V) o8 l. c7 a. V/ v
  58.                 }4 ^6 o( G& N4 m  I1 _
  59.                 //Creating Process was sucessful7 `4 g2 {7 i) _6 m6 o8 W
  60.                 else
    1 C0 n4 O* R" m- O# i
  61.                 {
    5 c# U) E, B2 w) q$ L
  62.                         printf("Sucessfully launched DekaronServer.exe\n");5 x& a1 o' `- _4 I8 z% I0 I
  63. ! Q/ Z5 i: U9 I8 j8 E+ S# y
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    , D; d1 W5 T& J( K  c/ R
  65.                         dbge.dwProcessId = pi.dwProcessId;: }7 ~! l3 \+ v& u7 N
  66.                         dbge.dwProcessId = pi.dwThreadId;# J* T6 Z9 V1 M/ ^
  67. 7 j$ F; p; N  z" o, F# ?
  68.                         while(true) //infinite loop ("Debugger")% o/ \; j; }0 s& X8 [- j7 p: w
  69.                         {" [+ r2 W( ]- j6 b; d: f
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx* M1 q( l  \( L) _) y
  71. # P+ U3 C1 w  t8 B
  72.                                 /*: E, w! {  b+ f/ U4 D- I1 A
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

. a4 h% D# O2 X' q* e1 J$ V$ m) n" g+ o* \4 e& w

: X! f- U- ^& N! z" f
商业服务端 登录器 网站 出售

15

主题

256

回帖

1274

积分

金牌会员

积分
1274
金钱
877
贡献
121
注册时间
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

主题

256

回帖

1274

积分

金牌会员

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

3

主题

102

回帖

6594

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-19 22:41 , Processed in 0.056845 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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