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

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

[复制链接]

155

主题

348

回帖

5970

积分

管理员

积分
5970
金钱
1862
贡献
3605
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
0 N( e# f; q' t' w* }$ B1 w
8 b5 R% P/ t0 h虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
2 z" l; E# z  N$ h$ O& t$ Y& C! f+ v( s2 E. U* {
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。1 O5 c% [' b( Z9 F
  2. //7 _, K" ^8 {4 H$ z2 D

  3. ) v7 K% ?) j( r/ k
  4. #include "stdafx.h"
    6 q) o9 Q, W6 x- ^4 C, R9 V$ g: r
  5. #include <iostream>0 S' P! j0 N, z; o( G
  6. #include <Windows.h>' E# L) |) L3 ^- d' m, ^
  7. #include <io.h>
    0 n4 A  }" ^, r* I  {) C5 H6 W" W
  8. 3 s2 d: P- X/ V
  9. 8 Q/ S- ?1 T" t3 g: c
  10. int _tmain(int argc, _TCHAR* argv[]); m# O$ Z/ z" U7 z' i
  11. {: U- s0 v5 {3 Y$ V* L1 v; J
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    ( z5 V/ k" Q* L2 Y

  13. 8 D  U1 o% V1 Y2 L' x
  14.         //查看文件“DekaronServer.exe”是否存在+ d. [2 H4 E  S7 ~4 T
  15.         if(_access("DekaronServer.exe", 0) == -1)
    - g/ n6 s0 G, m! Y2 h
  16.         {
    ; N2 H4 i" V# F7 g3 x/ P9 ]
  17.                 printf("DekaronServer.exe not found!\n");5 R; l# k/ o8 p1 w: g
  18.                 printf("Program will close in 5seconds\n");
    - a& A' K; N) H
  19.                 Sleep(5000);) r. e' Q6 c# F3 R8 Z% B$ G( [
  20.         }8 ^" g" t8 W* n# E8 T3 \
  21.         else
    / p4 R/ l3 e" {" C
  22.         {4 l$ v5 d5 N8 n* X# {, ~( B! F1 V3 b
  23.                
    7 c( `9 ?0 i. X. d% ^
  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 ^6 T; R/ N$ U
  25.                 STARTUPINFO si;
    0 I. @- j4 p3 o8 [& g/ Z
  26. 1 l- l& n2 f9 H7 [/ 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
    + I: S0 y8 R/ ?/ P' F
  28.                 PROCESS_INFORMATION pi;  v4 v; C9 L" q7 _

  29. ! l2 w( [4 A/ z3 n1 K3 [
  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( b9 N
  31.                 DEBUG_EVENT dbge;
    2 X- g' j' n2 X) L

  32. 3 l+ C* L, c) H( @( R! P; p3 S; ?  a
  33.                 //Commandline that will used at CreateProcess' V3 u+ H6 ]) T" g( V: n( o
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    - u, Y0 [; F, [

  35. # ~: I  Z. O9 G4 x3 \
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)5 ]: {+ @" C0 Y
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    9 V$ R4 y9 c# b  L2 K4 v/ M( u' V
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)7 h) }& l5 Z4 y! j  F: _& g# e9 p

  39. & M( H0 W# e* _
  40. ( P0 ]& v; c0 c! f( d  D  C8 l+ `! z
  41. ; y# r. a. H% G1 N; U
  42.                 //Start DekaronServer.exe
    : n$ L/ n3 e* I2 L4 T6 _
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx0 C2 \" D& i; S+ b5 s9 g! `
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
      ]5 K" C* T2 k
  45.                         szCmdline,        // Command line
    5 @; ?& ?: g  D( L( |: l; R4 P. K
  46.                         NULL,           // Process handle not inheritable
    / R# V& b+ }+ j4 u; N* i& M: V0 ?
  47.                         NULL,           // Thread handle not inheritable. Q: q6 x6 G4 T7 K
  48.                         FALSE,          // Set handle inheritance to FALSE0 ^5 W  ?/ u4 z* K" k9 W! n
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    8 b) t) f9 {( K; s
  50.                         NULL,           // Use parent's environment block
    1 b: v. w: l! f/ U- E, S
  51.                         NULL,           // Use parent's starting directory
    , P3 l( `. j+ Q6 {5 F0 H; T
  52.                         &si,            // Pointer to STARTUPINFO structure
    / F1 s4 E. X6 A! i
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure) M1 c- c4 u: Z# R9 j, d* f% R
  54.                 ) 2 D; t; `! s# m  L: v% H+ U: G
  55.                 {
    4 |6 r9 X* G/ f" o. m5 b) \1 t' f1 ^9 ?
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );* v$ C9 f: E# {  U) c
  57.                         return 0;
    6 s6 f1 |6 D  o$ U+ J! h$ J# h
  58.                 }
    7 p- ?( q$ t' j% n
  59.                 //Creating Process was sucessful6 v9 b$ f6 d; h) Z! v/ i
  60.                 else
    2 k* c9 H" v: @9 @, m8 x% E
  61.                 {
    1 @1 y- K+ m' _
  62.                         printf("Sucessfully launched DekaronServer.exe\n");/ k+ d+ L. @  m% o- S0 e- x* `- N

  63. ; Z$ r/ ?7 L' n  l3 O
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure% ], z4 v3 h3 a: Q' V
  65.                         dbge.dwProcessId = pi.dwProcessId;- ]! s% m) _  S
  66.                         dbge.dwProcessId = pi.dwThreadId;1 h7 w2 o. _  y0 g

  67. 0 r( Q# J/ ?) f- W5 h$ x7 g
  68.                         while(true) //infinite loop ("Debugger")
    ; {) ~1 L& U1 W" L
  69.                         {
    0 c' {. Q" v% i& ]* C3 i8 b' e
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    % ^* }7 O! h8 L3 z
  71. 4 b# A& U, k( s- b
  72.                                 /*
    4 o9 m. Y+ i) c4 c* W; ~' Y6 n
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
5 D1 D& H) E6 u9 C3 p
1 c! I' [) U& A. [2 m, ~

7 c* S, j9 L. u, u, C: w' {
商业服务端 登录器 网站 出售

13

主题

251

回帖

1239

积分

金牌会员

积分
1239
金钱
812
贡献
158
注册时间
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

主题

205

回帖

345

积分

中级会员

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

13

主题

251

回帖

1239

积分

金牌会员

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

3

主题

99

回帖

5713

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-26 23:12 , Processed in 0.086852 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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