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

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

[复制链接]

157

主题

367

回帖

7122

积分

管理员

积分
7122
金钱
2045
贡献
4553
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) # [$ H" `4 q; Z  Z

4 ]) Q: x. y6 c" o虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。# C% B  o) T; e7 O! o5 A" C, z

" Z1 ^! r% V' h
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    8 Q2 C: G8 N/ h( B3 E3 J" W6 Q
  2. //
    $ }$ q9 K' Y  B9 d6 u
  3. . ~' ~$ p& v. t
  4. #include "stdafx.h"% X5 O% M6 C5 C! B% I
  5. #include <iostream>  t' T; X+ l7 u9 {% ~
  6. #include <Windows.h>$ B0 K  G- v* ?! r: O
  7. #include <io.h>
    / O4 O/ g/ {3 m0 f7 R

  8. 6 B  G: R2 V0 z4 w! ?! j

  9. 5 }' Y: ^# b5 m( n5 U9 y# s  ^
  10. int _tmain(int argc, _TCHAR* argv[])
      U8 D7 X, h3 {7 q+ L1 o& L
  11. {( U8 ^- r  M( Z( s9 E3 k/ v
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    0 c; R$ N/ Z7 ?0 F# t3 X6 {8 o1 S9 x

  13. 1 D3 Z$ t0 p. V8 _) X/ [
  14.         //查看文件“DekaronServer.exe”是否存在
    8 {' v) K' p2 Y- V
  15.         if(_access("DekaronServer.exe", 0) == -1)
    9 S2 b$ C4 {1 V5 g4 J0 j6 f
  16.         {6 n4 ~6 F! h. x: c0 V' D3 Y( R
  17.                 printf("DekaronServer.exe not found!\n");
    8 x' w3 h. S7 d
  18.                 printf("Program will close in 5seconds\n");4 I# m" s: p3 U
  19.                 Sleep(5000);: o% H& a8 o- s9 n; A
  20.         }3 ^, O, J: d2 n# c' ~
  21.         else
    & F; z$ N4 t6 J+ S: f. t2 C
  22.         {' @# U& B7 r0 u9 V
  23.                 : G' w0 N+ q. t) c, A
  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  _- m; x0 I  k: P  S4 s$ f
  25.                 STARTUPINFO si;
    2 U% B9 K9 N' T: I

  26. " `/ W* J; N7 j+ W+ ?. Z. 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
    # s1 w9 u0 |- l
  28.                 PROCESS_INFORMATION pi;
    8 Y+ U0 o+ I3 h+ v
  29. & H; R" n! i( f2 i& Y4 S
  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" k* R  V! k' V, q# E) c
  31.                 DEBUG_EVENT dbge;- h5 V! M* |- U2 k1 N0 j
  32. ; N6 `+ Z8 Y9 I7 y
  33.                 //Commandline that will used at CreateProcess
    % k3 z& b4 R4 `! x# a
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    2 Y& ^/ l% v7 ^8 c3 `
  35. % U4 Z) h: \: i
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    7 i) d* `& X7 M2 H+ Q
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    : w% {$ ?( @9 e& C2 a' ]
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)/ `3 }2 j+ V8 Y1 |
  39. 3 u. ]" P& T, W" q; m- Q
  40. ! g/ o$ A  I( V: T7 U. ^; E' o

  41. 0 e/ C) L$ S8 C
  42.                 //Start DekaronServer.exe / w$ R7 Q, @8 P* z" J2 ?
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    + ^& \) a% c1 i  w/ N; w2 c! z( r- `
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)6 W) }3 e9 L3 g2 T) w- t
  45.                         szCmdline,        // Command line
    $ @4 A  N  p( b$ o& u4 \7 j* O
  46.                         NULL,           // Process handle not inheritable, P( m$ h3 Z6 d8 i2 }" r
  47.                         NULL,           // Thread handle not inheritable
      V0 W; g1 @' b+ m6 s1 I1 `
  48.                         FALSE,          // Set handle inheritance to FALSE
    ; L5 x- G( `% _
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    ' Q7 V* l( o0 Z- W6 H* Z
  50.                         NULL,           // Use parent's environment block1 J. H" v2 ?! w, v4 C  k$ E. I
  51.                         NULL,           // Use parent's starting directory 7 Z5 y( Z$ e, P2 b! W, E" V
  52.                         &si,            // Pointer to STARTUPINFO structure
    * Y/ f  \7 I) R& y4 h
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    # b% T/ c- j* T" I9 C& P
  54.                 )
    # u$ q( I8 B1 q* I
  55.                 {. O6 Q; q4 d7 ?1 P% q
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    7 r$ H  b$ |* i% e" J/ J
  57.                         return 0;5 W* P& z$ o! C- r
  58.                 }
    8 E& i$ k1 ^3 M8 S2 K
  59.                 //Creating Process was sucessful
    2 J  [* [8 r" h! E9 m
  60.                 else3 k0 p3 R0 H7 W; \. l
  61.                 {
    : t5 K4 G! ~) J! _, J" b4 w5 b; t7 u
  62.                         printf("Sucessfully launched DekaronServer.exe\n");; F8 @' P+ a+ D; O- L9 o  q
  63. : `- E! i1 w2 M+ r
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    : U+ |; T. ~' \$ g& @( {
  65.                         dbge.dwProcessId = pi.dwProcessId;$ ^  \$ e, R) g
  66.                         dbge.dwProcessId = pi.dwThreadId;
    - R' l. U. ~9 M& C; W+ e% Z- U) l

  67. 5 E7 w! @/ y. T8 v) w3 K& b- d
  68.                         while(true) //infinite loop ("Debugger")
    % w* D4 ~! A. i5 n, l: p
  69.                         {7 L  H) `9 @( M/ E- K( Z
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx: J9 P. A, [6 f/ A' a( O1 C
  71. 9 l5 o3 p7 T* @2 i' C: }2 ?
  72.                                 /*
    ! R& [9 _- v$ I$ K: f; I, B' z$ W
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

6 w% w# p3 L0 b2 z) a: x3 ~
/ }1 Y* B: e! t% V3 Y& Z4 P2 K1 G+ @5 I- _. H
商业服务端 登录器 网站 出售

15

主题

258

回帖

1245

积分

金牌会员

积分
1245
金钱
903
贡献
64
注册时间
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

回帖

1245

积分

金牌会员

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

3

主题

102

回帖

7397

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-5 21:37 , Processed in 0.044975 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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