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

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

[复制链接]

156

主题

352

回帖

6298

积分

管理员

积分
6298
金钱
1886
贡献
3904
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
! M+ {% _& n6 E/ j" A4 D, V6 O7 p# I* S/ e, q7 R
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
) Q" {7 `2 n/ ^* A
6 E( ~4 `7 W# E, `+ V; ~% R3 V
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。0 C+ v9 b0 |5 R, _( y. ^
  2. //
    " X9 ?9 H- M4 G8 `& G4 t, w

  3. 6 @6 ]7 @: U; w% a* t" [
  4. #include "stdafx.h"
    ; F1 _, _* R7 V1 a# m4 z: T
  5. #include <iostream>$ M! b, S% d2 c
  6. #include <Windows.h>% e' W4 |; b& W/ ]7 \
  7. #include <io.h>* M% l/ k) w( n' _6 ~
  8. / T; Y5 H  o3 [; M

  9. % @9 R! M5 H- ^6 k
  10. int _tmain(int argc, _TCHAR* argv[])
    % G7 G" Y5 G  J$ l7 d8 N
  11. {
    , {4 n; C( N, f, |
  12.         printf("Dekaron-Server Launcher by Toasty\n");: T3 k8 o+ w0 X1 ~
  13. 2 r( {/ J# j2 j3 F8 Z
  14.         //查看文件“DekaronServer.exe”是否存在  n& f" h% G; K2 x) |( N
  15.         if(_access("DekaronServer.exe", 0) == -1)) @% ?* u8 l! Z( h7 }) P
  16.         {' c8 g1 y" l& x8 U
  17.                 printf("DekaronServer.exe not found!\n");  i* q5 N+ q* H5 Z$ a
  18.                 printf("Program will close in 5seconds\n");
    ; x* u; r2 s- B: v0 C9 {9 B
  19.                 Sleep(5000);9 t+ R3 v5 e! q' f+ }) M7 g- n
  20.         }
    2 O% z' k* Y( Y* K9 Z" T, s$ l7 i4 n
  21.         else( [7 o8 x0 f$ h2 o2 c; z$ w7 D% v
  22.         {
    . t8 i/ M! F4 x: S5 x% X/ j% ?' M
  23.                 6 [' R) d- S4 v% C4 c( `
  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).aspx5 y# j; k3 E# h3 t  t, V! E
  25.                 STARTUPINFO si;
    , y; j: A6 A- M9 I

  26. 5 D3 U( N7 x: F
  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).aspx4 {1 f5 K  R' r- b) d6 J! E
  28.                 PROCESS_INFORMATION pi;/ N  j9 v8 t' n/ x- k2 t& M$ ~
  29. , u1 w- u; V6 P" i+ L1 A
  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).aspx4 x0 n+ D- X4 C( k) Y
  31.                 DEBUG_EVENT dbge;
    8 M5 C, X6 e2 ]  `' ^
  32. ( A, \% G  i, G7 q6 ]$ |& f
  33.                 //Commandline that will used at CreateProcess
    3 }. O, V- k2 j6 A* k* A6 D
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));. @0 p9 y- S0 k; u6 U- y& Q: ~' L
  35. # Y+ [' b' D' ]+ G0 N6 g+ h
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made): s9 V1 R7 a' n5 W+ w9 e) u( y+ ]
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    & U5 t6 V: r; K- `2 z) u
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    ! E) p% p( _6 x7 H0 u% [, v! s

  39. 3 E4 D: b7 o/ X5 q
  40. - O* f+ y/ B& A' b# l2 `9 {6 S

  41. * z3 w" d( A  T9 x4 h
  42.                 //Start DekaronServer.exe
    1 W) T3 r  {4 ^$ S! h
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    ; v1 e! ^1 |& s% b( l9 I
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)% @, g  k3 ^& u$ X: i+ [
  45.                         szCmdline,        // Command line
    2 [% K4 |0 W1 X- a. ], g' G9 u
  46.                         NULL,           // Process handle not inheritable
    + G: x$ k/ ?7 I& K! _9 n' x6 G
  47.                         NULL,           // Thread handle not inheritable# n; P% B1 A3 y9 s
  48.                         FALSE,          // Set handle inheritance to FALSE! Z  ?5 B6 _8 s; W( |
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx' [4 {; O0 U* ^$ y# |$ t! x
  50.                         NULL,           // Use parent's environment block
    0 [- O( Z/ Y& L2 S- W1 H
  51.                         NULL,           // Use parent's starting directory / O9 Y0 T( e6 u' V8 I3 ^
  52.                         &si,            // Pointer to STARTUPINFO structure1 H4 N+ T/ A) `' i+ B8 p
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    , I) b& C  T$ ~- O9 s7 `
  54.                 ) * }4 G' i8 V: Z8 f; }$ y+ G( P
  55.                 {* Q  Y! N& K2 ?: t1 u  ~+ b7 E
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    ) T8 J& Z# y: {! ^
  57.                         return 0;
    ( z& t1 M+ f0 S% _8 t# m
  58.                 }8 J$ p$ W) M. o3 ~
  59.                 //Creating Process was sucessful
    % j/ F  }! C- B+ t" L- n1 }" t
  60.                 else* d$ t5 @+ q* n( F
  61.                 {
    # a8 O4 h( B4 x+ I
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    % V& H1 d2 M% d7 k7 ]6 E
  63. # F2 R, `3 |" y. p  l1 z  c% e
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure' Q' M: m* m6 }8 X! H  c0 N% o
  65.                         dbge.dwProcessId = pi.dwProcessId;# Z: @8 q/ p6 D- }) Y) l( T1 ]3 ~
  66.                         dbge.dwProcessId = pi.dwThreadId;
    2 z" J' Y. V4 u  i, d& c: t
  67. * _; C& `6 N' {" P4 F
  68.                         while(true) //infinite loop ("Debugger")
    $ b+ T" |6 n2 e# m
  69.                         {; z$ `  \. M8 a! `6 Q
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx0 B2 s5 \, Q- W/ K1 S& k/ l- q

  71. * b; H, M: f& h
  72.                                 /*
    2 y: U$ r3 [) {8 O' ]  f
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

- Q8 k: E6 q* n5 S2 t/ y5 |3 k2 N: l! ~

( L9 O2 a& C* D3 R' o  @$ i
商业服务端 登录器 网站 出售

13

主题

253

回帖

1229

积分

金牌会员

积分
1229
金钱
836
贡献
122
注册时间
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

主题

253

回帖

1229

积分

金牌会员

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

3

主题

102

回帖

6003

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-16 20:37 , Processed in 0.076279 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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