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

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

[复制链接]

157

主题

360

回帖

6652

积分

管理员

积分
6652
金钱
1928
贡献
4207
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
8 K$ T" s" e2 }) t4 }5 h1 w  `2 {/ l) y5 R
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。, Y( e0 [* \& R" A  l6 s0 f/ {9 t

$ }$ g3 N! H2 z. f' _
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    : b3 J, N3 [/ u: x
  2. //, q2 |/ n6 s8 ?. }' R' j% f

  3. ( S; P5 Q* L/ L
  4. #include "stdafx.h"
    ! j" m' O, S9 }7 e
  5. #include <iostream>
    + P8 {4 d* Q6 C1 X9 O) \9 U
  6. #include <Windows.h>& a# V) Z8 z4 _4 ?; b/ Y# S
  7. #include <io.h>1 e$ t" j7 Y+ j) e- Y
  8. ) u6 c5 W0 l7 u6 ~( X* [, d7 S0 k
  9. + ]* K: K( K" |% ]" M
  10. int _tmain(int argc, _TCHAR* argv[])
    5 ^) T! j$ C; J
  11. {* S: n/ p0 A/ t1 v
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    ) e( m, o9 `- S$ s9 m4 r' [

  13. % T3 o) I; o  q9 X( g
  14.         //查看文件“DekaronServer.exe”是否存在
    ' t2 K9 A' Z8 _: a* F2 _
  15.         if(_access("DekaronServer.exe", 0) == -1)" U7 K* {: w0 ?# x" p; x
  16.         {
    . ]- ^- s9 T2 ?! {6 a- t) v
  17.                 printf("DekaronServer.exe not found!\n");7 n4 |; M6 L* B( Z
  18.                 printf("Program will close in 5seconds\n");# h! t0 j4 ]0 E
  19.                 Sleep(5000);
    0 Z2 {% l7 q% l) n
  20.         }
    , o$ N; C" V3 I' {0 U+ e8 \
  21.         else8 t3 a0 N' n/ k& v- d
  22.         {/ c3 g2 C$ B) H  u  c
  23.                
    0 ~* N5 _- E/ t: A4 C$ \% R
  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! f7 u  v1 b" E  q
  25.                 STARTUPINFO si;  J( {- p( n6 }( s. {+ y
  26. # n9 Y2 h3 W/ q
  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 e4 ?0 q/ @* o- q! @
  28.                 PROCESS_INFORMATION pi;- C& \7 ~* {: [, a' ]2 v
  29. ! z! @4 c$ C' ]: k8 ^4 v
  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: p. X( @7 h3 Y) ?
  31.                 DEBUG_EVENT dbge;( C# x2 m$ \( K- a4 ~5 a* F4 j- D# D
  32. ' Z) \' p! l* l7 [
  33.                 //Commandline that will used at CreateProcess
    ' ~; r  {% w1 d: V4 _4 B
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));2 P! I& L' O5 v7 N
  35. # N9 e" X: R1 D3 K: e
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    7 R( M: d* k; ^
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)# b2 l! L, A, ]8 i9 B  \" o
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)1 _+ i4 F# ]" i) Q/ i) J" U' q1 Q1 h0 G
  39. & g+ X! |; C2 p$ q3 Q; B) ^# C

  40. 3 q) m; Z* n7 J
  41. ' c7 u, D/ d! J- |3 X8 W8 _2 W: `
  42.                 //Start DekaronServer.exe   q2 \, X: C8 P/ ]4 N1 p- l: R
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    2 Q) ?, e- ?3 e/ E
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    . I  X9 Z9 a, e# \" v
  45.                         szCmdline,        // Command line
    4 b( H  i/ c( [& ], F  P/ P
  46.                         NULL,           // Process handle not inheritable1 h! _8 }" _7 ~: m$ |: y, H( V! d
  47.                         NULL,           // Thread handle not inheritable( W) o1 o& u  s% a% I
  48.                         FALSE,          // Set handle inheritance to FALSE+ P, q6 m* @6 d3 X
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx& h8 N3 V2 b3 q1 B' {, B
  50.                         NULL,           // Use parent's environment block
    . C" |4 H* ~4 y6 M' w/ p
  51.                         NULL,           // Use parent's starting directory
    . v7 X" p5 `0 Q+ s% b: m$ O
  52.                         &si,            // Pointer to STARTUPINFO structure$ o" [1 T9 y" T# F8 [. T( s5 C- U
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    * A7 |+ a$ N4 M1 M  `
  54.                 )
    : w# i+ q1 \& D5 G( \* O
  55.                 {
    ; f) x) y3 s& R+ M- o- {
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );. R" O2 Q9 ^$ }9 u6 ^- u- i& X$ r% T
  57.                         return 0;! X0 n, `. j- J9 k! u
  58.                 }! v$ A6 b9 m, N; u( C2 n
  59.                 //Creating Process was sucessful
    / G: h5 Z. L4 J8 ?. |
  60.                 else
    : X, Y+ d/ p, }
  61.                 {: @0 ~" ~) j8 w4 t+ m( _( U# j. Q
  62.                         printf("Sucessfully launched DekaronServer.exe\n");2 |4 X$ q$ @# {1 W+ w( u1 L- J
  63. " {( M, C( S$ S- v; _; B
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure. Z* f. h3 }& N% C5 x, N) h
  65.                         dbge.dwProcessId = pi.dwProcessId;
    $ o" V3 |. U( O$ |
  66.                         dbge.dwProcessId = pi.dwThreadId;
    8 p7 Q1 e7 [1 w! D
  67. 5 }; W+ p3 F- z) U5 f" |9 E- c* a6 Z
  68.                         while(true) //infinite loop ("Debugger")  t1 _8 X$ p8 l& S
  69.                         {
    ! N& m1 |/ B5 z2 |
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    + }- F3 o8 v2 G5 r; U

  71. - d! W: q- C: T0 Y
  72.                                 /*
    ; L! {0 I! u+ q) r, P
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

4 n$ h$ ^6 M' g
/ ~  a+ l. E1 u8 r' c+ }) v# i, r% o  q/ K
商业服务端 登录器 网站 出售

15

主题

256

回帖

1259

积分

金牌会员

积分
1259
金钱
865
贡献
118
注册时间
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

主题

256

回帖

1259

积分

金牌会员

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

3

主题

102

回帖

6341

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-5 11:13 , Processed in 0.076354 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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