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

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

[复制链接]

136

主题

189

回帖

3862

积分

管理员

积分
3862
金钱
1351
贡献
2186
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) * F. v2 }, y$ J5 d4 t: s
; t) }  h+ O. q5 [% A, V3 I" L
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
1 U. G7 e% J( T- @+ w- ^$ B- C9 [; K8 D! Y( `
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    ) x  i8 L2 q# A) g6 h
  2. //
    # C- P3 W8 B5 z' Y8 Y! F2 ?* w
  3. # z# `; A% h, b- L, B1 T
  4. #include "stdafx.h"
    ( z  j5 {1 b7 |; Y- J1 ~5 m& {' j
  5. #include <iostream>. Z7 ~- @% a, J6 Q! Z" v
  6. #include <Windows.h># F" [+ `' S7 m" J; s& ?
  7. #include <io.h>
    8 ]* B4 k; D3 }# s

  8. ! F1 p( C8 V. I; D1 M
  9. / J$ ^. q7 a1 z
  10. int _tmain(int argc, _TCHAR* argv[]); `9 I4 K- ~0 c) m$ U# E# O
  11. {& }: r$ O- ^0 _# _. k5 |- k
  12.         printf("Dekaron-Server Launcher by Toasty\n");0 m+ I% M' E# M% P. X" `
  13. + z7 I" k$ j; n# K. J  m" ]: H0 e
  14.         //查看文件“DekaronServer.exe”是否存在/ k% a( x2 t: o0 A  w. g3 Z0 C$ h
  15.         if(_access("DekaronServer.exe", 0) == -1)# g8 [7 V' B. O6 \
  16.         {
    - n; ^" _2 |" f8 U* }- O, x
  17.                 printf("DekaronServer.exe not found!\n");" d; }( ?9 ?# e5 M! p8 |
  18.                 printf("Program will close in 5seconds\n");+ A5 q* Z4 S3 g
  19.                 Sleep(5000);
    . V. H: i/ l9 S. m* @2 P* J
  20.         }% T% D+ C; M5 V, I* }
  21.         else8 n3 u! E/ B- _
  22.         {0 p% ?" i. j) A+ J; N
  23.                
    / j$ ^+ z* j) [7 k9 R& ~
  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+ N. ^0 W# L& o- t: i( g
  25.                 STARTUPINFO si;
    7 D& o5 r# n2 |, x' H
  26. , x; Z1 w9 u$ s5 Z/ h( K2 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
    - ^, X) b1 B3 O* ?. B
  28.                 PROCESS_INFORMATION pi;" H7 H) Q# b0 C  f$ X- e6 ~8 ]
  29. 3 m4 f! l6 q& |+ U9 W, X9 P
  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
    # R0 F) r% V3 {0 t
  31.                 DEBUG_EVENT dbge;6 ^! B# W' B; |

  32. : ^! e  F0 f$ }6 H
  33.                 //Commandline that will used at CreateProcess' }  W* O# K# e4 c8 M1 k& c/ l7 Y4 Z
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));( g% Z% g% ?7 G7 Y8 }8 c( q, d' C6 @

  35. & Q9 J! e( E. K, X4 T
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)9 B* v- c; j5 b1 L1 Z
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    ) H( N$ @/ t* @
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)* d, w6 l( p0 H& T4 o& D
  39. 8 G$ X; [" ]. }! ~$ ]3 A3 W
  40. , T) D  J/ Q( X2 |) Y+ F& w
  41. 2 q( o% U; j" V9 q% `/ y
  42.                 //Start DekaronServer.exe : _9 A- s1 D/ S6 o+ B7 e0 J
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    2 g- ]! l0 @" k0 _. e7 L& Q
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)+ E* u$ S# @7 v+ L, q" t5 X
  45.                         szCmdline,        // Command line
    ; l5 D+ W6 @5 H! y' Z( r* o% a
  46.                         NULL,           // Process handle not inheritable* D% a  B% g! x
  47.                         NULL,           // Thread handle not inheritable
    ) F# s3 L& R& D$ Q6 k) \
  48.                         FALSE,          // Set handle inheritance to FALSE
    ( T- ?  v' i1 T7 j9 y4 q; e
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx/ y9 B2 w$ q9 j, A1 S
  50.                         NULL,           // Use parent's environment block
    8 Z; h7 m' ~5 Z9 m% J
  51.                         NULL,           // Use parent's starting directory 1 A2 N& i; ?- f1 B2 o
  52.                         &si,            // Pointer to STARTUPINFO structure
    * J  P: ]: h# ^4 l
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure' y/ \' P0 y+ C$ H1 v$ }
  54.                 ) , `/ E, W- u7 \( ~* b
  55.                 {
    7 s& B! B& [% b" X
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    5 W  p0 @- F, H
  57.                         return 0;
    5 i! r0 z4 m! U+ E
  58.                 }
    8 X$ @$ x# q5 C( ^$ B
  59.                 //Creating Process was sucessful
    " j6 j' y9 \. [
  60.                 else3 r6 C4 f3 r  t  T$ b+ r
  61.                 {
    . v5 s4 E; W. x* h( b+ E
  62.                         printf("Sucessfully launched DekaronServer.exe\n");; k$ N6 y: _2 K$ F2 a/ K
  63. 0 \# F+ s8 J) L/ J" u8 v/ b! C
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    ! O1 b* l0 h3 Z( O
  65.                         dbge.dwProcessId = pi.dwProcessId;* z( K2 g  K% b# y9 j5 C
  66.                         dbge.dwProcessId = pi.dwThreadId;
    - s3 R: y' X" L8 a. C' ^
  67. - ]6 h& I- i/ k9 g6 E
  68.                         while(true) //infinite loop ("Debugger")
    ) \+ b' I3 w2 b$ \" K7 z
  69.                         {) |) }/ k0 b0 I
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    : ?7 `4 I3 X. ^3 W: b( f2 |
  71. 7 p& p, l; q- J: }; }
  72.                                 /*, O' r' y8 ^4 g0 l; ~
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
7 |5 @) X. G: ^& b: s% I

2 o/ Q& F5 E+ I) {% e4 n5 s4 m8 _) H" h: P3 f
商业服务端 登录器 网站 出售

9

主题

231

回帖

881

积分

高级会员

积分
881
金钱
534
贡献
102
注册时间
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

主题

189

回帖

298

积分

注册会员

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

9

主题

231

回帖

881

积分

高级会员

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

2

主题

83

回帖

1111

积分

高级会员

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

本版积分规则

Archiver|手机版|小黑屋|EGameol

GMT+8, 2025-4-11 06:17 , Processed in 0.045713 second(s), 25 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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