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

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

[复制链接]

149

主题

294

回帖

5195

积分

管理员

积分
5195
金钱
1666
贡献
3086
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
0 [! j9 H& d  F3 I! r
$ J  ~3 i& U6 J+ W" @( R0 l6 B) T虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
9 X4 H; @5 `& h) n# H/ s5 l/ O+ Y8 a5 \$ p  e5 Q7 ]7 n; h
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    $ `; e9 w' L* u% V
  2. //+ l* Q7 ~3 V. P, M1 b
  3. ; R' }$ ~( S1 L* ~# `5 R1 w
  4. #include "stdafx.h"
    3 x1 M) c" i. {: D
  5. #include <iostream>
    6 V: V- h2 ^( X4 K$ J" C6 A' J' y
  6. #include <Windows.h>/ i& m2 E8 s7 |( F2 i# C7 M, j
  7. #include <io.h>
    + A6 g; c$ A3 ~, m6 s

  8. 1 l8 c* o4 k6 }
  9. ! W4 S6 V, k% r! I7 h! v8 _
  10. int _tmain(int argc, _TCHAR* argv[])) L* J7 P4 N: X7 s1 h8 l1 v
  11. {
    ; T3 y: U2 p; C5 ~5 Y
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    4 d9 p) `* I8 x  C: Z) B
  13. , f8 I/ P: X6 f2 c5 M; Y
  14.         //查看文件“DekaronServer.exe”是否存在% b' `5 b% l% X4 F) x1 Z: U
  15.         if(_access("DekaronServer.exe", 0) == -1)
    % ^8 \  R) F8 B) \
  16.         {/ X1 s& S0 W+ j! Y$ r
  17.                 printf("DekaronServer.exe not found!\n");
    1 a# w2 ?, A! D5 M/ K
  18.                 printf("Program will close in 5seconds\n");
    ' q+ n6 q3 d2 }; z
  19.                 Sleep(5000);
    ; Z, P/ ~" X; {- i# z, m( n
  20.         }2 }3 f  T- h1 [5 `, ]; F1 a' P. W7 V
  21.         else
    % \, e+ c; G, k( a
  22.         {
    + y2 K9 C5 n4 G! a* @$ _
  23.                
    , p& f( K& v9 P, @& w8 y" z: 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
    + S' q- ?0 P' V  {3 J
  25.                 STARTUPINFO si;: E' j. z7 t6 R4 A7 w5 ~& \3 R
  26. 9 P% U$ W* [8 S: W9 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).aspx
    3 P3 ^; X9 T, L
  28.                 PROCESS_INFORMATION pi;; D/ F. L; b& I) D4 q
  29. ) j# _+ M& v; g. @7 n9 C
  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& |. k- D; u% l0 r8 o1 ~
  31.                 DEBUG_EVENT dbge;
    , |) G6 X3 C+ e, G0 |

  32.   S6 @+ Z- b8 M. b; B, h0 P
  33.                 //Commandline that will used at CreateProcess' r6 P! i8 P* _" L1 y$ U' D
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));, V8 u" J& k* Q$ p0 D- ~; a  f
  35. 2 [# y: R, I8 G0 j
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    2 K0 c3 `* O% L2 U4 X" ^0 v
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)$ t+ W$ v* s: ]- y5 f- X
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    0 [8 F, M- P# @# i+ g( {: t
  39. 0 o5 V) [' s: O2 ?7 T+ I
  40. 4 x7 v" y2 z5 h2 N6 {& a# X5 L
  41. ; ^0 N) f2 S: ~  b+ z0 @
  42.                 //Start DekaronServer.exe
    - v, i9 I8 J; u7 c: {
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    3 A/ {% q5 a0 ^7 E& r
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    * {9 L% {" S- C% z
  45.                         szCmdline,        // Command line
    5 ]. ]( `1 b  ]) X6 g6 J/ U" t; b
  46.                         NULL,           // Process handle not inheritable3 Z3 j" u# G: n* p) L" ^9 s
  47.                         NULL,           // Thread handle not inheritable6 K& O  {# o5 Y: J: z4 x+ P* f2 E
  48.                         FALSE,          // Set handle inheritance to FALSE
    + T2 O5 v* ?1 C; H
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx/ P6 s. |4 B; B/ I
  50.                         NULL,           // Use parent's environment block
    ( Y) y0 t- Z* d" E
  51.                         NULL,           // Use parent's starting directory # q6 P4 y, l2 c2 y* w+ G5 x
  52.                         &si,            // Pointer to STARTUPINFO structure: R9 H) ^# s. Q# ]; Q/ J" w
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure# F) m4 L) D3 Y$ G8 o. }7 S6 U
  54.                 )
    8 P' K: }: N' ]9 {# ?8 W7 i5 W/ `
  55.                 {
    0 ~8 u# H! @' D
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );( K6 L: r' i6 w  \
  57.                         return 0;" u$ k& m7 a$ {2 g; G
  58.                 }
    ! ^% s" }- n5 a9 C! T
  59.                 //Creating Process was sucessful
    ' \$ `3 L6 @5 G* D4 Z  E
  60.                 else7 O; I; K. @5 h9 S" k$ s$ D" o% I. G
  61.                 {
    8 `+ o' z+ x1 S3 ~  }: A' J3 W7 M
  62.                         printf("Sucessfully launched DekaronServer.exe\n");: O1 g4 r- H( C3 r+ ~2 D

  63. + p9 {% w! x! L* e6 q7 j
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure4 x1 U, w+ v4 Z8 U# ^& m
  65.                         dbge.dwProcessId = pi.dwProcessId;
    7 _1 [1 |; J- F# j( N% F
  66.                         dbge.dwProcessId = pi.dwThreadId;
    : w% r7 X. k8 g- j$ X, |; T
  67. - b& Z+ ]* X" @2 ^/ v% z
  68.                         while(true) //infinite loop ("Debugger")2 G, ~5 S1 E: o8 Y' ?  s  i
  69.                         {
    0 r# e% V) M1 C6 x, F- r
  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 e2 b0 j1 p$ @3 A$ Q7 v6 Z9 B# l
  71. - \2 A, O$ G2 [/ U: a' O( {$ {
  72.                                 /*
    4 ]/ ~% D3 j/ K) z" W  p1 p
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
% X0 u2 `" h5 i
% x1 ]" ]& W2 ^7 Z+ t+ L* T

# ^! _" i( w- F4 r6 w
商业服务端 登录器 网站 出售

11

主题

245

回帖

1124

积分

高级会员

积分
1124
金钱
712
贡献
151
注册时间
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

主题

204

回帖

340

积分

中级会员

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

11

主题

245

回帖

1124

积分

高级会员

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

3

主题

97

回帖

3919

积分

金牌会员

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-9-20 00:12 , Processed in 0.049577 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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