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

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

[复制链接]

159

主题

378

回帖

7297

积分

管理员

积分
7297
金钱
2096
贡献
4664
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
7 S$ g4 Q* O; V- ?) a
& m; _* M* A; K; r5 x+ A# Z) A1 O虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
+ X: P% X0 m* ?# A0 W/ f1 V; p. f5 S8 O7 _& {. j: r" F7 D
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    ! J2 X: a; W& a; x# J' i6 e1 q# }
  2. //
    $ P8 d4 j: t2 x# X5 ]

  3. ' e& w/ P2 [1 R/ x7 l4 R
  4. #include "stdafx.h"9 s( b* i' B1 d
  5. #include <iostream>4 ~$ C0 u/ M) D4 u( x% W3 T  d
  6. #include <Windows.h>0 P% N8 c6 Z7 t) ?/ d" F
  7. #include <io.h>+ h1 I4 ~: \& v+ x2 V

  8. 5 l8 }9 p4 K$ C7 Q4 _0 P' t
  9. 3 a5 f1 N/ r" [1 C8 j# Y/ {
  10. int _tmain(int argc, _TCHAR* argv[])( Y% D! I- t+ i1 |* H
  11. {% F7 w  _: m5 \' l5 ]) m+ B' W
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    # D; {1 i+ J+ w1 B( e

  13. ; K: W, X: r4 Q* t$ a$ C$ h, t
  14.         //查看文件“DekaronServer.exe”是否存在9 U. G" h8 S7 m2 ^, o) z+ m% s
  15.         if(_access("DekaronServer.exe", 0) == -1)
    ' C# f- q" V" ~1 B- m) S& s9 `. |
  16.         {
    0 c6 ~2 d/ x0 l# E7 R
  17.                 printf("DekaronServer.exe not found!\n");; t# [' z4 [+ P/ H$ v! Z& F
  18.                 printf("Program will close in 5seconds\n");
    & O7 s( n! B  t& L5 U+ i# ]9 z) m
  19.                 Sleep(5000);5 d5 g% V% T6 T& b- O5 y
  20.         }6 `. }7 p0 {7 x& y  r. m# ^, A
  21.         else
    4 c1 G# r% }" [3 X. v
  22.         {. H. l# [$ [6 O' S& c' D1 X8 j! \7 t
  23.                
    ( l; ]( ^2 d* u* k; V! Z
  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
    * E! m$ x7 S' S7 f/ W+ a& B5 u- }  M
  25.                 STARTUPINFO si;
    4 {$ |; E0 K1 z+ t5 n& v4 {

  26. * e! f9 Z7 ]+ Q7 x$ K8 J
  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
    1 |: w7 ~* s; L# V; T& i0 b
  28.                 PROCESS_INFORMATION pi;
    # p2 O( L3 i  @4 P2 N# T
  29. , ~% `8 S& y9 R! a& Y4 J
  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' z7 u: `: i- o& x
  31.                 DEBUG_EVENT dbge;4 T- i! O2 j5 H/ [- m$ X
  32. # @/ ?2 l) Q0 P4 O8 c
  33.                 //Commandline that will used at CreateProcess
    / a  W8 {9 S; {; E7 {
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    : x) h( Y( \6 K' [# S

  35. 4 [2 `0 k. Z* P
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made); k  V' w. v: e* v! B. D
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    7 q" y( A4 K2 I5 m, ^  X" x
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)+ M2 S; ?) G0 D- X/ \' z5 f- C" w
  39. 5 @3 i' b- X& g3 b9 R& b+ ]6 f

  40. $ b$ N; O  f& ?+ f: h3 ]
  41. 0 P+ Q! k1 g; _- l" r: D
  42.                 //Start DekaronServer.exe / z  |: g, W% Y3 h6 U+ E
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    0 d7 v: {: `% [' Y
  44.                 if( !CreateProcess( NULL,   // No module name (use command line). k9 y6 b+ i/ F9 B! F; p  o+ J- O# }
  45.                         szCmdline,        // Command line
    5 F6 p( J0 l' C( c3 R
  46.                         NULL,           // Process handle not inheritable
    ; t+ C8 M  d( s# |# l( l: c4 `  `
  47.                         NULL,           // Thread handle not inheritable9 D! W9 S' g0 o
  48.                         FALSE,          // Set handle inheritance to FALSE8 K/ Q. E4 r8 X' r5 a9 |
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx2 O0 h/ x2 Z: h# v' z5 r
  50.                         NULL,           // Use parent's environment block' S# n0 {* B6 I0 J! x
  51.                         NULL,           // Use parent's starting directory ' }7 i& C, V! d3 ]9 t
  52.                         &si,            // Pointer to STARTUPINFO structure
    8 A" V8 A  A+ _2 Z. J5 W) z" o
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    ' L6 X) b5 t% K& B; z, v: ~
  54.                 )
    $ |3 _% A( ]* y+ W/ c  q/ M- c
  55.                 {5 ]0 X2 K. W( V8 p8 x. g
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );( ^& K$ O" t# @7 b0 m9 w
  57.                         return 0;( g$ @- x5 r' D' N
  58.                 }8 X, e5 T; L" p! @* I3 y" m
  59.                 //Creating Process was sucessful1 r& ~( h& j# C9 h" @7 b: t. }
  60.                 else6 p3 A1 s" L* _3 w5 F
  61.                 {0 m0 }; R- f" o
  62.                         printf("Sucessfully launched DekaronServer.exe\n");# C6 i3 L/ h. j: p9 e
  63. ! o2 r( c' s4 o( A: X% q/ l
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure9 Q! @$ Z" j. v' m
  65.                         dbge.dwProcessId = pi.dwProcessId;
    8 e( S8 q% d% _+ @1 E0 n1 N
  66.                         dbge.dwProcessId = pi.dwThreadId;
    % {0 {3 l- z! V* ~, V* [
  67. 9 K& R3 I6 U4 W( q' A5 F; e7 U
  68.                         while(true) //infinite loop ("Debugger")
    * C6 U" F' m" r7 J/ g
  69.                         {9 P* X/ W; i0 I, t
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx( [$ f9 h/ f2 @( c
  71. ) w' o: S  V6 ?+ `- `
  72.                                 /*
    1 s. [) X# g' E: ^( H1 w
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

: r' J8 K. |) i. L2 g: Y% Z- n8 S# f( p. f: j9 ^( [. D; `6 h
- M. j* \- K( r8 j; e& \
商业服务端 登录器 网站 出售

15

主题

258

回帖

1267

积分

金牌会员

积分
1267
金钱
915
贡献
74
注册时间
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

主题

258

回帖

1267

积分

金牌会员

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

3

主题

102

回帖

7577

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-15 03:08 , Processed in 0.042008 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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