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

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

[复制链接]

150

主题

299

回帖

5277

积分

管理员

积分
5277
金钱
1689
贡献
3139
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 4 N( m$ J  J+ W1 H! c

7 P, h0 C5 ~% g7 [$ _7 E( X- j# @虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。; g5 F. r" w: U  I
0 T8 c5 s! e+ w! ]8 Q
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    0 K1 c9 [- M: `- s/ E0 P" V
  2. //. z0 \$ @6 q4 |8 V

  3. ! t2 p- L0 X# I# ^+ S
  4. #include "stdafx.h"
    ! w7 }# ?! L6 m( w/ a
  5. #include <iostream>
    9 \& ~6 t7 O% q' N/ X
  6. #include <Windows.h>  X: H8 |+ L3 e: Y
  7. #include <io.h>
    9 a# [' [# {/ y6 E$ m2 M( G9 d  C
  8. & q" V0 w4 I+ ]& [# x- O, ^9 a  Y

  9. 7 g/ j  j( D2 `% h3 L4 e
  10. int _tmain(int argc, _TCHAR* argv[])
    7 P+ J$ W& ^. I) R7 S: ^: I
  11. {
    & }) y& m3 r( |
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    + b1 I9 N/ Z  F% w+ p; r

  13. 9 n8 V; {  n( U5 C, N& s& C+ G9 A- y
  14.         //查看文件“DekaronServer.exe”是否存在
    ' U: T4 s" e6 h! {$ C, j6 p
  15.         if(_access("DekaronServer.exe", 0) == -1)
    $ o7 k+ [) c7 y) n
  16.         {7 k" @7 E3 s& m/ Y& M' G
  17.                 printf("DekaronServer.exe not found!\n");9 K5 S$ h; S. f* M) ]
  18.                 printf("Program will close in 5seconds\n");
    # w. H$ w; |8 a$ p' }
  19.                 Sleep(5000);  E8 @# R+ |+ `, v) l8 _
  20.         }4 y( a" H; d( y8 S* Z& d# s
  21.         else
    # O) q& S5 P7 w' k! s& C, P
  22.         {
    & Y. T! L; k2 D# R+ T, z& y) e" K
  23.                 2 p+ m! {- W+ H# {9 H, U+ p
  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/ s0 d- e7 H4 }6 y0 T7 c/ v/ l0 t& V
  25.                 STARTUPINFO si;
    ( a: J4 g5 r0 ^5 L9 h

  26. / E# `# K2 w4 j  }9 d8 R; f/ a: n) |4 \) S
  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$ Y. [# A) B) L: D# D8 }8 P
  28.                 PROCESS_INFORMATION pi;
    0 f% f: q4 a+ b, _! ?- m, l
  29. & r+ B' T2 E( k8 }; 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).aspx9 {( m+ M# v; Z8 I  X; T
  31.                 DEBUG_EVENT dbge;( L% e7 \8 \; h: l

  32. 1 f  e) O  n; V' C& ~
  33.                 //Commandline that will used at CreateProcess0 N7 e; B  X" P6 T2 {* D3 i# e
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));+ l# K' N8 {' j8 O
  35. " K+ D; D$ l0 T
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)1 a- O. i1 f! O
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    " z+ D0 T3 {* H
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    & ]% G& x3 c7 N* O

  39. 4 ?- t8 C2 E0 c9 }& X

  40. / p( d: V, \3 }4 N( a$ _: }

  41. 9 k. x6 Q) M( Q  C; l
  42.                 //Start DekaronServer.exe & q. y( E' q; _
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx% h1 m8 ~* q, d+ F5 C2 y, u
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    7 H( I: P4 w* W6 N
  45.                         szCmdline,        // Command line& n2 Y& f( s- `# c, n4 K2 l
  46.                         NULL,           // Process handle not inheritable& X2 |! F9 u6 F' f6 G) k8 B
  47.                         NULL,           // Thread handle not inheritable
    ; x7 q. q. _% B
  48.                         FALSE,          // Set handle inheritance to FALSE
    ) x+ H# L# U: {! l. [; K
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx: U7 x  h" U, V3 f6 g& q: h
  50.                         NULL,           // Use parent's environment block
    ' H- y7 o) Y) V; t# S
  51.                         NULL,           // Use parent's starting directory 2 g9 T$ G. B% D# Z& X
  52.                         &si,            // Pointer to STARTUPINFO structure: S4 j5 ~% |9 x4 Z. H
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    7 B) ~( C6 @, s
  54.                 ) / c# l/ W1 d1 [- h$ E8 ?/ ?$ [
  55.                 {/ z8 G+ }/ V) P3 E/ u
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    % q, k: J5 p4 e- f- [: n
  57.                         return 0;
    . E+ _/ w/ P! K$ O6 m% ]
  58.                 }8 U& \+ z* h( W" H* {% I
  59.                 //Creating Process was sucessful
    % d  A4 I/ u! I5 F1 o" c7 s
  60.                 else
      j" M" e7 }% B/ M! {
  61.                 {
    ; z4 X# E# k- n9 K
  62.                         printf("Sucessfully launched DekaronServer.exe\n");3 l9 f8 R' D0 H( s
  63. 5 b; h3 ~8 B% s5 I( e! ?4 q
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    ) e4 {# G% D8 O4 r
  65.                         dbge.dwProcessId = pi.dwProcessId;+ F) [% b8 ]5 C9 x5 E% V
  66.                         dbge.dwProcessId = pi.dwThreadId;
    9 ?2 ^$ V# w* _( a) Y) u! I

  67. ( O0 ~7 O" W# Q, K  G
  68.                         while(true) //infinite loop ("Debugger")
    $ D" F- d* o( c6 Y/ U7 Y% H
  69.                         {
    0 I4 r5 T: n2 d
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx5 Z/ X9 c( O( n1 F) L0 @7 K( [

  71. 8 N! S- {  I6 M9 K4 k# B
  72.                                 /*! o. J( x! H! N
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

+ R% T/ X# O: Q9 A) L. K3 O  {$ \5 o- M' \# _" D- g
. K- R- C" B  r1 x! U
商业服务端 登录器 网站 出售

11

主题

246

回帖

1137

积分

高级会员

积分
1137
金钱
725
贡献
150
注册时间
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

主题

204

回帖

340

积分

中级会员

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

11

主题

246

回帖

1137

积分

高级会员

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

3

主题

97

回帖

4172

积分

金牌会员

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-10-3 07:04 , Processed in 0.047803 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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