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

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

[复制链接]

157

主题

365

回帖

7033

积分

管理员

积分
7033
金钱
1995
贡献
4516
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) + r! M6 U7 k0 p5 g8 E/ P' i, B

$ z! [; y" Z* n* t1 R% `$ p+ s虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
+ ^! @7 `5 b) v/ n
; ~$ L" B5 I& v2 D
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。2 n0 Q9 }# p: h
  2. //
    ! U2 U" V2 t. O2 Z) X# F0 d

  3. ! A6 k$ G$ D- b! \( E  ?! n; n0 o
  4. #include "stdafx.h"1 M- W' f3 G$ g/ A
  5. #include <iostream>+ L, V, h+ H: B2 f9 `( H
  6. #include <Windows.h>2 a/ o9 j1 o9 i4 c2 ?( q5 k. A2 V
  7. #include <io.h>( K' o; e; W+ U3 D, U' l

  8. 0 m8 q; x) I8 W" I) m
  9. ) D+ R% F7 O  q, ]
  10. int _tmain(int argc, _TCHAR* argv[])2 Z3 r9 J( x5 h6 Q# K8 ^+ Z# ?& I% T
  11. {. d$ V% N* A% d6 e! v- N5 S
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    & h8 r7 m3 |6 z% X
  13. $ P9 `; r( N5 Z( m
  14.         //查看文件“DekaronServer.exe”是否存在
    / u- {6 ?  y  E
  15.         if(_access("DekaronServer.exe", 0) == -1)5 c- P( l- H9 R/ }  G
  16.         {
    2 h. h4 I- Q9 S
  17.                 printf("DekaronServer.exe not found!\n");
    ; J8 `7 w. F2 ^  z: {& q
  18.                 printf("Program will close in 5seconds\n");4 t# b: c% p4 B- p! @& \
  19.                 Sleep(5000);' k6 ?; I3 ]6 C5 E
  20.         }
    , B1 {6 T7 w' W$ I
  21.         else
    + q" E9 I6 B6 t- [
  22.         {& H6 o% A) S- z. y2 E- @( Y7 F
  23.                 0 J7 G! V2 I. p, ]( a
  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: P# i0 \+ P8 T/ ~
  25.                 STARTUPINFO si;
    ' ~" \# A- k0 Z4 b5 w# v
  26. 4 t/ d' F3 g% R$ Z! |9 y2 g- y$ w7 S
  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
    % M5 Z  `7 r; [& R) |6 T
  28.                 PROCESS_INFORMATION pi;
    ) A' j2 M$ U" i3 `  |& c3 p. Z6 _
  29. ( y# @0 Z2 `  f! |
  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).aspx8 [2 l3 D1 z7 l4 u, o! z4 {! |
  31.                 DEBUG_EVENT dbge;
    1 S- h  t3 p. z' W' I. ]
  32. * |) z) B2 S9 y- D" H
  33.                 //Commandline that will used at CreateProcess
    " {7 R4 ~4 x( q8 S/ Y
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    ) @+ ]* K) D; n3 |8 o

  35. ) `/ H5 O' h4 @, p+ l
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    3 e# I+ E$ f, D- N& ~: A0 A+ e, a/ {
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    + i) t' ^8 Z2 N6 c0 D: z
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    ' `. s: h3 L7 {
  39. ( j; D% ~; M$ k. g" A

  40. 7 U4 R, _' [/ `3 x4 X. V; q0 d# g

  41. 8 @, q9 I0 \1 u* c1 q6 k
  42.                 //Start DekaronServer.exe 0 R# j8 F  b) j0 w
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    % T3 ~) {9 W% h1 t" \. u7 b; U/ x
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    3 f. \- L1 m/ y# X, n# W5 X
  45.                         szCmdline,        // Command line# w" J( a# R9 s
  46.                         NULL,           // Process handle not inheritable
    % A" @3 _5 A2 A' t5 }3 c/ f
  47.                         NULL,           // Thread handle not inheritable
    : V+ x  Q0 u5 W' S/ T5 f
  48.                         FALSE,          // Set handle inheritance to FALSE
    0 k% y) F) z3 H2 ?& }2 \
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    / E1 |, y* n9 h7 E& f' Z# y
  50.                         NULL,           // Use parent's environment block: z1 y8 e$ i. L4 Z! w, T- I9 i
  51.                         NULL,           // Use parent's starting directory
    " p" }. O/ i( T7 o& k( N
  52.                         &si,            // Pointer to STARTUPINFO structure
    , E' r) S: |" i6 t, Y
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    ) p" q. ]/ v, T  i
  54.                 )
    / M8 R; u& L/ i) e
  55.                 {
    ' O  L& b- l2 W
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );/ F5 J+ A' |5 ^
  57.                         return 0;5 X' y( E' Y( D* v4 t
  58.                 }" R9 [  F. ~7 U7 d  I
  59.                 //Creating Process was sucessful
    8 e8 o' Y# g! e: @# E; S8 y
  60.                 else" M$ G5 c, ~* z
  61.                 {
    7 q7 X- E: J3 ^. l' y' n+ a
  62.                         printf("Sucessfully launched DekaronServer.exe\n");+ K1 k$ |+ s0 ?' o9 u

  63. * `7 r4 S# @! Y1 D) V  e% ]
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure: G) G6 `( q9 R2 r, d3 O$ z. Z
  65.                         dbge.dwProcessId = pi.dwProcessId;6 l0 U! L: _, K# \7 L$ ?
  66.                         dbge.dwProcessId = pi.dwThreadId;
    ; D! V% a7 e: Z# I

  67.   @" D2 z1 r+ H1 Z% b4 m1 k
  68.                         while(true) //infinite loop ("Debugger")
    . @) \# V& g) w; O! B: }' G
  69.                         {* H/ R: m0 V. p6 Z: g, ^
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    : m( K/ T4 u" }' V1 ^
  71. / \' ]9 u' F1 j4 D
  72.                                 /*
    ( B: ]( K+ z6 q: H9 I1 x! H# |; g
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

) m1 F9 }+ S4 N3 h" P1 F3 |! i1 [& V" F" y  T/ F! g# q
; W9 e; N- V9 K2 k! F
商业服务端 登录器 网站 出售

15

主题

257

回帖

1231

积分

金牌会员

积分
1231
金钱
894
贡献
60
注册时间
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

主题

257

回帖

1231

积分

金牌会员

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

3

主题

102

回帖

7057

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-3-19 17:30 , Processed in 0.041173 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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