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

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

[复制链接]

157

主题

361

回帖

6695

积分

管理员

积分
6695
金钱
1935
贡献
4242
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
# q8 ?: W  W7 r$ G: P( d4 O& Q+ A  a1 M& U  V+ I0 n. @
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。' U2 y& P3 n( |5 q% ]3 n! N0 r
) G$ v8 [6 z+ o7 l1 n
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    5 ?) K$ w0 `/ G9 y- u, a& P% |
  2. //
    1 ?% \! X0 o- e0 R8 M
  3. - h% j7 I6 w- q6 q; v( `( K
  4. #include "stdafx.h"
    , ^$ N: c$ \. y
  5. #include <iostream>
    - \4 L1 O7 R, Q5 u( _( @- z
  6. #include <Windows.h>
    * y3 h" l# X8 ?- {& a/ R" a
  7. #include <io.h>
    ; X2 K+ _; t& G# ?1 W4 U7 f" X
  8. ( r3 h5 u4 y- k9 J; a; I( D, _

  9. , V4 o1 O1 t3 w) o6 s2 j: t; q
  10. int _tmain(int argc, _TCHAR* argv[])
    8 f2 ~3 t/ \+ k, b8 ~' @' a
  11. {
    % [% C$ u6 s) x0 Z! ]/ p, J
  12.         printf("Dekaron-Server Launcher by Toasty\n");9 |' _; J$ t' E& _- ~+ V* o
  13. ( r' A7 c8 C! \6 b
  14.         //查看文件“DekaronServer.exe”是否存在
    + w% L8 |9 v. e  ]9 U( K/ Z; Z
  15.         if(_access("DekaronServer.exe", 0) == -1)
      |, \" O  h* H$ O+ y) ]1 g
  16.         {
    9 x7 ?$ Z( [5 J3 k, v
  17.                 printf("DekaronServer.exe not found!\n");
    ( j3 x/ A7 d& U1 ^
  18.                 printf("Program will close in 5seconds\n");# W: J# a  X: P) F
  19.                 Sleep(5000);/ O2 P! u. W- I/ M, _2 T. T
  20.         }
    : B) q- ^* @# P2 T
  21.         else
    2 Y) ^: n7 P  P4 l2 g
  22.         {! U6 c. f/ ^& d, M; |: @# @. T
  23.                
    9 m: M" I" _5 l- H' A" c5 \
  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
    ; E' m. Y3 k- M
  25.                 STARTUPINFO si;
    ' I  q) _8 n7 I1 k

  26. 0 b8 ~) y4 ^% v% @- ]+ P
  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
    & s8 {) Y# s# L! s* [# p) S
  28.                 PROCESS_INFORMATION pi;
    * ~" M5 {0 z. C& }* q4 {8 v, \- f

  29. * r9 T$ E0 O9 N# x
  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).aspx9 x6 u+ {% h6 R; h$ a
  31.                 DEBUG_EVENT dbge;
    # P" K1 Y4 L7 N8 H- n
  32. % C, }  |, v+ B0 K
  33.                 //Commandline that will used at CreateProcess9 o2 H7 W4 l1 a& s. h+ v
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    ! R. m5 t" ^3 I3 F
  35. * `( }  F! J. d: p* B
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    7 ~+ S. U' B/ j& n4 _" S6 H! |# t: g
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)7 D9 N; f3 u8 V+ [8 ~. _
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    8 I8 t6 L6 v. ^7 s- U3 [( u
  39. 0 Y) ~" l" ?4 {" }* x9 `
  40.   W8 J, r% `5 [$ p( O' A

  41. 2 B. z- U, n" i" l% d6 o$ N
  42.                 //Start DekaronServer.exe
    9 \$ U+ ~1 V& k9 w* j
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    / r! i( I9 U# }! W4 K
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    - e0 S% D! M4 e0 S5 o
  45.                         szCmdline,        // Command line& r% Z4 J- q( k9 O5 L" F
  46.                         NULL,           // Process handle not inheritable
      }- O2 z, H! V1 }0 y
  47.                         NULL,           // Thread handle not inheritable
    ! z; D- q/ z5 r4 C! |# j6 r; B  P
  48.                         FALSE,          // Set handle inheritance to FALSE- T# f) E1 W5 U0 }
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx  B# U) Q" K5 A6 V- j
  50.                         NULL,           // Use parent's environment block1 T% R  Y6 x5 c7 h
  51.                         NULL,           // Use parent's starting directory 5 K' @! Z* h5 V
  52.                         &si,            // Pointer to STARTUPINFO structure, o' Y+ [7 ~0 Q: L5 x# r0 V9 ^
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure5 S. W5 O0 }* G! t+ t+ U
  54.                 )
    $ S& J; M  c" F8 R- v4 I: ?0 v
  55.                 {6 _& S* F( f1 v) ^2 ]
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );* I" e/ _/ J6 A. _7 y3 }6 o+ E
  57.                         return 0;
    1 @) K  ^# y& R5 l, G. F
  58.                 }9 r) ^8 \+ Q$ s+ V8 }; H! Z
  59.                 //Creating Process was sucessful
    ; G7 p/ ]3 `' h; i
  60.                 else& I+ d' ]9 C  n  _7 Z/ Z( [
  61.                 {8 [8 x& c; Y/ d0 H" ]
  62.                         printf("Sucessfully launched DekaronServer.exe\n");" f) A  m6 |3 C6 |' H
  63. ( H2 q& L# `6 D, w5 n
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    ) p* T2 R. t, z$ |6 w
  65.                         dbge.dwProcessId = pi.dwProcessId;
      `, g( b- e  x! @- M
  66.                         dbge.dwProcessId = pi.dwThreadId;+ ]& K+ o' b/ Z3 E7 L) ~4 @- e

  67. 7 `; B  \. Y! j# \" v
  68.                         while(true) //infinite loop ("Debugger"): @$ S6 Q* i4 c2 v
  69.                         {. E/ i5 h) r1 A+ g% p
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    ( y6 H. o3 N( I. u) r

  71. , q* d2 O7 ^/ z  T2 N5 V
  72.                                 /*, i% i4 y- l$ l, b  z# g6 L9 G
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
: z. W6 k  t/ u% y$ v0 f1 |, }
  k# ]7 f4 t2 K# r% z3 D) _2 e2 u
% q/ z3 ]9 s& L& h, M
商业服务端 登录器 网站 出售

15

主题

256

回帖

1259

积分

金牌会员

积分
1259
金钱
865
贡献
118
注册时间
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

回帖

1259

积分

金牌会员

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

3

主题

102

回帖

6421

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-9 09:28 , Processed in 0.061717 second(s), 26 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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