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

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

[复制链接]

157

主题

358

回帖

6642

积分

管理员

积分
6642
金钱
1922
贡献
4205
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
- d; a5 M# {5 s% w& I0 s4 |+ M( D
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
. T8 X' E0 O" d8 `# w  [- P. P/ x! E7 i  n! t: s6 ^) W
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。$ r5 O: w/ x1 w7 ?% p4 C: h- P2 L
  2. //
    3 J& l6 r. g# C5 x8 ~
  3. 9 ?1 }* a8 }. l+ c2 |# ^  H
  4. #include "stdafx.h"5 a  l9 `, g% W$ d* Z# V1 V# B1 m) j
  5. #include <iostream>* q8 l# G' J  [- m3 K5 s) F
  6. #include <Windows.h>
    # c) C% J; J) p7 ~# u
  7. #include <io.h>
    ! r6 c% {( w: w% _# n) v9 |7 r3 ~! l- J

  8. 9 S) e, w2 X3 I9 c7 _- w
  9. $ M  R  L( [  o  I) h5 O9 h
  10. int _tmain(int argc, _TCHAR* argv[])
    . c( o/ T6 O1 Y" I3 u' m
  11. {9 n6 |+ w. O, B! I
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    9 A4 J4 U& E9 I" _$ n( Z# ^

  13. , Q5 e4 c2 h* W& {6 W/ f1 i1 R
  14.         //查看文件“DekaronServer.exe”是否存在
    1 {/ r. _$ }6 f2 T
  15.         if(_access("DekaronServer.exe", 0) == -1)
    % ~9 g4 }3 A3 U- I0 w% k3 h, e# A9 C
  16.         {+ U* K- r" g; h1 l
  17.                 printf("DekaronServer.exe not found!\n");3 U: B- O4 X8 \$ [; Q
  18.                 printf("Program will close in 5seconds\n");
    / \* q) ?2 a& l  L- F
  19.                 Sleep(5000);& G& P  v# K5 Z- X6 t7 F3 q3 E- R/ m
  20.         }8 X$ Y1 @5 U4 C
  21.         else; s; K  X7 U7 M6 a# d1 H4 O
  22.         {7 y+ ?4 L# [# }% G9 ?/ t5 o/ Y+ S
  23.                 5 B9 ~% _8 |, K2 D. d. ~' z
  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$ x" x! j3 r2 [# N! D
  25.                 STARTUPINFO si;  y( z! T! w$ O- ]+ A

  26. 7 X+ X3 d2 n. l4 O& e: 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
    3 ?+ K4 l- s+ c# Z
  28.                 PROCESS_INFORMATION pi;
      x+ v( `+ m( Y# S( |* ]
  29. ! T6 v) a7 ?0 e* i' ~2 p/ f
  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
    9 X' B" t4 |  H  V6 O, f/ r
  31.                 DEBUG_EVENT dbge;, ^* j' P' H) q0 s) D* @6 `
  32. 1 e, \% {$ J/ Y4 m
  33.                 //Commandline that will used at CreateProcess
    0 U3 k, R- K7 S
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    , f$ a5 f' w$ [% \+ g

  35. $ W& \  u) |0 q  ?7 }
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    + D, [) W' F" l* N2 Z0 i: ^
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)' o# M" H3 O( K2 \- Q
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)7 t% G' b. a; Z5 V

  39. 8 U- U; M9 v# R* s: J
  40. ; n+ o. _/ a" U/ N

  41.   ]5 j. C1 s$ x: m1 ^
  42.                 //Start DekaronServer.exe 6 p9 T7 c( p( }& d) |$ ^8 G
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    # M9 }! L2 J+ V9 g
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)% C% w7 Z) K: m  R* O. b; P
  45.                         szCmdline,        // Command line
    1 c4 v5 i) n$ [  J4 o0 `
  46.                         NULL,           // Process handle not inheritable' f# t# T, U8 E4 y  P
  47.                         NULL,           // Thread handle not inheritable
    4 X0 [% S$ T- N7 l/ _$ w4 P  e
  48.                         FALSE,          // Set handle inheritance to FALSE
    6 L* N5 l, @) r
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx; ?  {; X6 U' ?$ ?- @/ n; f
  50.                         NULL,           // Use parent's environment block
    4 u! O! D! p, a. ^+ n
  51.                         NULL,           // Use parent's starting directory / g( |. D2 W8 k2 _
  52.                         &si,            // Pointer to STARTUPINFO structure
    / Y) }0 ?  o( N! E$ v
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    " {! j: M4 D' L, d
  54.                 )
    4 O% i$ _- f) v0 n
  55.                 {) r: Z. W* v- p. w# T
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    ; C& P  u9 E) `* p3 E
  57.                         return 0;
    " g" C! E" q% O" x7 B8 N2 v
  58.                 }" y4 @! ~* `: k
  59.                 //Creating Process was sucessful. w' V6 U  u  b2 F7 k% L$ m
  60.                 else( }3 r2 w* V! X; ?: m- R: ]
  61.                 {8 E$ p4 k5 a7 P4 R- m
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    3 d1 I6 \1 }+ _  m1 ^- Y
  63. + q/ a7 z) w& j0 @1 P% l0 e
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    8 V+ L4 r* N, i0 v* k
  65.                         dbge.dwProcessId = pi.dwProcessId;
    6 b! n+ W3 z3 K8 S( _) ~
  66.                         dbge.dwProcessId = pi.dwThreadId;
    1 Z. Y2 @/ _/ `2 {$ L9 Q' p

  67. 1 S& U# o4 C0 T! M
  68.                         while(true) //infinite loop ("Debugger")
      T. p8 p( j) l0 P2 U
  69.                         {
    " \: N0 G4 C% h
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx8 [; C* H4 x8 n# E. e; k

  71. * Q5 r% J3 G- r1 N5 x
  72.                                 /*/ v  K' R/ h# ^  I/ U1 O4 U
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

, e' r* D; }9 k0 o: }
+ ?4 M. F2 }( j$ Q" V" g7 m$ m2 {- A# ~" v# ]
商业服务端 登录器 网站 出售

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

回帖

6241

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-1 12:41 , Processed in 0.066834 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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