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

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

[复制链接]

159

主题

375

回帖

7217

积分

管理员

积分
7217
金钱
2089
贡献
4594
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
( M7 Z0 t3 N) A2 R. s& j9 j/ `- d0 R
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
+ c2 l( ?/ k0 `5 d) b& w. p0 X# ^( a% [, [* n" x
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。% W' r5 ]1 T: h/ T
  2. //
    $ M- k! R" z' C; U, q# n: i6 ~* C5 z
  3. 2 O9 }$ r* j" x7 i7 d2 f% @; K9 t
  4. #include "stdafx.h"& m0 n9 {7 d# _; k1 F( P
  5. #include <iostream>
    * ~0 c0 K% ~0 V2 J) O! z+ G) n
  6. #include <Windows.h>2 y! N1 H" y& M2 f. ]- i$ _0 b
  7. #include <io.h>% ?! T, L3 U) }6 \) D- O

  8. % [3 o& I7 e. l9 P( v
  9.   C- \, F* X0 _2 s/ G% S/ u( c! z
  10. int _tmain(int argc, _TCHAR* argv[])$ Z# p7 K5 t: O8 X' p( h1 m2 v0 k. _
  11. {- G7 q6 E; c/ m- b# n: f
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    1 s# v' v' S/ G: |: S0 ~# k( \+ Q. P" c

  13. 0 U0 q5 N  I8 @2 a+ ]) F
  14.         //查看文件“DekaronServer.exe”是否存在
    : e) v. p: w- z/ c7 c9 U- V
  15.         if(_access("DekaronServer.exe", 0) == -1)
    4 v$ ?" Z9 w4 \/ b8 [3 F
  16.         {9 H6 v8 S: i- O- E
  17.                 printf("DekaronServer.exe not found!\n");1 ^! A3 c% v& ]2 @$ W9 g
  18.                 printf("Program will close in 5seconds\n");* P9 |  V; X6 k! f2 q
  19.                 Sleep(5000);' D9 G4 j% X/ M
  20.         }& x' o  N8 U8 W3 Z2 k: l# u
  21.         else' t. `7 s9 ~, d& h% z" Z; g
  22.         {1 F7 _4 Z+ j$ h3 S+ C3 O, C% H: H) ^
  23.                
    ) X! {* N; k+ v8 m5 o( D  E5 ]  t
  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
    / y2 g3 @3 y+ ]! K
  25.                 STARTUPINFO si;
    1 j- q* }" j8 c1 s! O" C
  26. + r  h, A6 F0 V: T! G) @& 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! ]4 _/ ]' d4 j0 {
  28.                 PROCESS_INFORMATION pi;2 G7 A( h) S. e) F* C0 N
  29. 6 A# b( O  H" T; m* g& y/ m
  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
      T3 w) X. f, l; Z( W4 Z0 @4 J
  31.                 DEBUG_EVENT dbge;, a1 t2 E0 B: g. |

  32. 0 {  {* }& {5 @! @2 r
  33.                 //Commandline that will used at CreateProcess
    # H4 T$ Y( m8 l% ?6 I
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    $ M+ |3 I) j; W+ D% X' b

  35. , l' E3 w7 L# J9 F$ K5 l
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)  Z1 Q4 l# s/ u* h( J
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)0 ?6 ~: T# S9 q  L, z+ F" V
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made), H9 L! g  N. `& Q. b* ?8 t
  39. $ s7 Z/ Z: z9 |! H) I6 P

  40. 0 V' k' M4 c4 ^5 N7 n. ~
  41. 7 l; u1 Z5 f: [8 Z, J6 b- R
  42.                 //Start DekaronServer.exe
    0 k7 U- [9 M$ f- `
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx. u! G, j6 _+ r2 {! J  [
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)" d& c0 c1 I7 w4 Q; _
  45.                         szCmdline,        // Command line
    & E; I. ~3 S3 \5 @
  46.                         NULL,           // Process handle not inheritable4 s) X5 O: W. D/ e
  47.                         NULL,           // Thread handle not inheritable' [) h  \8 K3 l( R
  48.                         FALSE,          // Set handle inheritance to FALSE
    : P' \; j* t, p6 U) r
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx* w# t- O  h% y8 A9 D5 k- x
  50.                         NULL,           // Use parent's environment block0 s0 j2 `6 M7 d# {/ l8 {) [
  51.                         NULL,           // Use parent's starting directory   l+ v; ~  W9 g* S7 ~% k5 {
  52.                         &si,            // Pointer to STARTUPINFO structure# [, d! s# \8 _1 c' P
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure7 @) r: X+ o; `9 Y) B% _
  54.                 ) 6 D$ C, h( b6 F8 k  O: {4 U
  55.                 {
    6 T* L! o) w0 ^4 ]; o& V$ S% ?
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    3 O% h1 C" A$ j1 e# W- v3 y, N
  57.                         return 0;
    / J+ x- p$ J4 M- s4 s: Z
  58.                 }& G. F  _7 l/ m5 j# P+ Y& q9 o
  59.                 //Creating Process was sucessful4 U- F7 n  |6 e0 T- W
  60.                 else0 h( W( d& [! V+ W
  61.                 {
    1 a; v' M" w  O  ]4 r7 B) ]5 R
  62.                         printf("Sucessfully launched DekaronServer.exe\n");. P- r' q) q4 p: x3 R  R
  63. 1 n7 h  w& T( H7 V, Z) r! Q) f
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure- \8 |& P( F7 f) o, v$ s  D7 R
  65.                         dbge.dwProcessId = pi.dwProcessId;
    , t; r- I+ f- v
  66.                         dbge.dwProcessId = pi.dwThreadId;
    6 L1 `% D3 W9 S, I8 I$ w4 ~4 ]  l6 }1 ]

  67. + v' ^( f+ m& T& }
  68.                         while(true) //infinite loop ("Debugger")' y9 V4 ^8 ^" D
  69.                         {- X( s7 z" V6 Y6 W; J8 k1 t  X
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    2 I( \. X4 K, W; l$ n- ^

  71. " T" {1 E( K6 j7 X+ A, s
  72.                                 /*
    $ c" f# u2 ~* T. `; j
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

! o6 G1 \: B* h: d% C& y: w1 K$ f- k8 s! {; h; I! P

1 j( z9 i% q2 ~% G/ c
商业服务端 登录器 网站 出售

15

主题

258

回帖

1254

积分

金牌会员

积分
1254
金钱
909
贡献
67
注册时间
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

主题

258

回帖

1254

积分

金牌会员

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

3

主题

102

回帖

7537

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-12 17:49 , Processed in 0.036492 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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