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

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

[复制链接]

161

主题

389

回帖

7476

积分

管理员

积分
7476
金钱
2161
贡献
4765
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) + S! w" s) c# |0 w6 e7 s" d3 }1 T
0 W  u. n% P6 v% u
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
; Y4 V% \" i1 E, ^7 g3 r- K0 r) z) s% G  D* L$ h
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。- M- g+ Y2 k% \% _  A
  2. //
    + z$ ~# u* Y/ w2 l7 W( I* a7 o1 X
  3. ! I7 A6 d# `- }( L, d# h
  4. #include "stdafx.h": U$ Z7 O, y1 ~9 Q
  5. #include <iostream>
    ( i: k' t5 c% {) |  V6 J/ M6 d# C6 u
  6. #include <Windows.h>2 J9 l1 h/ k) |+ V8 x% ~* z
  7. #include <io.h>
    ' R: q& p7 E; S, L$ h+ p( `" p" X

  8. $ q1 ]% @( \- j( R

  9. $ v. Z! W/ b# d* |
  10. int _tmain(int argc, _TCHAR* argv[])
    # e) L/ u, }* \4 m
  11. {7 h4 h& U" J. g% r" l. E2 E$ q
  12.         printf("Dekaron-Server Launcher by Toasty\n");6 T4 {2 J% o! a/ P: @5 d

  13. " y+ y& ~% P* M$ T
  14.         //查看文件“DekaronServer.exe”是否存在3 c7 e" ~% ~4 l$ @
  15.         if(_access("DekaronServer.exe", 0) == -1)0 J0 ~/ U% W* [6 Z
  16.         {& }& r6 P, C8 O  s& F7 n
  17.                 printf("DekaronServer.exe not found!\n");8 g- c# Y, X, U' ?" [' }6 F4 t) o
  18.                 printf("Program will close in 5seconds\n");; J( [. _& c; ]1 A5 X
  19.                 Sleep(5000);( E* k8 u0 b+ a. C; e
  20.         }
    4 x# |! R/ w8 t/ Y0 S6 V
  21.         else
    0 d1 R- ^2 Q/ V3 A
  22.         {
    ' F; A5 x+ d; ^+ h
  23.                
    ! n; w3 P# ]9 @( c" Q% w, p; {' m  a
  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
    ! M& w" {( n5 ~( W
  25.                 STARTUPINFO si;0 n9 l7 P1 A6 p% C# ]

  26. 1 r& r# G+ B1 T" S: [& u
  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
    1 i! l4 W5 K5 f  U  {- {
  28.                 PROCESS_INFORMATION pi;: p2 _  C5 p! a3 e8 M

  29. . X/ ~  \5 f/ c2 D7 Q" f4 T6 D9 X
  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
    $ l$ F  s& G& X; }! M& B3 d
  31.                 DEBUG_EVENT dbge;% ~+ ?% P8 p+ L  x9 h; r

  32. 5 G- \; F" x  m
  33.                 //Commandline that will used at CreateProcess
    5 i* |3 p" N7 G9 J
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    6 [+ a. W6 j8 m3 n+ l1 D% p
  35. 2 Z6 g! ^0 N' [3 V3 _3 h3 G" g+ o
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    * w5 Q: u7 _% l; z0 u' a
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn). x& a$ S& m( m
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    1 O+ k  n: F4 m) a2 Q& S8 x5 X

  39. 3 s; }  L, k, V( v$ t3 U2 l- L
  40. + m: f- E) J! Q; w$ R4 U0 o
  41. 6 z3 g5 X9 ^4 {; b
  42.                 //Start DekaronServer.exe ( L1 W* }. B! \  T
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx! e) m5 {: d7 i4 Q  Q3 T: q/ u
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    + u$ S& o1 |+ K' o- Y
  45.                         szCmdline,        // Command line
    * z+ u5 R4 L4 A# A
  46.                         NULL,           // Process handle not inheritable
    1 v# ~7 h  {# b3 {/ z' a
  47.                         NULL,           // Thread handle not inheritable
    " C3 a; w# X  |7 P$ R* S
  48.                         FALSE,          // Set handle inheritance to FALSE$ J2 K/ u# c: J3 x& K  e
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    7 K9 J* `; W; i
  50.                         NULL,           // Use parent's environment block8 n! j& H# t6 b& Y& v  O  i
  51.                         NULL,           // Use parent's starting directory & L- t7 J2 i+ f  [0 Y9 q' p" L
  52.                         &si,            // Pointer to STARTUPINFO structure; Z8 ~1 @3 C% J2 v
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    ! W) V' h& e- b% D/ i
  54.                 )   {5 _0 p& p! T- J, `$ M1 G
  55.                 {- E, f# c7 k  U! C9 g3 ~* R
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );* I* F4 H6 B& c+ X  s8 E
  57.                         return 0;: s, {! o: q) I1 q3 W6 C
  58.                 }
    & {* O4 A- n2 s2 N1 ]
  59.                 //Creating Process was sucessful0 v( L0 m1 g; o. U
  60.                 else- J  J0 s" A& ]( Z
  61.                 {
    9 x7 P; R% W3 s% o/ m4 Q
  62.                         printf("Sucessfully launched DekaronServer.exe\n");% D4 M1 U0 j0 a7 R; [  h! D

  63. ' q. P  q+ _8 W0 Q" g, d( t3 \
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    ( q$ a9 I' y6 v  M/ W3 j8 {* J
  65.                         dbge.dwProcessId = pi.dwProcessId;
    : I" S7 z: o! W5 d- y/ j  ]
  66.                         dbge.dwProcessId = pi.dwThreadId;
    9 e6 |& |( Z* J' c' C

  67. 1 ]( T7 @# f6 u) `6 W
  68.                         while(true) //infinite loop ("Debugger")' b/ l# q1 k1 D4 c
  69.                         {4 e: z( @6 R' ?
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    9 {0 b- o6 l. v" k- Q  V9 X
  71. - m, ~; b5 K! i
  72.                                 /*
    : v9 N% m! W1 @  ~
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
! m4 Y; h4 r; W) z3 ?) F% a
& B; I# f5 @) s9 c

- z: ]9 _2 ?, n: l5 I
商业服务端 登录器 网站 出售

15

主题

260

回帖

1313

积分

金牌会员

积分
1313
金钱
945
贡献
88
注册时间
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

回帖

355

积分

中级会员

积分
355
金钱
142
贡献
6
注册时间
2024-5-14
发表于 2024-5-14 15:56:57 | 显示全部楼层
学习学习赞赞赞

15

主题

260

回帖

1313

积分

金牌会员

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

3

主题

102

回帖

8157

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-5-13 23:35 , Processed in 0.041367 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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