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

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

[复制链接]

155

主题

348

回帖

5959

积分

管理员

积分
5959
金钱
1860
贡献
3596
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 8 o+ w8 ]# G3 f1 ]! a

- Q3 ^) B& X6 v0 _) G7 W5 {虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。% _! t# s' z2 J5 [

( s, P3 c) T) a8 q
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    ) N* h1 ^) o  z7 y; n
  2. //* L& {6 e" u) }; k4 S, Y
  3. 9 q/ `5 M, _2 z6 D
  4. #include "stdafx.h"
    0 K% |- @/ q9 j7 w2 I: r
  5. #include <iostream>9 h/ Y* y3 r6 X
  6. #include <Windows.h>; S+ B5 E7 P7 G. c4 r! k
  7. #include <io.h>
      T" }; _' m6 t

  8. ) C; {" O% L/ l8 w( I. G

  9. 1 m; H/ K4 b- n
  10. int _tmain(int argc, _TCHAR* argv[])
    * E' a9 D2 t+ c
  11. {8 F: r, ^+ C  w$ o  m& z/ ?
  12.         printf("Dekaron-Server Launcher by Toasty\n");. Y) X8 {: ?! e

  13. $ Q* B; D* L! @8 Y% q: N
  14.         //查看文件“DekaronServer.exe”是否存在0 b# w6 k: L. [7 i
  15.         if(_access("DekaronServer.exe", 0) == -1)
    8 O3 E: M7 c# O6 T
  16.         {
    ( P7 m/ t; p$ B! @: b! i
  17.                 printf("DekaronServer.exe not found!\n");
    9 P7 `3 r% j# O' k, a6 P
  18.                 printf("Program will close in 5seconds\n");0 R5 A! F5 f7 k+ j, I/ g/ J
  19.                 Sleep(5000);) w/ w: N. w5 a/ o7 G
  20.         }- [% Y* ^# O& k4 i( r2 S# Z, A
  21.         else
    - }1 h, l) \0 E
  22.         {7 c% J: w& B% |) ?
  23.                
    ! n3 T6 {$ ^! @
  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
    & c/ }6 T3 ~1 F; J
  25.                 STARTUPINFO si;
    # F$ }& z% i, L4 a/ C
  26. # s/ t9 {; t4 o) j8 l6 c) ~
  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
    # i8 V0 Y6 n, ?+ b' t9 y. O* {
  28.                 PROCESS_INFORMATION pi;. e9 F& m/ S( u9 q

  29. 3 [) e9 v/ x7 }
  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
    : G; a9 }7 @1 W2 Y
  31.                 DEBUG_EVENT dbge;9 F1 L0 I# Y$ ~

  32. 7 q! r4 K, T, o  [0 l
  33.                 //Commandline that will used at CreateProcess& [0 @0 I3 m, Z% p9 H( @% K' w
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    2 @% P* C$ n6 m2 T9 E: ^9 y+ Y) T4 Q" z( ^

  35. - w3 }1 O  h4 Z. Q% Z4 L
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)( p. [& e( E& p2 \
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)+ }+ S) ~! _  t' s- Z3 J
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)* K; O  g6 b3 ?, P2 B# M- b+ z
  39. , K1 H/ X8 }. ]- m; W3 W

  40. ( \+ l/ @6 Z. u9 Y3 D$ Z$ v/ ~4 V

  41.   C, ?1 g& E$ S# [1 H" r
  42.                 //Start DekaronServer.exe
    . |* c' S/ w; D' V7 D
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    ' e9 `( I( S2 W9 @# a( c# O& X
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)' d5 T4 x/ n) |( d8 r  T
  45.                         szCmdline,        // Command line- k5 z. z7 V+ S
  46.                         NULL,           // Process handle not inheritable3 M9 U3 {0 Z$ J/ O9 T' D0 S" \
  47.                         NULL,           // Thread handle not inheritable( e& L. f/ ^5 J& N
  48.                         FALSE,          // Set handle inheritance to FALSE
    1 |4 h2 q/ S) @+ k9 N* m0 U4 t
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx" U! K, X% w2 w  N
  50.                         NULL,           // Use parent's environment block
    ( }$ |1 i) C0 w8 s5 H
  51.                         NULL,           // Use parent's starting directory 4 q+ k! N: x9 I3 `2 ^3 D8 ?
  52.                         &si,            // Pointer to STARTUPINFO structure: n1 S2 B6 t4 ]: l4 Q
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    # P+ O  {2 W, E9 ]" o
  54.                 ) # b7 Z' Q# w" @6 \' o
  55.                 {( F) J1 p7 X3 J' ~$ Z# q
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );0 V  B4 S$ S, V' J# |& B" s
  57.                         return 0;
    4 ~* _/ \7 M2 Y+ A$ i9 x( ]
  58.                 }
      E2 C6 K- [$ n
  59.                 //Creating Process was sucessful. ]' q8 q8 {" Z, F
  60.                 else
    , E6 f( q3 g8 h% m2 d
  61.                 {
    5 l+ k- J8 [# Y) `$ p
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    + i' ]5 N/ ]4 b, B/ g
  63. 9 v$ @2 y( t" b8 f5 d
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure) L* ?4 T( k! M6 ]
  65.                         dbge.dwProcessId = pi.dwProcessId;
    , _3 \; ]/ t6 {7 `
  66.                         dbge.dwProcessId = pi.dwThreadId;* h2 l+ \7 @& H
  67. , ~" q; I* `  r- G. ]- t+ b" l
  68.                         while(true) //infinite loop ("Debugger")
    0 g, L: }, f, F* j' R7 f
  69.                         {
    8 n, ~. N) ]3 Y9 Z. R' Q
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx; S5 U+ M8 z- R3 f$ ^5 i) k5 N" J8 D5 \  h
  71. . ?8 U5 K3 v1 ]& z, ^" M, E' Q1 P) ?
  72.                                 /*) s! |3 d: @* \3 B
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

1 I& z: C/ @" S  f* Z) \4 h8 _* L5 E' b" V

% z# s0 b; F0 @9 q7 j4 @& v
商业服务端 登录器 网站 出售

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

回帖

5673

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-25 20:37 , Processed in 0.121988 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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