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

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

[复制链接]

157

主题

364

回帖

6927

积分

管理员

积分
6927
金钱
1964
贡献
4442
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
. j6 a! Y7 q! n! `# j& U8 F( o
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
; Z5 }% F# `% L9 I
; t& U( K) {5 s3 ]- f& V0 n) y' A% \
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    , B3 C' }* f  L/ Y% U: g: P
  2. //
    , |) R1 F6 `8 d
  3. 3 \1 r, \# w. K2 G% o6 \
  4. #include "stdafx.h"9 @) `( x! j5 |
  5. #include <iostream>* Q4 J. i( t/ R1 w3 X
  6. #include <Windows.h>6 ^! w" ~4 Q4 h/ _/ A" M
  7. #include <io.h>
    ( D* n, j' @) T3 I1 X! G  C
  8. 0 ^4 Z9 R$ t- n1 a

  9. / [% |1 P/ F: V2 ~
  10. int _tmain(int argc, _TCHAR* argv[]), F, v* L( u& t, P  ~; F
  11. {
    + [. n& X. \; v) ^# S
  12.         printf("Dekaron-Server Launcher by Toasty\n");2 _7 D! A- [. K# g

  13. . |4 b# J$ Q! B7 `1 V2 a- ]
  14.         //查看文件“DekaronServer.exe”是否存在5 Q  |8 \2 `) F- s1 I& b
  15.         if(_access("DekaronServer.exe", 0) == -1)* L. |/ Y: T, I( q% p+ W( x
  16.         {; k. H, B4 l6 ?2 D
  17.                 printf("DekaronServer.exe not found!\n");8 C* {  t+ `; x% z
  18.                 printf("Program will close in 5seconds\n");
    6 c5 d  x9 ^( i9 z
  19.                 Sleep(5000);
    , h+ m6 {. H* C' r$ w6 I0 A5 l; R
  20.         }& {; n1 K; b3 u
  21.         else
    ' i9 @7 Z1 M- c6 Y: a& H& ?
  22.         {7 f8 ^8 H4 [, b. @# ?3 `/ @0 j
  23.                   x' [" J/ J7 U; j/ i' \
  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! P8 O* S: N; M- m- n5 G0 m5 {. n) ?
  25.                 STARTUPINFO si;- ?( z5 j/ o; y4 J: a

  26. 9 L5 B; [) f" u! _2 e& r
  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: f  b/ I0 P  [" T8 n
  28.                 PROCESS_INFORMATION pi;
    2 B" j, W. k  f7 S

  29. 0 R5 q6 m( X4 ^7 N; a1 j
  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
    " [& u5 w4 `1 v6 v
  31.                 DEBUG_EVENT dbge;  H. n& w! v% x" a0 @: E

  32. ; Y+ G( U/ t2 h# U) v' f) _; O2 k8 _
  33.                 //Commandline that will used at CreateProcess
    ' `3 v2 a& v' ^
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    " \, B* a: m5 x, t$ C4 v

  35. ! j0 ^  ]3 c& L+ r- h
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)0 M0 }6 e, j+ A
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    4 ~; Y! r- @/ Y" U! y( x
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)* O; d: g+ _: K; X3 ~: z

  39. ; b2 Y% P' I4 k
  40. 1 X! @) H5 o7 N! m: g) ?! g

  41. 5 `% l* h6 P- t' t* L6 m
  42.                 //Start DekaronServer.exe
    # k- @+ D" B, D5 [, ^# F5 x0 i
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx0 u6 B3 ]* }- |2 k8 L$ h* F: c
  44.                 if( !CreateProcess( NULL,   // No module name (use command line): P2 w: j1 J( d, t0 r. L: {
  45.                         szCmdline,        // Command line
    6 C; w! T$ J6 l
  46.                         NULL,           // Process handle not inheritable' F# P7 }6 K+ n# D* R$ B0 y
  47.                         NULL,           // Thread handle not inheritable, l+ |+ S; x# ^0 J: G  U- U1 N, T
  48.                         FALSE,          // Set handle inheritance to FALSE) F8 k% n; u) Q8 U
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    6 u$ u, Q) e  @+ ~
  50.                         NULL,           // Use parent's environment block
    9 R+ h: [7 `5 Z
  51.                         NULL,           // Use parent's starting directory
    " ~8 w: f4 ^0 n& |- a) E9 M1 b
  52.                         &si,            // Pointer to STARTUPINFO structure- R, _: P  l* S( A) @2 x
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure: o: J/ g0 ~& o: ]  l1 r$ v
  54.                 ) % s( e+ K8 ]5 U5 S- f( X
  55.                 {: R5 n2 w! O. W7 p( g* o
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );( j1 E8 L9 j( w2 ^
  57.                         return 0;
    1 |$ J9 g; y4 M- R4 B3 X
  58.                 }
    4 }3 \$ E" H- |( [) \2 E
  59.                 //Creating Process was sucessful
    1 _6 [2 i4 L! o. _9 |
  60.                 else/ `  A2 j- B- q' l( D$ R+ g
  61.                 {
    " Y! s; I, N! B& g" g  @8 K1 y
  62.                         printf("Sucessfully launched DekaronServer.exe\n");/ n' o3 u$ w! V  j' a# J6 R
  63. $ ~6 ]( p- H6 t- u
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure( b/ v! ^6 g; ]8 }! o  `9 v
  65.                         dbge.dwProcessId = pi.dwProcessId;
    4 E, |' d' j6 a1 Q5 h
  66.                         dbge.dwProcessId = pi.dwThreadId;
    / `% \4 q9 T; g5 Z- F

  67. 9 g: s7 m4 Q' T2 j" ^
  68.                         while(true) //infinite loop ("Debugger")
    4 E9 a- @  i- C: r9 e
  69.                         {
    8 A9 F. t8 v( U7 s$ 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
    9 R7 C3 g3 \; X, n8 |% [; k
  71. 9 a# R/ I2 H% i; @" x8 L7 s5 [' O
  72.                                 /*" q) Y' `3 ]! I
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

4 o4 H3 u( `7 V4 Z2 q1 b( a/ w# D* C+ W7 c
  V9 [+ \7 ~1 C, P) P# O+ G2 r
; k, @4 d6 W" @5 H
商业服务端 登录器 网站 出售

15

主题

257

回帖

1226

积分

金牌会员

积分
1226
金钱
886
贡献
63
注册时间
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

回帖

352

积分

中级会员

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

15

主题

257

回帖

1226

积分

金牌会员

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

3

主题

102

回帖

6699

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-27 07:49 , Processed in 0.055526 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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