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

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

[复制链接]

156

主题

354

回帖

6492

积分

管理员

积分
6492
金钱
1906
贡献
4076
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
8 w! U9 w/ R( D2 s! G% D$ ?1 r- \) E
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
+ M) h$ ?7 h7 k) w' Q2 a" U' Z- T: W" D& W5 D; z$ w& x
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。" a7 B, s% o* j7 u; s
  2. //
    1 l7 i4 a% z6 ]) [1 X  R, G

  3. & @" \# }3 b- z: `  ~
  4. #include "stdafx.h"' V1 N/ [$ ~, E6 n4 G" g
  5. #include <iostream>
    % @/ h2 F4 L7 Z7 D/ N5 W% N6 `5 b
  6. #include <Windows.h>+ l5 s5 M3 G* D. e
  7. #include <io.h>6 J/ R3 u0 O  b& J" O" J7 w
  8. . z) B/ [6 i7 ?0 M/ F( v' G2 G  e0 L& ]
  9. 6 j7 A" y" M5 t! N$ w3 x+ g
  10. int _tmain(int argc, _TCHAR* argv[])
    : t0 ]% r# D* Y& L0 o, }
  11. {) b! Y  s) ^, P. @: y
  12.         printf("Dekaron-Server Launcher by Toasty\n");
      G2 L/ a% \) N% M

  13. & E+ h1 T+ }7 L
  14.         //查看文件“DekaronServer.exe”是否存在
    9 u. y$ b* n: J. M: A
  15.         if(_access("DekaronServer.exe", 0) == -1)1 M, ]! Y7 O: R  x# E
  16.         {
    # c# y: }6 G4 q: K* G9 {$ _
  17.                 printf("DekaronServer.exe not found!\n");
    5 \2 Z) N6 p* r  c! o9 T; d
  18.                 printf("Program will close in 5seconds\n");$ H0 y  b* K/ p% O5 h
  19.                 Sleep(5000);/ X9 y( f! Q4 t4 o
  20.         }
    * k4 ~1 S6 P0 S) _
  21.         else
    2 L! G/ h2 [. M9 h0 r/ V) B
  22.         {: r. F5 T; m# e4 k: P) B
  23.                
    ; A2 N1 m/ e! I1 O! b
  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  z9 a4 {3 g3 l0 N5 v
  25.                 STARTUPINFO si;. O+ S, j( f7 q
  26. 0 V7 ]+ v2 P# N  U" [1 M
  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+ M3 [7 c9 y% N. l: ?: G
  28.                 PROCESS_INFORMATION pi;3 f: K# k* v: d9 ~* n

  29. 4 R2 Z8 B" E6 M5 j$ Q& B9 v
  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
    3 j; g+ z; n8 T) A6 q$ \  O/ T
  31.                 DEBUG_EVENT dbge;
    : S4 I" m6 |" b+ t: r% y

  32. ( B8 z) i( R2 n
  33.                 //Commandline that will used at CreateProcess9 L3 b8 K% h. S* F$ x0 a6 [( b, l
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));& d$ n3 I- Q9 E( @0 y4 y
  35. 1 N' Z: ]  \  }, a0 C
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    0 k& Y' s4 U" a2 k3 t3 f1 T
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)& X" p- f( i( @- z5 u+ r
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)2 Z) k, Q1 D- Y& G  C
  39. , y; ~" a( p: k; P- D

  40. 7 F9 d1 U! y. \* d
  41. ! p* t8 b7 R6 ^. B4 [/ @: R' |
  42.                 //Start DekaronServer.exe ( [- O- K' m2 l; g
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    9 v! n+ ~% F; H7 x, N
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)6 S; Y6 F5 \* r8 G  |
  45.                         szCmdline,        // Command line
    1 d( h+ b1 [) m
  46.                         NULL,           // Process handle not inheritable" i6 T) x9 @+ g* n2 D( b
  47.                         NULL,           // Thread handle not inheritable1 a- M6 o! {8 l* W8 B
  48.                         FALSE,          // Set handle inheritance to FALSE8 k5 i: f1 o' j& Q' M4 X' [9 R
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx" Y- W3 f" W% s- h! H. b/ ^
  50.                         NULL,           // Use parent's environment block
    9 n* i8 m* M/ m
  51.                         NULL,           // Use parent's starting directory # O; [; O5 H- w( W. c) X
  52.                         &si,            // Pointer to STARTUPINFO structure; ?* g3 V, {- b4 a
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure, b+ U" D3 x0 X( l) `9 p; v# z
  54.                 ) 2 R5 y0 t2 K5 t$ b
  55.                 {
    9 j( X5 K3 f! K$ w+ Y* ]' k8 p
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );, _' f9 x* U1 L1 c3 ^$ ]  ]5 Y! A
  57.                         return 0;
    ; A0 ^" X3 b, P1 g$ C
  58.                 }0 ]/ E  T! h4 f* j
  59.                 //Creating Process was sucessful
    ' C8 g" ~2 g6 ^$ C8 n/ D  s2 r" t
  60.                 else& m- w9 ]% K" L+ W3 P
  61.                 {+ d* q- n# Y, v1 k  a
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    0 f# F' y  c- K1 k0 b2 ^

  63. ! b  l; D) P' T0 k
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure" X0 n. L% ^9 H% a6 O+ G7 f# }
  65.                         dbge.dwProcessId = pi.dwProcessId;
    : y& b3 D) K# L3 H! q
  66.                         dbge.dwProcessId = pi.dwThreadId;
      M3 ~3 G8 l. l4 G% A
  67. * x  C& A0 ^1 d  j) N  c% E
  68.                         while(true) //infinite loop ("Debugger")
    8 A3 I, z# V2 v. A2 A
  69.                         {5 _( `0 R5 M7 A" P0 ]  C- i# W
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx# k! e3 ~. G0 o) B4 y9 a
  71. : k6 `3 L) o; P7 c* g
  72.                                 /** B6 t$ }2 Q1 G
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

$ i* J% D: E' i
3 O8 V1 T9 y' f/ M* a' G' S: p8 N! J. r# O8 F4 e5 b" x
商业服务端 登录器 网站 出售

15

主题

256

回帖

1237

积分

金牌会员

积分
1237
金钱
853
贡献
108
注册时间
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 | 显示全部楼层
学习学习赞赞赞

15

主题

256

回帖

1237

积分

金牌会员

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

3

主题

102

回帖

6068

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-22 18:08 , Processed in 0.085276 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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