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

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

[复制链接]

156

主题

355

回帖

6601

积分

管理员

积分
6601
金钱
1915
贡献
4175
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
6 J8 S* F2 m+ m9 M
& [; @( W- T# }# Y* t虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
/ f* @" ^9 U! C2 z; X  Y
  d$ m0 a& }* q. I5 f  E
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。" U9 I8 ]0 V5 T0 c2 w' Y
  2. //
    , |2 G, l9 r7 E0 K# k- L

  3. 3 `$ z9 t& d+ ~3 D' V0 x, g5 F) F! w9 n; X
  4. #include "stdafx.h"
    ) ?1 n. W" ~) G+ C  e
  5. #include <iostream>
    0 `. x) l5 n& A- b- T: V8 c* @4 k
  6. #include <Windows.h>
    + K2 ~0 w3 N: m# r, v$ X
  7. #include <io.h>/ D$ K% c% f. e/ p0 ^

  8. 0 Y! P/ U: i/ [. z. e

  9. + w( l3 [& q0 X* D. X$ k
  10. int _tmain(int argc, _TCHAR* argv[])
    5 G' Y$ M4 W" g0 Y
  11. {. R: o  Q0 ]  @! N' @, O
  12.         printf("Dekaron-Server Launcher by Toasty\n");3 v$ w" ~1 A8 v- s5 O

  13. , p! L) d" w% W: Z6 u/ x2 C1 G
  14.         //查看文件“DekaronServer.exe”是否存在* l/ P; ^/ ~, ?! M) n
  15.         if(_access("DekaronServer.exe", 0) == -1)
    " L5 h5 E+ g2 O* N9 a' e/ ~
  16.         {! P# u. ~7 L- p6 M; F3 \$ s! N
  17.                 printf("DekaronServer.exe not found!\n");
    ) X, ?( h# h% M2 L
  18.                 printf("Program will close in 5seconds\n");% ~9 R4 d& x' S& v
  19.                 Sleep(5000);1 {& f+ K" d' d! Q% G+ K: ?& {
  20.         }) C! T3 T3 c) i" N) C! b
  21.         else; j! V) [: H4 h# a) r4 V/ |5 M* G
  22.         {; t. p0 H, }, q: u. q4 T3 C+ z
  23.                
    $ ?  l: ^: [# l
  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
    , {) g6 W: j5 i/ ]7 w5 u4 d
  25.                 STARTUPINFO si;! O" g1 O: P' _9 F

  26. 5 ~( I+ k$ x3 L4 H% f4 ~
  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
    2 }! z# `0 G5 U8 h9 a8 ~
  28.                 PROCESS_INFORMATION pi;
    ; m9 H. W. Y- ]0 h) c4 C1 a
  29. 6 U$ M% s$ |; k% 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
    ( s' L' I, X) c6 d" ?! K1 l
  31.                 DEBUG_EVENT dbge;
    8 P, j. r: ^1 h
  32. . h7 o: {3 t- B- D
  33.                 //Commandline that will used at CreateProcess3 w& v- m# `. X: h+ L
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    : Y7 v! h- Y; T& p* a; p  t( m

  35. ; |5 T( E6 r4 c
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)5 p: m- o( x9 z/ `4 C2 b% o- x
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    ) ?. l$ _! t- \+ U9 F
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    6 s" ?  p$ L5 B8 P

  39. 0 a: T5 l6 X, i4 }$ A8 E

  40. 3 o* C% f% z: ?0 d2 v

  41. 9 ?( x  R/ t. h, d
  42.                 //Start DekaronServer.exe " z' d. e4 E# Y+ w2 M: k+ ]" A
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx% C" K  D: s7 M# x; y
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)# B; `9 H& Z) \1 u$ M
  45.                         szCmdline,        // Command line
    1 r: i5 ?! |/ A6 q2 T8 V3 M
  46.                         NULL,           // Process handle not inheritable
    # j9 }3 e6 Z8 Z! L5 F. l. n
  47.                         NULL,           // Thread handle not inheritable7 Q# \- p/ g4 j3 `& ?0 [
  48.                         FALSE,          // Set handle inheritance to FALSE
    & C& q% L* d  v8 y
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    ' m9 T5 o: ^5 u
  50.                         NULL,           // Use parent's environment block
    4 D  J$ O6 p' Y" m' M. Z: W
  51.                         NULL,           // Use parent's starting directory
    2 r! T9 G( A$ J7 c% ?; v% I  ~
  52.                         &si,            // Pointer to STARTUPINFO structure
    $ W7 N* \" P2 @# X
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure6 c' z% M7 p* A: k) u
  54.                 ) . |* f" L' M% z( p" M4 T: `8 K
  55.                 {3 c1 c0 e4 r3 x/ I3 [, n
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    0 y) N1 v; W) V
  57.                         return 0;
    ! b/ n: l: i) w2 i
  58.                 }! j7 V$ k8 X# x0 q* M) q6 Y
  59.                 //Creating Process was sucessful
    ) Z" @1 _; u$ g+ p2 P
  60.                 else1 C6 `6 s, B* i
  61.                 {) n; Q9 C9 u& s  g: j
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    " j7 F* M2 s% I6 |5 a/ [
  63. + d3 d8 t' I& C1 V
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure* R6 W( `3 D" Y, T) U
  65.                         dbge.dwProcessId = pi.dwProcessId;  j$ |1 r) Y8 `3 B$ h
  66.                         dbge.dwProcessId = pi.dwThreadId;
    ! @. F6 K7 q, X+ p0 T( m/ `

  67. 7 ]+ ~9 Z5 u% J( D/ m7 J# {
  68.                         while(true) //infinite loop ("Debugger")
    ' p9 Q+ S- G) F- ]$ s& v
  69.                         {
    : E/ F, ]0 C( l) H; `( i  j
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx0 I3 ?# Y( Q9 l* u6 i3 \6 m( ?9 E
  71. 0 {8 B5 y% ]( r) }& S
  72.                                 /*
    ; i6 L9 o* A8 u' [6 Z; d  }  e2 v3 r
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
( c  m2 Y; N0 Q: x: W1 \. G! d

1 c* I3 T0 P7 b9 e# I& Q; f; Z3 J7 z- q+ w
商业服务端 登录器 网站 出售

15

主题

256

回帖

1250

积分

金牌会员

积分
1250
金钱
859
贡献
115
注册时间
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

主题

256

回帖

1250

积分

金牌会员

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

3

主题

102

回帖

6201

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-29 22:41 , Processed in 0.061878 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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