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

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

[复制链接]

154

主题

337

回帖

5787

积分

管理员

积分
5787
金钱
1821
贡献
3475
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
; }( T; f- G! c' v  p$ U
" h# F9 i$ J! X. X虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
8 z1 ?$ I- c$ \# p* }1 H1 n! L
4 Y' |7 Y% p7 U1 E. j6 M8 T+ W" e
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    ( I4 Q, ?* b" Q& D# b3 \& B
  2. //: r9 _# h3 ?2 l7 W, u
  3. 4 P7 f! b! b: b- O# f: {
  4. #include "stdafx.h"
      M4 m- @; r4 [
  5. #include <iostream>
    ! ~- V8 D1 d! y1 {% |
  6. #include <Windows.h>+ L* g1 N/ m5 t- Y& _. J; R
  7. #include <io.h>
    ) Q2 [% Z# W. G- B3 y" U% U

  8. " N6 a6 g, p6 T6 T1 e

  9. ( `% N% Y) |3 a& \! o0 w
  10. int _tmain(int argc, _TCHAR* argv[])
      s9 Y( o4 |  L9 Q0 M# G% E
  11. {# {7 o. k( {' m9 X( ]( v) N
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    , |' [3 t% V" w4 R# ]+ @& j9 ]  w2 B

  13. 9 j' j; v3 P( H
  14.         //查看文件“DekaronServer.exe”是否存在- e( F8 O8 B- r! O8 l4 G4 L
  15.         if(_access("DekaronServer.exe", 0) == -1)/ U# w7 L; H( [( }" j7 G
  16.         {* S( L- c- H3 E5 B
  17.                 printf("DekaronServer.exe not found!\n");
    1 C  A7 w) o& L; i4 M6 Y- C
  18.                 printf("Program will close in 5seconds\n");) {" l8 |; U) p9 J! |6 G& I1 V* [; I4 r
  19.                 Sleep(5000);
    1 [. S) }& ^  p  c$ I) c& v
  20.         }
      }6 z- ]! Y* t1 Q- ?' K% M* w
  21.         else5 H  a( f$ b$ [- k" W$ C. c; U3 `' }
  22.         {- p' G7 M1 H& y  d
  23.                 ) |' E8 [$ s. F6 Y; w- G; a) X/ Y
  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
    / a& i8 L+ K& Q; I7 m# `+ t% I) ]
  25.                 STARTUPINFO si;% l. q% |8 \7 ~

  26. 9 [) {) x/ l( c& g: s8 B
  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
    & [* q5 ~7 ^0 c! ?, ]
  28.                 PROCESS_INFORMATION pi;
    . F$ n3 F& x. X# j

  29. - G' o* |+ t) ~0 F4 J/ j3 c
  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
    1 K) S( L4 f4 B( U# R
  31.                 DEBUG_EVENT dbge;
    % _& K/ E: R. v$ L" v/ |
  32. - c5 ?0 E* G; z
  33.                 //Commandline that will used at CreateProcess
    + D! o; J& u5 z: R! b# @0 l0 _
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));- f. i9 `, A9 _) E/ V9 p5 ?+ F
  35. ) r' b& p( C3 n: t% t
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)5 g" ^1 k' `' C+ R2 G/ M
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    / J* r) O' K3 F6 _/ v2 P: I
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)( c! I1 j+ q& U5 ~' u
  39. # B. v, n) M+ v4 n- H2 G

  40. $ j" V6 R0 C" e+ e7 k1 x' j5 G) r

  41. / ^7 f4 {, U: S$ G) O! t
  42.                 //Start DekaronServer.exe 7 {% @4 J; o- |0 @. e
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx& c9 b/ r# E$ H! z
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    1 p) s& b( X0 G7 g4 S
  45.                         szCmdline,        // Command line
    . ~! q# r/ b3 H* e% D5 d1 ~
  46.                         NULL,           // Process handle not inheritable; e6 u2 _0 N+ q
  47.                         NULL,           // Thread handle not inheritable$ b2 F- S5 h! I
  48.                         FALSE,          // Set handle inheritance to FALSE
    8 Z( q, M( Z0 W5 }2 F
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx7 \) J  L/ e/ d& e! I
  50.                         NULL,           // Use parent's environment block
    . A* |" H1 }; c# t; l( J
  51.                         NULL,           // Use parent's starting directory
    3 u! H1 ]3 [$ C8 {7 U
  52.                         &si,            // Pointer to STARTUPINFO structure6 B/ L1 k( j: d2 x
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    0 Q: h8 o  ]% P# N
  54.                 ) 9 l# Y' Y% |; ~7 T; G% H
  55.                 {
      l0 Z) ?9 i9 p7 b! C" C! j; {% ]
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    4 ^5 ^7 D  _/ c+ W6 n
  57.                         return 0;
    " {* e) S4 ~1 v: f* \0 y6 S
  58.                 }2 k( }7 i2 W" N1 p: @; o6 k$ S
  59.                 //Creating Process was sucessful
    & X% d$ @0 H( J* B8 B: J
  60.                 else! M$ l8 d0 e+ l1 Z/ s* y5 i
  61.                 {
    6 x) M# M, y* ~, l
  62.                         printf("Sucessfully launched DekaronServer.exe\n");( a3 a) [# x( }' ?1 l3 t( {

  63. 1 P3 s: H+ C; ]
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    8 O0 q2 P; C0 D! k2 Q7 H7 J7 e
  65.                         dbge.dwProcessId = pi.dwProcessId;
    0 P4 ^, v, \: }1 L
  66.                         dbge.dwProcessId = pi.dwThreadId;* I5 k0 M7 {. v% W! W( H2 \
  67. - N& k6 r3 W# I9 n4 b3 w( {% q* ]
  68.                         while(true) //infinite loop ("Debugger")
    / V+ e: H- L: g8 F6 \; f( q+ b
  69.                         {9 @4 q5 ~, Q* O3 N
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
      ~( W3 R; Y$ w0 z) ]) X8 z0 T

  71. ; ]$ c: D8 p; A- ^1 R7 b
  72.                                 /*6 r; t9 ?6 y/ X3 G
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
+ s( u& V3 v$ c6 R3 Y

, _, e( C, q7 U$ V& }3 v' d* n6 P0 O% K' X; R& R* a
商业服务端 登录器 网站 出售

13

主题

251

回帖

1246

积分

金牌会员

积分
1246
金钱
794
贡献
183
注册时间
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

回帖

1246

积分

金牌会员

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

3

主题

99

回帖

5273

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-5 02:18 , Processed in 0.067636 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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