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

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

[复制链接]

154

主题

335

回帖

5777

积分

管理员

积分
5777
金钱
1815
贡献
3473
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) ' N% j+ U( V* d5 w" }/ ?

: f8 G, |) K! k* p# G& g虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。) t: ?* ?$ w7 T. _

! E' K- M1 v; r6 y+ _6 W
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    4 O: v# y0 \. p# _7 ^* d/ D
  2. //4 k$ F& M$ K- I4 I
  3. ( |* q7 ^) J6 g
  4. #include "stdafx.h"
    % {: F4 b/ a0 y+ L+ A% h; T$ A( \
  5. #include <iostream>
      C9 x* @% Q$ e; `# a
  6. #include <Windows.h>2 q9 x/ I7 z3 A" B3 c) @1 N' V3 W
  7. #include <io.h>
    1 l; h4 s% t6 `, Q

  8.   ~3 n4 t! A! x, e; d; {

  9. 6 ~7 {/ X6 p4 d
  10. int _tmain(int argc, _TCHAR* argv[])- m4 T% g% N, z$ B# W9 d4 ^5 w
  11. {
    ! w. B% f! C. e2 w
  12.         printf("Dekaron-Server Launcher by Toasty\n");! k' m  Y3 Z) T# U2 D8 h- I) [
  13. 8 A7 }/ a, r2 N, _: R
  14.         //查看文件“DekaronServer.exe”是否存在
    # k! W5 b6 G4 @5 N. M! r3 [
  15.         if(_access("DekaronServer.exe", 0) == -1)
    5 Q# C6 w2 V3 }$ j
  16.         {+ a$ }9 }' @! L" X8 u! J
  17.                 printf("DekaronServer.exe not found!\n");( x0 ?6 \+ T# N4 x; s# @* K  n' X4 G, S
  18.                 printf("Program will close in 5seconds\n");
    $ p& m, q) I7 o6 h4 R/ T. R
  19.                 Sleep(5000);
    % h2 f- n0 x! I( A7 i+ G
  20.         }2 N( n/ |+ {% \/ t
  21.         else
    5 c& a! [) g9 l  w
  22.         {: B1 `. ?" v( n* N
  23.                 $ ~# b* V& y+ O
  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$ g6 ]; ~6 K( D/ Q
  25.                 STARTUPINFO si;8 Y( ~1 Q& R4 h4 |- Q- x

  26. - h8 L7 A& E* Q; E' K7 @
  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).aspx1 O! M4 L+ K. H& I& @
  28.                 PROCESS_INFORMATION pi;! a9 ?' `0 |! ]% B, {

  29. 1 Q- F5 |  ^, b+ Z4 h: _
  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
      \, S) b/ r" h; R
  31.                 DEBUG_EVENT dbge;3 f& z& B, o* O! X! u7 F

  32. ! V) F/ F7 O% h. e/ h
  33.                 //Commandline that will used at CreateProcess) k4 s1 t* I4 w$ O) N
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));7 ~* q0 J8 q1 S# E& ?+ |. t9 E
  35. ( m% J+ Q. m5 K  I  B* C
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)4 @, Y$ X) J/ h9 X5 g
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)9 v- v2 d/ {( g0 Q5 S, d# R
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)  y3 M) {1 Z6 _0 L
  39. $ d. R3 s% u7 U! H7 T2 H" @# }
  40. 3 K6 W( @$ Q: f- Z3 I8 G- A" k9 |: e
  41. & |7 H$ V/ e5 z0 |+ b
  42.                 //Start DekaronServer.exe ) l+ t" @# d/ B% g) l9 v
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    ' @7 A9 k  ?! D9 w! z) b
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    0 P" Q# s& m8 G3 P# {
  45.                         szCmdline,        // Command line
    ' e. P9 N5 k1 {1 c! F4 P, |2 t
  46.                         NULL,           // Process handle not inheritable9 v) f( W. {2 q9 \
  47.                         NULL,           // Thread handle not inheritable
    % ~# S2 Y7 i4 W4 w
  48.                         FALSE,          // Set handle inheritance to FALSE
    7 Y% Z5 g& K' D7 {+ L4 a5 z
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx% @& @9 [. }: R: F$ ^8 p
  50.                         NULL,           // Use parent's environment block6 x+ P2 g7 R1 L! \2 r
  51.                         NULL,           // Use parent's starting directory : C1 X% H1 s" M5 i" b% [$ X
  52.                         &si,            // Pointer to STARTUPINFO structure
    / ^7 B# o) V  o) X8 w
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    ' o: M' A% x4 ~5 n, X
  54.                 ) & m' O: ?& ^6 ^, G$ n
  55.                 {
    ! R- Q9 M- K  G7 T/ i$ ]& l  q" p3 G
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );3 `4 T- Z* _6 e  c# {+ |2 t, Q' z
  57.                         return 0;2 t5 H: n2 N0 H$ w/ @
  58.                 }0 C6 @+ s6 l0 x3 Y
  59.                 //Creating Process was sucessful0 w) J5 v1 F# s. Z8 ?' ~
  60.                 else
    ; ]- ]& H# e! O7 v" p/ z) }& x/ O
  61.                 {
      D* D( _$ u: M: M  B
  62.                         printf("Sucessfully launched DekaronServer.exe\n");3 ^; P1 G" V2 _# g. j& T
  63. 8 e& `% X/ A7 Z4 L
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure/ Q3 M# Z3 \0 V! ]8 D/ M
  65.                         dbge.dwProcessId = pi.dwProcessId;/ H$ h) j8 K8 ?* ~" K
  66.                         dbge.dwProcessId = pi.dwThreadId;
    / G( o0 X8 A9 g  E

  67.   w1 j+ b" H' H1 ^3 j/ \4 D
  68.                         while(true) //infinite loop ("Debugger")
    ) q% |% K+ K2 M  R0 I3 U  l
  69.                         {
    1 p: C+ v' v2 c8 ^1 O3 x
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx* {; D) ^4 F. r+ e
  71. 1 w8 `, O) f# _2 g9 a- ?& h
  72.                                 /*
    # O% u5 U7 }5 u& d$ @6 s. P% \
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

; X( c5 g; S& i) l% v
/ t: Z, K& u% R( l! S* a
8 I; k) t* T) ~9 l* d. j
商业服务端 登录器 网站 出售

13

主题

251

回帖

1243

积分

金牌会员

积分
1243
金钱
792
贡献
182
注册时间
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

回帖

1243

积分

金牌会员

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

3

主题

99

回帖

5253

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-3 16:23 , Processed in 0.079361 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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