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

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

[复制链接]

157

主题

369

回帖

7156

积分

管理员

积分
7156
金钱
2051
贡献
4579
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 6 Z2 j& `, A3 l8 S: v& j

: X+ j4 K' I0 C% f虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。2 ~% j- S$ }5 v  y( U
! t, ~& Z9 M# S4 s. i
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。! h" m, n' C; O8 @+ J, Z7 X6 }
  2. //
    , J3 `! f# B3 C- D" |

  3. & Q# F+ `' }1 e  G9 ^. _" l9 Y
  4. #include "stdafx.h"
    7 T, [* C! @9 g! `& |
  5. #include <iostream>
    1 E+ q0 U8 r7 {1 ~& V
  6. #include <Windows.h>
    ) l: X8 s' U2 Q' K7 e
  7. #include <io.h>3 _/ R" Z7 o7 {- b
  8. - t. z0 k( H- g* `. @4 A# O. T
  9. + e5 n- E! E7 Y. K( ?" l  k
  10. int _tmain(int argc, _TCHAR* argv[])* F% B# i: [: u- ^- V
  11. {9 W1 X  m- N' }! J/ W. J- g7 n" Q" b
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    ) b' E" x8 S0 t
  13. 2 t# b: x# x% n
  14.         //查看文件“DekaronServer.exe”是否存在4 U7 V" t% s% w9 |% [
  15.         if(_access("DekaronServer.exe", 0) == -1)
    ( q5 P- B, ~6 Y
  16.         {+ e! J! s1 U8 b, Q. n( B
  17.                 printf("DekaronServer.exe not found!\n");0 o% a5 H+ g. E# u" q1 I, I
  18.                 printf("Program will close in 5seconds\n");
    : q8 u" W8 ]0 C$ m1 n
  19.                 Sleep(5000);
    # J: m/ _! p; e7 z: d+ E6 L6 }
  20.         }8 o! o1 n! K/ r% g( e, B
  21.         else
    9 z) F9 x# Q2 P: Z4 ~: D
  22.         {
    ' n( F) }; W- L3 ?* D
  23.                 3 I4 p/ J: r' L% E) i& h
  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
    " Y' j7 S( \$ ^' R
  25.                 STARTUPINFO si;
    : {. [5 z( l  F! [" A( X

  26. ' X( y- U% Q3 I1 M
  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).aspx2 K4 R  d5 h1 s" p2 G
  28.                 PROCESS_INFORMATION pi;
    1 L! P. i* D, b  g0 o2 N2 r
  29. $ a3 w, Z' f: W8 Y' a& j
  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 S; [  ~  t. t" R+ g: I$ J) ]
  31.                 DEBUG_EVENT dbge;
    : t' d, e' x/ {7 C; P
  32. # x; }4 n# M! a4 U7 i
  33.                 //Commandline that will used at CreateProcess
    2 K8 w$ i) c/ g+ }$ w+ H+ q
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    * I% c: D3 f( ]8 _- H# f
  35. " t' ~. z9 B8 E% C: \" G, u% s  T
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made): R5 e; N7 b, {( k' b; d8 n
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn). T4 y$ b$ b' D0 k# e% b
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made), y4 Q5 r$ a( _' |8 A, r( F& ]7 g3 _

  39. 8 T6 ?- B7 O5 e& }. w
  40. 6 \% D, N0 B% D) _" p+ h+ p
  41.   q" z9 [! q9 z7 x! e( u
  42.                 //Start DekaronServer.exe # c' i6 c9 K6 e+ z! o
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx: N. X! j: e8 ]  o& r" d# N. a
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    0 O+ E1 M4 g$ d) C7 c( E, H6 L
  45.                         szCmdline,        // Command line. M3 A  M3 v' Y$ r. T( |0 p% ^& b9 `
  46.                         NULL,           // Process handle not inheritable% w1 ~: b- z7 B) i, r7 i4 m8 T1 ?
  47.                         NULL,           // Thread handle not inheritable
    6 P6 g- a8 q8 e$ e6 A! v
  48.                         FALSE,          // Set handle inheritance to FALSE- }, [$ [6 J+ J* O
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    % a4 K5 y: q* ]
  50.                         NULL,           // Use parent's environment block
    * _: y  X; p0 v& l
  51.                         NULL,           // Use parent's starting directory $ q$ z0 c, v1 K2 v
  52.                         &si,            // Pointer to STARTUPINFO structure7 l( V7 f0 A4 b# N0 n
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure6 M) ~' g* `& L+ b1 M
  54.                 ) 0 N0 E* f7 n# X- c  v3 f
  55.                 {
    # e# [: D+ E' |9 Y* P+ B
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );* B+ f% B8 Q) p1 a* J
  57.                         return 0;
    ; j6 w' A" B5 c3 l, k/ x, j
  58.                 }
      ^7 K. I& _0 k; _& g9 Y  _
  59.                 //Creating Process was sucessful) }( I  B1 I' `1 r) e7 b
  60.                 else0 j" R& f6 U0 p& R
  61.                 {7 }. z* x$ Y9 Q% p/ u) j
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    - S' A! }  Z- T/ u, r0 U) u4 m
  63. + j- a0 k' e. e# h
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure3 s" x+ j" I2 P$ P6 M2 H! ^
  65.                         dbge.dwProcessId = pi.dwProcessId;
    / P  D# k" m6 C& D
  66.                         dbge.dwProcessId = pi.dwThreadId;# Y  h, ^% w- L( O" U) d0 c4 r
  67. # I/ G2 B: k5 }
  68.                         while(true) //infinite loop ("Debugger")
    % F! J6 R- e" H8 e. M: i
  69.                         {: V* s+ ]$ M; X) [6 d
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx; G, v& w. d" O) i1 Q
  71. 5 j5 Y: t& N9 ^$ f) d7 h9 y( |
  72.                                 /*# ^* X7 ?; |% \4 e; p- Z
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
0 n! [4 m* l" g2 _# q1 n

4 K! H' w% ^! b0 ?
/ t4 y; s1 {# \8 P
商业服务端 登录器 网站 出售

15

主题

258

回帖

1245

积分

金牌会员

积分
1245
金钱
903
贡献
64
注册时间
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

主题

258

回帖

1245

积分

金牌会员

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

3

主题

102

回帖

7437

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-7 19:38 , Processed in 0.031988 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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