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

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

[复制链接]

156

主题

354

回帖

6539

积分

管理员

积分
6539
金钱
1908
贡献
4121
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) , }) M# X- ^5 E6 E+ v* ~

% J2 F9 U* K4 h3 M虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。: b$ ^0 p$ |; W/ G8 V; x

1 J  d7 a! W, j, N; ^7 m
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。$ x" a& V, h3 ?2 n$ A; F$ g
  2. //
    0 G8 Q% k! w3 _! f, O' G
  3. 6 v) H! Z: h# @+ f: C1 X# _5 J
  4. #include "stdafx.h"
    0 Z4 e+ Q8 `- K" u
  5. #include <iostream>  S" }( J+ M$ X% q3 w+ v& d
  6. #include <Windows.h>
    : x7 L" H- J/ n  w
  7. #include <io.h>* `7 }' S  ~% L9 ~5 Z

  8. $ c" `- x& \% {/ Y/ b
  9. - b/ K7 p7 t4 c  z8 N
  10. int _tmain(int argc, _TCHAR* argv[])% ]5 i* u' O0 d0 |
  11. {
    $ P, ?9 b8 [/ F# J& @8 K
  12.         printf("Dekaron-Server Launcher by Toasty\n");  J6 g# a/ s  `' k8 O

  13. 2 H! P, B2 S1 x2 ?% Y
  14.         //查看文件“DekaronServer.exe”是否存在! M( |' ?* h: f2 c
  15.         if(_access("DekaronServer.exe", 0) == -1); c( {+ N/ i3 S2 U8 J( y' K" N
  16.         {' V2 K! a9 }1 w6 _
  17.                 printf("DekaronServer.exe not found!\n");
    . u( _: h" P0 J4 V. L9 q( g, J- X
  18.                 printf("Program will close in 5seconds\n");$ n1 z! t2 J# K. S
  19.                 Sleep(5000);
    " \' Q# W2 a9 D
  20.         }
    % u4 F7 z+ b  q4 Q5 C
  21.         else
    3 j6 X' t! E8 g; v. H- H
  22.         {& O* D/ t# k  {5 q' v
  23.                 2 v# q- w* M, d% |1 O* {) |
  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).aspx3 c" b7 Q6 I4 v
  25.                 STARTUPINFO si;
    6 ?1 ^; O  e' V
  26. $ t, [! [2 N8 p' a& 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+ M2 l: q- G' o9 w7 k
  28.                 PROCESS_INFORMATION pi;8 l0 C+ F  w6 x# q+ `  I

  29. % |& ~; {+ H5 r; G( i  h- S9 I& \
  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
    . G7 [3 s7 L3 x. o: O
  31.                 DEBUG_EVENT dbge;0 O: Z4 V& E2 g! \
  32. 5 G7 `- n4 j# H$ r; ]( j5 t
  33.                 //Commandline that will used at CreateProcess
    1 d  f  g& D! G/ R; r
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    + W: V7 c" Q( l* w6 j9 u0 M
  35. ; u3 K- U* Z, K- l
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)( f1 J9 S# q% |. T3 ^
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    0 ?" ^- M  n7 W$ ?# J
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    ! x0 z. a$ U# |9 V

  39. " K+ t, c5 h& U: M3 U- {

  40. 6 [+ [; E3 R' m2 ~
  41. - X( N) {4 c% H: ?& y% j+ ]
  42.                 //Start DekaronServer.exe * r  f8 b! r' Z5 [& b- p7 T" ]! S
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx) H7 Y. [# R( G9 `/ [
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)3 m9 u' l9 x; n5 ^/ U% A1 K4 I2 z
  45.                         szCmdline,        // Command line
    ' y! ?5 E' G3 p/ u6 j5 w3 o
  46.                         NULL,           // Process handle not inheritable/ W2 z8 H0 l, ~! D' G! R
  47.                         NULL,           // Thread handle not inheritable
    ( i  M9 ?$ b8 Z- m1 g; ~. g, F. N
  48.                         FALSE,          // Set handle inheritance to FALSE* k& p7 w  ]6 t
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx% G! m1 ^9 [* s! Q" }
  50.                         NULL,           // Use parent's environment block
    ; s$ m* f+ s  b# F
  51.                         NULL,           // Use parent's starting directory
    - \) B" y  G; P
  52.                         &si,            // Pointer to STARTUPINFO structure
    5 `+ l( K2 \; F* d: z
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    4 I  K/ R1 S" J5 j' j; R
  54.                 )
    1 }) {9 L  {6 D
  55.                 {
    / {5 @: B: e( `( v. M
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );! _# z9 S9 _1 B  g' X
  57.                         return 0;
    " e' ^5 p$ K2 f" f
  58.                 }
    2 m7 U7 M* b# ^. k0 s* w
  59.                 //Creating Process was sucessful* Q! M5 {: E& E+ W3 [
  60.                 else; Q3 I" `* U3 P' B- a
  61.                 {5 J6 P: b% c# r/ m, _1 `5 E2 t9 B
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    4 \1 D, D+ \& O5 k" z5 \

  63. 8 D: ?' ]# p0 Z' e9 h9 V
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure& O8 w* f$ F1 x; L4 I6 ?+ [
  65.                         dbge.dwProcessId = pi.dwProcessId;
    3 c2 O0 m, P7 Q$ O; H+ i' }
  66.                         dbge.dwProcessId = pi.dwThreadId;
    1 g, I, v$ m  b$ S9 E  t9 a7 |

  67. 7 A! T# `9 s* g! C9 ?% c$ b6 r7 {% Q
  68.                         while(true) //infinite loop ("Debugger")/ x5 H2 Q. o( D. {4 y. d6 b
  69.                         {" [& ~( P2 U5 Q1 b- t6 Z1 j9 I  W) E
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    ) A( A. e$ l* U9 @" M
  71. % o3 |* q- r4 U3 R, @. m
  72.                                 /*
    - ^9 ?! h3 m* H2 @! e: ?- E! G
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

9 b' \  h0 x8 _/ Z; Y, n" _( r3 ]$ v( A7 k! D* `

, s0 p# _7 {9 r7 q  b
商业服务端 登录器 网站 出售

15

主题

256

回帖

1241

积分

金牌会员

积分
1241
金钱
853
贡献
112
注册时间
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

回帖

1241

积分

金牌会员

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

3

主题

102

回帖

6121

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-26 04:51 , Processed in 0.066126 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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