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

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

[复制链接]

157

主题

372

回帖

7194

积分

管理员

积分
7194
金钱
2070
贡献
4595
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
- e6 @6 c" x( K- j$ R9 t, _
# s  l  t; e! D" d# k9 c% n虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。  I& D# j; ?" o$ K% w

7 \0 C7 d- [3 o3 Z0 X
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
      ^0 N, r6 w& ]' o
  2. //+ o5 H. U: f: A3 M# u/ b% ~

  3. : e, F" K$ }; j4 @( m
  4. #include "stdafx.h"
    5 x/ M3 t/ |! Z& Y
  5. #include <iostream>
    # j; V$ T" f' X
  6. #include <Windows.h>/ `: O2 g" O7 {* O  E' ?- F) w
  7. #include <io.h>
    5 U# l! [1 v4 L/ j$ {

  8. 0 n! {/ P' r3 ~& E3 Q8 N

  9.   n% S0 D$ `8 j! h5 I( d1 K
  10. int _tmain(int argc, _TCHAR* argv[])
    4 a: |4 l# \; j3 O+ x; ~# ]- Q
  11. {
    & F1 ^7 ?( ^! P
  12.         printf("Dekaron-Server Launcher by Toasty\n");8 N% V: S) J5 Z2 j, }) Q8 i( n

  13. % u" z# f) D3 y3 [
  14.         //查看文件“DekaronServer.exe”是否存在
    & }  k: o% E8 \+ V) m
  15.         if(_access("DekaronServer.exe", 0) == -1)/ A; M+ k3 Z& R. A$ `
  16.         {5 I6 D% u. p- Y2 r  F
  17.                 printf("DekaronServer.exe not found!\n");7 Q- h) N( q4 E. {/ b; M
  18.                 printf("Program will close in 5seconds\n");
    8 B" T4 }; V1 a- T
  19.                 Sleep(5000);
      o  d# D2 O8 r- w1 Q6 i
  20.         }
    ; z% E# ~+ m9 x# ~: e9 Q. g8 P
  21.         else3 h6 |" B: v$ u: \0 V
  22.         {
    8 l" A8 v8 ]% R
  23.                
    ( R  B' t  r; ^# b2 S
  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).aspx7 L/ `2 u: h7 |
  25.                 STARTUPINFO si;
    # Z' A7 B" G* J  P- r
  26. ) ]# ~( M- |3 F  `( T1 I
  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! E( r2 E& p% F, k% z
  28.                 PROCESS_INFORMATION pi;! G2 j' C2 [/ A0 S9 @! s9 x
  29. 3 d6 }; ?- N$ u) v" \" T: d! n
  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
    1 C4 d( N% r9 `5 C
  31.                 DEBUG_EVENT dbge;
    & r0 h1 `) j- q9 g
  32. " a+ n  ~  N4 T* X+ K# O$ n
  33.                 //Commandline that will used at CreateProcess
    / l2 k: X) M5 ]
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    - g# A7 e$ a8 `# j9 Z
  35. 8 R& E: o( U) {9 Z  r
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    6 X  A& {# q" d# M: d, ~" e9 o2 |
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)+ K& o0 A5 S5 O8 c5 K4 N
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    4 }0 W6 r2 U' |+ X9 l, `. B6 R

  39. , R- `/ M8 S3 f/ H

  40. / g+ Q- E) E+ a
  41. 9 p; b# n+ ^" N9 p
  42.                 //Start DekaronServer.exe " s9 M) x' Q& p6 D5 ~! W- _$ D  W5 t
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx, J7 H: `( X$ q4 A% r& J
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    , [- _4 I! k, C6 i) V
  45.                         szCmdline,        // Command line
      w+ q4 H3 q% K2 N$ \, Q- x! P
  46.                         NULL,           // Process handle not inheritable
    ' V5 g, h2 b8 l. W7 V
  47.                         NULL,           // Thread handle not inheritable
    6 p# u* G1 y+ T6 H3 {4 x, O, b& V
  48.                         FALSE,          // Set handle inheritance to FALSE
    $ C* S8 h4 ^6 i8 S! @: Y
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    * R/ Q% m- i6 A- ~3 t0 r3 N
  50.                         NULL,           // Use parent's environment block& C( D( M6 J( r
  51.                         NULL,           // Use parent's starting directory ) T+ k5 {8 `/ I. g, l0 {2 ~( \
  52.                         &si,            // Pointer to STARTUPINFO structure. w6 F* V: F: k$ N- U" H$ z% f
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    6 V4 {6 _& r8 ^' x' _% F$ ^+ z
  54.                 ) , b- l4 |. J% X9 X
  55.                 {
    - ]" e) x) W: P$ W  C! a
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    0 B2 {# p8 F1 k  `6 W, h
  57.                         return 0;! u4 v7 ]+ ^1 o! R
  58.                 }( K8 [( d6 H3 [, M! y
  59.                 //Creating Process was sucessful$ O8 T, j) _, K8 l' ]7 \" @
  60.                 else
    / U9 w& k/ A: a) ^7 [" k6 _; j
  61.                 {
    & U9 {4 Q, `* T- t
  62.                         printf("Sucessfully launched DekaronServer.exe\n");* w" t8 R6 _4 P$ F- z+ D

  63. + G. U- |- e, j
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure. o& |/ h" o7 ?. S) j
  65.                         dbge.dwProcessId = pi.dwProcessId;
    6 o1 D+ p1 |* z7 @
  66.                         dbge.dwProcessId = pi.dwThreadId;, E) t0 i  |+ B

  67. " R9 z; E- x" _4 z+ i/ K, a* S
  68.                         while(true) //infinite loop ("Debugger")
    4 ^1 W) U7 \2 N+ f, _( x/ `
  69.                         {' [* ?3 f# C9 |  B3 z4 p. Q6 L
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx1 e% b: {& W- G8 o. o) e9 a/ p& f
  71. 2 p: V# g8 V: h: D- ?# X- K4 g
  72.                                 /*+ m2 u* ~% ~6 z2 G# Y& J0 C
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

' `0 X8 l7 U  ~, u5 e- P- Y+ j* C0 s
2 i: s/ ]8 [5 j
商业服务端 登录器 网站 出售

15

主题

258

回帖

1251

积分

金牌会员

积分
1251
金钱
907
贡献
66
注册时间
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

回帖

1251

积分

金牌会员

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

3

主题

102

回帖

7517

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-12 03:45 , Processed in 0.037569 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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