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

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

[复制链接]

155

主题

352

回帖

6236

积分

管理员

积分
6236
金钱
1880
贡献
3849
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
7 T, [6 ?' r7 Z# o! ]$ a2 C
7 z" a! c2 m4 S0 j' R虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。7 n  d2 K- O. p8 V2 [
& p3 k5 H  ~$ ~3 ^
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。. |1 I. v/ ?+ F& E" L
  2. //) A: `+ {( h$ ~+ M! U# u1 {
  3. + z7 A* h1 Z0 l! f
  4. #include "stdafx.h"6 x$ H8 a" l: _) d- \. ]  ?
  5. #include <iostream>
    * p1 O2 F4 i0 Q4 Z: h  |
  6. #include <Windows.h>! E$ a6 N. i+ P( m3 i
  7. #include <io.h>: M# ~) i( \) h  J* K0 A

  8. 7 K/ v0 c. X+ A1 R9 N

  9. 3 o& [2 V7 d/ I2 c! ?
  10. int _tmain(int argc, _TCHAR* argv[])$ w& j- f( L+ ?  y; n
  11. {
    ; \4 n0 \: L5 `0 Z9 W3 M% |/ n9 X
  12.         printf("Dekaron-Server Launcher by Toasty\n");+ ?) c& T, \. g& g* v+ a

  13. . `0 E, k$ z1 o) M9 z
  14.         //查看文件“DekaronServer.exe”是否存在( _9 H6 _9 U* ~6 ?" z8 W8 j  Q
  15.         if(_access("DekaronServer.exe", 0) == -1)
    ' i3 k3 G( N! t3 t; U
  16.         {
    + U- |: D; j$ V9 _% q6 v2 Z. x
  17.                 printf("DekaronServer.exe not found!\n");
    0 L/ ~$ B, a& A( {; s
  18.                 printf("Program will close in 5seconds\n");3 ?- N) f9 C7 F) L- Y: m- a
  19.                 Sleep(5000);6 b4 V" L: c! y$ i* L1 w& U" |
  20.         }
    ( K: ]) [9 _' A# l; W
  21.         else9 ]: ^' ~) [5 P; @0 o" p
  22.         {
    6 w! `  S' g/ }* R
  23.                 : Q1 N$ w5 Z$ B0 f1 S) \9 d% s# G. D4 ^
  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
    ; J0 K2 p# D2 L, w. e% v; }5 |1 I
  25.                 STARTUPINFO si;
    & i$ J$ M. o6 G: v

  26. ! c" v, Q. F+ }7 J# a
  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; A. H$ C& o) J0 h3 m
  28.                 PROCESS_INFORMATION pi;
    + N" Z' `' b, i- M- j, ?1 f0 h: {
  29. % \4 P% U* f" V& S( n2 P& h
  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: W9 ~; R: B! Q- N" f+ R0 @2 b0 ~
  31.                 DEBUG_EVENT dbge;
    2 Z  C& H7 ]* z8 F

  32. + v5 `* i  g( I8 J
  33.                 //Commandline that will used at CreateProcess
    , O* C6 C! g  V2 N+ b
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));6 [- e0 _2 ]- s2 h5 y' i5 Q
  35. % S, B& O: I4 [4 K0 E/ x' [& v* I# \
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    ; s  C, \/ O' l6 Q' Z; @/ J! f
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn). V' f+ w) ?6 [0 X1 U' O% n
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)/ ]+ t6 `- U% S. R0 Y  m: \- A6 ?- @
  39. 0 }8 o$ \% C; V# F
  40. * ~3 I& i8 o8 ]8 q

  41. ! Y3 [1 `8 Z! b- J
  42.                 //Start DekaronServer.exe
    3 F. K9 \3 h: Z, F
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    0 K3 v* T* i; {$ F* J: c6 [
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)$ F/ p  @; W  A
  45.                         szCmdline,        // Command line* l) q8 \6 S9 Z5 y. T
  46.                         NULL,           // Process handle not inheritable
    " L# g% p' u' ^* r1 X( q  q1 N
  47.                         NULL,           // Thread handle not inheritable6 y: n2 P. H3 v  U' `$ C) B- @
  48.                         FALSE,          // Set handle inheritance to FALSE
    3 w% Z8 d! t! A) Z& r* P* W
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    & n) T+ V9 F6 C! m0 T
  50.                         NULL,           // Use parent's environment block
    % B/ G3 }# Z2 W- _2 a; j
  51.                         NULL,           // Use parent's starting directory
    - v" |( k0 u6 i4 o/ H
  52.                         &si,            // Pointer to STARTUPINFO structure
    2 s* K- ]( J! }0 [& I+ X5 @
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure4 b* X1 |/ M* Z; Z& R
  54.                 )
    1 v0 F% U+ @( u
  55.                 {% U% K; e2 v6 Q8 D& |& M! a
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );" o1 \# v! z- m- f* r' ~: H
  57.                         return 0;
    4 a# K' [2 U* u  G  c
  58.                 }
    ; }2 i$ l2 q$ C3 F3 _6 K5 G
  59.                 //Creating Process was sucessful1 L" D6 n; W( m) q# d
  60.                 else+ ~& Z2 V4 a' S; C
  61.                 {) [4 t: _% i& c0 ?
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    8 H$ ^: x2 W8 o- Q& D3 g
  63. 5 _; H1 K/ j$ g. \3 w
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure* {" q) D  u! p0 B2 E& E, e
  65.                         dbge.dwProcessId = pi.dwProcessId;6 Z$ J- B" h3 k) v, D( c% l; u5 }) u
  66.                         dbge.dwProcessId = pi.dwThreadId;
    2 k* i5 A" p* x7 o6 p2 q, A
  67. 7 ^0 n4 R& H8 K9 g$ A
  68.                         while(true) //infinite loop ("Debugger")
    ) Q1 C- }1 U7 w) u
  69.                         {# [# N; W' Z, r+ E5 H1 x+ W" f0 X
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx. K2 h, a& |5 ?! h
  71. : Q' t. Y2 f4 H5 H- I% n
  72.                                 /*
    : K2 {6 n; r* U- D* P9 t- G2 Q/ F/ w
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
8 [) |2 H* `- F$ D3 A: `  N

/ _9 e8 X: r% `3 |( J& d1 l0 D
' [" x6 S& A9 L# H+ t7 D
商业服务端 登录器 网站 出售

13

主题

251

回帖

1253

积分

金牌会员

积分
1253
金钱
828
贡献
156
注册时间
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

主题

251

回帖

1253

积分

金牌会员

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

3

主题

102

回帖

5923

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-13 00:12 , Processed in 0.084145 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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