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

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

[复制链接]

159

主题

378

回帖

7303

积分

管理员

积分
7303
金钱
2100
贡献
4666
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) ' V0 @4 i& A$ g3 M- g
. n5 ^5 I6 f/ v8 e" l5 g7 U
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
) s+ B0 o* v: _1 F5 W- {& T" G- j% i* S: \6 |+ r( G4 f/ o2 l; _; O
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。# f$ Z% @1 c; {0 n
  2. //* C$ I$ ?2 s  o$ \7 w1 @0 ~

  3. & z3 ?: E- y: o# Z
  4. #include "stdafx.h"2 M9 G- ?- V. l& U# o
  5. #include <iostream>' [( m7 i3 S- |7 ^3 K
  6. #include <Windows.h>% v+ L. z5 O' Q4 I
  7. #include <io.h>% }5 [3 s: u% B$ `& x3 I  ?
  8. ; a$ o1 a7 l  D, h& a/ Y. a8 M

  9. & \6 b# N5 n8 k1 }0 k4 T
  10. int _tmain(int argc, _TCHAR* argv[])
    8 Q% B* ^1 k( `' q' u; p
  11. {
    2 @  O& g. R3 C" V% R+ o
  12.         printf("Dekaron-Server Launcher by Toasty\n");1 @6 P* R8 g8 m$ m% f0 X

  13. , ?; B4 @) Q1 c
  14.         //查看文件“DekaronServer.exe”是否存在- O* \& U1 K: F$ w8 D6 B
  15.         if(_access("DekaronServer.exe", 0) == -1)$ M. x+ d  k* H/ }$ h1 M- g/ S
  16.         {
    4 y2 [& i1 M: Z9 N+ {. P
  17.                 printf("DekaronServer.exe not found!\n");
    7 |0 j/ l6 m7 Y: ~# b
  18.                 printf("Program will close in 5seconds\n");
    3 _' j" M& e8 d$ s$ d% F
  19.                 Sleep(5000);% x7 i- A. X1 N5 G7 A
  20.         }7 f+ H, `( f, ?1 A0 N) _5 g
  21.         else( z- E* h* K" i( i# d: d, J8 D
  22.         {
    2 o9 K1 A" v' R
  23.                 8 {% T% o- G9 Y
  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).aspx1 _! Y2 }3 \1 I' S7 Z; w- D6 {
  25.                 STARTUPINFO si;: P6 a# p/ I' |+ n
  26. ! r9 Z2 Y3 Z/ S5 t
  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).aspx7 p3 J  \. y% v7 G4 g2 T
  28.                 PROCESS_INFORMATION pi;
    $ h% H: W- J# Y0 [' {" |
  29.   M1 D5 Q- B# w& L3 K+ ?; q
  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; Y0 h  _+ ]$ ~4 }/ m! x" n
  31.                 DEBUG_EVENT dbge;
    ! P1 |7 W) `. g2 L0 b, M, f
  32. : A2 H9 _/ c- q8 p
  33.                 //Commandline that will used at CreateProcess' `1 S+ J3 \, k5 Z1 `+ j/ H: _
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    - |3 Y$ ?( \& ?8 G; g# o
  35. : y. Y' M6 i+ j6 J
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)1 s! [$ V% `4 V- f. h  V8 _9 t
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    $ t5 t% B. `# I+ e/ f
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)5 H5 w/ Q  O) j% @: B. b9 b% ^8 {

  39. 5 p$ y% K: S  O2 F5 m& h

  40. ) d& D( J7 k6 x2 X, r) g
  41. : [: N) I0 I! l
  42.                 //Start DekaronServer.exe
    # ^4 m. E$ B+ e7 `& P3 M
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx/ f5 {( D% Y; R& x- h' H
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    6 m: Z" i* z+ T5 S3 d6 k
  45.                         szCmdline,        // Command line" t! @, H4 M) D3 Y2 f, |; {0 d
  46.                         NULL,           // Process handle not inheritable  @8 Y: ~  J, P( S; W& k, ~
  47.                         NULL,           // Thread handle not inheritable& o7 J* d/ x. w' S2 L
  48.                         FALSE,          // Set handle inheritance to FALSE
    5 y, D8 g  x( i3 P' j) u
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    8 m& ^5 d. ]- {( m
  50.                         NULL,           // Use parent's environment block
    ( p1 F# R/ u. e- a  T; V
  51.                         NULL,           // Use parent's starting directory
    ! c: {4 ?  ?' W8 u: \1 O# m/ `6 ?+ p; g
  52.                         &si,            // Pointer to STARTUPINFO structure
    ! z$ k3 l7 K, i, b' o& ^0 ]
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    ( v: J; D3 _; T$ I
  54.                 ) # t( K5 s9 I7 }; c* j, U& J
  55.                 {
    ; J" _7 V6 @4 P2 C' \7 T; M; q
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    ! @# K8 ~8 r$ a4 t+ b8 @
  57.                         return 0;
    + E5 S$ i4 W) {+ Y
  58.                 }
    2 x9 j; ~) d; x7 R
  59.                 //Creating Process was sucessful
    0 Z- S3 N- x; _$ q3 y8 _! p: B
  60.                 else; z0 w$ o) k9 I! a2 V
  61.                 {: p4 C. n* _! H! I5 a
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    2 y) k/ {4 ]3 Q& o; h( b' N
  63. * V, j. K; m. B+ {
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    & \) D, }6 q5 U) E7 u+ m
  65.                         dbge.dwProcessId = pi.dwProcessId;, z8 P3 t4 u2 n+ S. R
  66.                         dbge.dwProcessId = pi.dwThreadId;
    % K" y3 f; |2 u2 E
  67. * `6 B: \0 M' ]& A! v* T! ]" N
  68.                         while(true) //infinite loop ("Debugger")
    % s( j/ ]" R( C3 I- G1 E; e
  69.                         {# ?9 }! m( X+ V: s; ~& f
  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 P: K2 r& x2 S
  71. $ N  b* e: U4 V- R* Z5 f& h8 j
  72.                                 /*# E2 O# b0 u' m- f
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
, B# m9 `" T) }) a

; F# h& E$ l5 Q! C9 S
8 B5 g& x) l+ |, O" w- H7 `
商业服务端 登录器 网站 出售

15

主题

258

回帖

1267

积分

金牌会员

积分
1267
金钱
915
贡献
74
注册时间
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

回帖

1267

积分

金牌会员

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

3

主题

102

回帖

7617

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-17 09:16 , Processed in 0.035636 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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