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

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

[复制链接]

156

主题

354

回帖

6593

积分

管理员

积分
6593
金钱
1912
贡献
4171
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
3 \' P" O7 I4 J& j" b" W' g/ t, r. a( J+ c; b. Y: O' A
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。. K. M2 z. f5 c

# s* K- m; ^2 T$ _4 q$ z) e4 k
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    3 p$ z9 h, g2 W
  2. //
    3 u  f. b1 m- g4 Y- ^. R$ r
  3. 7 G9 N7 e2 d5 q. F8 ]; m6 M  @
  4. #include "stdafx.h"
    / Z1 u9 K5 Q3 p- t
  5. #include <iostream>& O% I3 p7 K2 Z- x% ]6 X' U
  6. #include <Windows.h>
    2 e+ f& \' u& p; Y8 N
  7. #include <io.h>
    ( z8 B( g$ G& I. u. B6 H

  8. 7 g5 V1 V0 f% H

  9. 8 D* }" ^; p2 H' `0 I
  10. int _tmain(int argc, _TCHAR* argv[])
    8 }# \& s& Q* j/ S
  11. {+ z0 [) U# [* G. p& c6 h
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    6 U: P* W8 V* D% Y& Q# B1 n! X3 \

  13. ! m5 y6 f0 Z  W1 Y. J9 ^7 p
  14.         //查看文件“DekaronServer.exe”是否存在
    # P+ U3 b0 g7 T: j) R
  15.         if(_access("DekaronServer.exe", 0) == -1)
    ; {# r$ g8 f: z0 p
  16.         {- }5 a$ F+ {6 a  m; g  T0 e
  17.                 printf("DekaronServer.exe not found!\n");
    , f# B  z! O5 f) j( t1 z: Z
  18.                 printf("Program will close in 5seconds\n");0 t0 [( U# h9 T3 z
  19.                 Sleep(5000);" _* D& G, s/ p6 E1 @  N
  20.         }
    ' c. S4 i' r; {! ^
  21.         else0 j8 L( \9 c9 x3 `  @3 _3 e
  22.         {4 e( Y  W4 E( \
  23.                 0 u. n4 V" \. C) r  E+ ~
  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 N; V+ I3 d/ k
  25.                 STARTUPINFO si;
    ) u8 N# v) T% t" v* m7 G

  26. 1 H( r! a$ @9 v! Q1 l/ }5 J
  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).aspx0 L2 d# g) A& y
  28.                 PROCESS_INFORMATION pi;
    , B, C7 T  C. T6 Q) y8 X

  29. ) p$ v2 x5 Q( ]' ]; d* [
  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( o  R! c' `6 e8 `
  31.                 DEBUG_EVENT dbge;/ t4 ]. y9 }) X

  32. 4 [! f* y8 J. T7 M7 ?3 v: i
  33.                 //Commandline that will used at CreateProcess0 U; t" D& y8 K1 |
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    : g( Q( s% p" M* a6 }5 p
  35. % w- C' r  n2 r( ~
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    3 n$ T9 W* b4 J7 }
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    ' f$ h" H( {0 P) e
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)! d& d4 W1 f0 I% M; d- p

  39. 4 u9 R/ J% K$ @* d! t

  40. 4 n; g( _; q+ H! n- C8 J9 ?$ f) W7 P- q
  41. . z7 O8 A! F. l7 _- k  t- U
  42.                 //Start DekaronServer.exe
    3 h8 a, W  m) Y- u5 l# D! Y( I
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx" ?: C; T8 |. C* i, X
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)! k( {, Q7 ?% V2 C. }. F1 z- d0 c
  45.                         szCmdline,        // Command line
      V5 G- C" f: s! w$ I% [
  46.                         NULL,           // Process handle not inheritable7 v, F  d: p1 h) s
  47.                         NULL,           // Thread handle not inheritable- M1 a* h4 ~' r
  48.                         FALSE,          // Set handle inheritance to FALSE9 W7 T) D0 ]1 t" e# O7 G
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    ' y. e9 G( F7 x/ s# U. s
  50.                         NULL,           // Use parent's environment block1 H  J1 m1 w) t5 _$ ^* W2 @
  51.                         NULL,           // Use parent's starting directory ; G( _. x' o0 Z1 ~  L. X
  52.                         &si,            // Pointer to STARTUPINFO structure
    , q# H  C2 g6 ?+ g
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    $ j: A4 _3 H8 a" n
  54.                 ) # v: @) o) @; y. T
  55.                 {
    8 G4 l! {. t. @  j
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    2 D  }0 H( w5 U/ G
  57.                         return 0;
    ( K8 ~9 z( ?( J- [
  58.                 }
    ) A& ^! ]- _' `; q. p6 g
  59.                 //Creating Process was sucessful" @( I' D9 l/ K
  60.                 else
    5 m6 T- F  Y+ w& h8 `0 {
  61.                 {
    + z# P) s5 q: @1 Y- h+ \- n5 A9 e: e( m
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    9 n* e4 c0 N% I+ j. }8 ~

  63. % c  V( n. y% s$ Z
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure. @5 V7 i9 j2 l% \8 f" \
  65.                         dbge.dwProcessId = pi.dwProcessId;
    . y' o- b0 \7 d! x7 C- D& p! ]
  66.                         dbge.dwProcessId = pi.dwThreadId;- M7 H- X2 n. B3 k0 w
  67. & ?" s7 g4 v  U
  68.                         while(true) //infinite loop ("Debugger")
    0 N) }4 C( K* ]- c6 ^6 C# }
  69.                         {
    9 g1 ^0 E3 \  D( E( x4 l
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx* c0 R4 q. _6 o+ E. X
  71. ) u' x6 O) f" L7 O+ O/ u. Y
  72.                                 /*
    5 o! s7 ?' p, y; d
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

; ^5 G& {1 w# L& p, I/ O$ X0 p' P9 X! ]! G' m

4 _& P1 H1 s. O5 P0 g
商业服务端 登录器 网站 出售

15

主题

256

回帖

1250

积分

金牌会员

积分
1250
金钱
859
贡献
115
注册时间
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

回帖

1250

积分

金牌会员

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

3

主题

102

回帖

6181

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-29 00:27 , Processed in 0.062721 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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