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

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

[复制链接]

160

主题

385

回帖

7427

积分

管理员

积分
7427
金钱
2133
贡献
4749
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) $ S6 v1 E+ |5 H+ I, n
9 i8 p0 `3 K+ n/ B% `* y
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
) ^' C, C7 E# `' D0 M2 p: n7 O! Z% E+ P9 x* |% S# `; @0 {% C
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。& y" D5 _+ k- l: [2 D' c
  2. //
    ' n( a: R8 ~' a

  3. 5 b. N* Q4 W) q0 k0 }# A0 ^
  4. #include "stdafx.h"1 [) O8 a% g8 _! m
  5. #include <iostream>
    / u  [4 e  ~% _$ s- o* L% d( N& A" q' w
  6. #include <Windows.h>
    1 x( C! {2 P  V. [; |$ U0 ~
  7. #include <io.h>
    7 W% A( z% ]0 ]( U
  8. 7 Q  ^, J- R/ t  g8 _  R$ ]0 z

  9. , Z- m( y6 X; `$ E: E
  10. int _tmain(int argc, _TCHAR* argv[])5 z! w4 h( s+ b% b" _
  11. {
    5 X, s2 X1 @# P2 ~3 L6 q
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    0 V& |3 c3 p; G

  13. $ {9 K& s- u+ W" o6 k
  14.         //查看文件“DekaronServer.exe”是否存在
    ( j) @5 B& Z" X1 f; O7 l+ y
  15.         if(_access("DekaronServer.exe", 0) == -1)
    ) w* R  `- ?( ~  [. z) h1 U) K8 f
  16.         {
      i9 t: p) i( S6 M1 s' w
  17.                 printf("DekaronServer.exe not found!\n");& ?6 M5 Z" ]5 t& r8 ^0 u
  18.                 printf("Program will close in 5seconds\n");8 @4 Z' ~( S$ o  _9 {* P, M( `
  19.                 Sleep(5000);" F+ k* P  Q" H* u& \9 N% Y
  20.         }
    . I: `( P: p: m* a* s3 `
  21.         else
    4 i9 O, \! ?2 x' N
  22.         {. R& {: q. o7 r0 _* Y1 Q+ f
  23.                 ; O- c+ k8 i& X  E# U0 N+ m
  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- \1 R2 M' E& W2 I$ ]& m& q& K
  25.                 STARTUPINFO si;
    7 Q0 H, ~  q' r3 y

  26. ) P1 h7 |5 x6 Y5 m
  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
    6 p. e4 Z. i1 E- d- ]2 M( S
  28.                 PROCESS_INFORMATION pi;
    $ E/ I' n/ C+ T/ K5 L

  29. 1 [5 A/ _+ }6 ]5 B, y* 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
    * r6 R6 s" Y5 Z, r( C+ r) g
  31.                 DEBUG_EVENT dbge;
    7 K9 K: q0 W3 x; h; Y
  32.   q. F, k9 R+ L! z. A) Z$ I
  33.                 //Commandline that will used at CreateProcess6 N* S7 ^4 U; }! }- R) g9 M
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));. t/ |9 J. X' @9 |& Y& n

  35. , ~, _  P; j" |7 L
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)0 ]6 e' I* i# W2 e  h; m6 o
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    8 a; ?- [8 {/ q* @$ |+ m* J
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    6 f" B* ~+ B, g$ C/ C, ]& m

  39. % R1 r) \9 U- ~2 `* Y4 D- {
  40. 5 b/ P9 I9 H% p% @
  41. 0 w4 N/ C* Y) J# j0 A
  42.                 //Start DekaronServer.exe 6 g8 |, b+ B; J9 M
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    3 W( N/ L$ I$ Q
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)( J' B8 G$ ^8 k+ ^+ \% ^
  45.                         szCmdline,        // Command line/ [5 j5 V! p3 L  V3 v5 H
  46.                         NULL,           // Process handle not inheritable3 u# U6 h; X( d8 b+ F2 M2 _# W
  47.                         NULL,           // Thread handle not inheritable9 a! X& @4 w  y$ P2 H$ ~- \! s
  48.                         FALSE,          // Set handle inheritance to FALSE7 n( M* s3 h) f
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx1 g" D3 [0 o' h3 j; H% \' ?
  50.                         NULL,           // Use parent's environment block( v! ]6 v5 E, N% F5 F$ P
  51.                         NULL,           // Use parent's starting directory ; x( R  ~0 ~1 |0 w, R% Q. T( K
  52.                         &si,            // Pointer to STARTUPINFO structure8 U) b1 g* E7 K1 m: x
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure, a' k3 A# R3 s, L# l, _
  54.                 )
    0 H/ S5 i- A  j, S% K  h& p
  55.                 {
    8 P3 \% m# _2 i3 s) @7 M
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );4 D! L2 t) l% G* f4 H0 W
  57.                         return 0;9 {% F+ t9 \7 k. W. E6 s
  58.                 }6 E# q* N2 ?& i! M
  59.                 //Creating Process was sucessful% v7 u* E- |1 \" B( L
  60.                 else
    / O4 V/ f6 n+ N/ ^" H
  61.                 {
    3 V) R$ [6 ?) [
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    & V( c9 |, O/ ^4 ?/ u- v
  63. 6 T& {6 d$ T3 r- H( E$ J
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure# u9 d3 A$ o6 t9 C2 e. \
  65.                         dbge.dwProcessId = pi.dwProcessId;
    / }" G, j7 q6 H- Z- U  h
  66.                         dbge.dwProcessId = pi.dwThreadId;* P. a. J5 }/ a5 M

  67. 3 J  E6 R0 S/ o- x8 L4 n5 K
  68.                         while(true) //infinite loop ("Debugger")$ n4 c  r9 R/ M& \! z6 i, O
  69.                         {/ l' ~6 x" Z8 P6 w' t. U
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    ' q, z1 O5 y5 l$ V2 @4 r9 j' R7 E
  71. : ^& u1 a% R: Z
  72.                                 /*% X" d( s6 @/ Q' t' N8 z. W
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
1 E* d' _7 \5 L$ x. R
% i* p( f, W: e* w

; w9 x& |  ?1 l" n( d. M
商业服务端 登录器 网站 出售

15

主题

260

回帖

1292

积分

金牌会员

积分
1292
金钱
931
贡献
81
注册时间
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

回帖

355

积分

中级会员

积分
355
金钱
142
贡献
6
注册时间
2024-5-14
发表于 2024-5-14 15:56:57 | 显示全部楼层
学习学习赞赞赞

15

主题

260

回帖

1292

积分

金牌会员

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

3

主题

102

回帖

7937

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-5-3 04:32 , Processed in 0.039260 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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