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

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

[复制链接]

154

主题

335

回帖

5773

积分

管理员

积分
5773
金钱
1815
贡献
3469
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) , c- {  y. }# Q6 h) v

/ d3 [" G( j5 o  X4 w* ~! h虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
9 K. ]* j& W, \
( S- v5 F$ \2 E' \; R* o
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。8 n  B* u& c% F% T7 b$ a4 c
  2. //7 I* W) O& d! B4 V: W! J
  3. & ]. b/ S) h5 f# u1 z/ _' ]8 \# Z- n
  4. #include "stdafx.h"9 ~; \" s- B7 }2 S$ F$ l
  5. #include <iostream>
    4 q7 I" _& D) a
  6. #include <Windows.h>4 D4 i! Q+ [( n# s
  7. #include <io.h>
    - ^0 b' D) e8 c" U

  8.   x# F! d, q3 I' A' X7 j4 r9 F

  9. ' i8 Z) J- ?& T& V/ |6 w5 ^
  10. int _tmain(int argc, _TCHAR* argv[])4 d1 b+ u' u- [1 E: u3 `
  11. {, d- u* {  c6 V' o
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    & H) v, y. q1 d+ l

  13. - K8 m5 V. q/ s3 p4 E! R+ Z- S
  14.         //查看文件“DekaronServer.exe”是否存在
    1 W8 [, f; Q/ H4 v
  15.         if(_access("DekaronServer.exe", 0) == -1): S  C7 [$ d+ K) h5 q
  16.         {- k7 h$ a9 Y0 j& W& Y  a# P
  17.                 printf("DekaronServer.exe not found!\n");8 U& ?5 D6 x- Y- ^* [
  18.                 printf("Program will close in 5seconds\n");$ ~/ F# V( n# b* H/ P9 R5 M
  19.                 Sleep(5000);
    % Q8 D' m) z/ Q3 \" v4 E/ u5 I
  20.         }1 Q3 ]( \9 x( Q" F' y
  21.         else
    ' c4 K& U" O% r- V
  22.         {
      K9 E! H9 o: b' p3 D: \: z& t
  23.                
    9 i4 r9 z7 X6 T9 G& _3 u0 |1 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! u$ y3 ?" @5 s& g
  25.                 STARTUPINFO si;
    . n3 V! S* a, {8 H' A

  26. 4 o7 Y  r. E; [9 X
  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 F' @' g2 F8 p* w% Y  Y
  28.                 PROCESS_INFORMATION pi;
    ' w6 e  v3 L  `
  29. + P2 J  `8 h7 g6 w' `" R, ~
  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, O5 W( [* S! \, I9 @) D/ L
  31.                 DEBUG_EVENT dbge;- B. s& q5 l9 `2 W; r1 t8 v1 x& I
  32. 1 I/ j3 z* ~2 z8 E
  33.                 //Commandline that will used at CreateProcess+ |3 p+ p1 K  u( k( ?
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    3 V4 R0 j8 W  r4 ^2 ^5 {) j" p
  35. / }  T4 n8 ?9 Z. y2 J
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    ! I# V! A- y0 C6 x# ~
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)0 F+ w/ P) G: K! z. K5 N# Z5 r6 u
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    ' E% v9 D* I5 ~& M, p1 z

  39. 5 U% ?# R3 k4 Y8 j
  40. * L1 G! W6 W* ?0 y& d3 X
  41. % ?# k5 _/ O: ]. Z( U9 @5 r( m
  42.                 //Start DekaronServer.exe 4 N& T' n/ W; C  w
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx% w, J; a' n0 \9 E- ^6 W
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    1 m- k7 l2 g4 z# j' z
  45.                         szCmdline,        // Command line. n( q1 q) n$ v- ~: i
  46.                         NULL,           // Process handle not inheritable4 N! O: L! q* Q, N
  47.                         NULL,           // Thread handle not inheritable
    ; ]9 z7 l9 P2 Y  U( d, T2 e: @
  48.                         FALSE,          // Set handle inheritance to FALSE
    * h& O: H7 d2 b8 l' m& Y
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    3 T& ~( ?) A: m: A% U7 P) V' x
  50.                         NULL,           // Use parent's environment block
    & ~+ _( |) [/ @2 I; V7 @
  51.                         NULL,           // Use parent's starting directory 5 D  O" `- K7 J  d& G0 H5 V# o
  52.                         &si,            // Pointer to STARTUPINFO structure! T' ^  X  B% z0 E: T
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure) e3 _  U% i5 }9 D  N0 w0 k( r" ]
  54.                 )
    % o$ z+ Z) ]8 a: ~. [
  55.                 {! L9 J; W3 s1 b: K2 P5 u: x: ?
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );% V# c2 e8 U( u
  57.                         return 0;" r7 X/ M* H4 y  d: g1 s
  58.                 }
    ! _6 i" a  z. s( E. [
  59.                 //Creating Process was sucessful
    / f* x/ b/ h- Y  Y
  60.                 else
    ; k, A4 K% ~  M& D! J6 v
  61.                 {. q2 K3 j- O$ S. N4 {! L
  62.                         printf("Sucessfully launched DekaronServer.exe\n");, h  E4 U& x( |8 K
  63. 7 P$ n5 d- D) m! `5 t4 m7 J
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure. |6 Z6 u$ q7 V- k6 s
  65.                         dbge.dwProcessId = pi.dwProcessId;5 }6 ?/ R8 L* A! K* O9 s
  66.                         dbge.dwProcessId = pi.dwThreadId;
    % q% \% X) a% ^8 E0 _$ O) H7 ^
  67. - e) S$ b3 m) X2 E: o: ?8 E- z
  68.                         while(true) //infinite loop ("Debugger")6 x" q( `* G4 m$ v9 V: H
  69.                         {
    " ?$ |8 F. z2 Y& t
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    + E3 {' s/ v, S, x6 f( |, [+ w

  71. ; K3 p& `5 J7 Z; a
  72.                                 /*
    ' h) P# K1 g  \  d+ X. v
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
2 ]: N* C6 R3 ^) u' H& A2 q, G- {+ x8 F
. [( V0 n+ A9 u# Y# l

2 g! h1 s. K( e8 j3 y; a
商业服务端 登录器 网站 出售

13

主题

250

回帖

1235

积分

金牌会员

积分
1235
金钱
789
贡献
178
注册时间
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

主题

250

回帖

1235

积分

金牌会员

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

3

主题

99

回帖

5233

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-3 01:11 , Processed in 0.083161 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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