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

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

[复制链接]

156

主题

353

回帖

6347

积分

管理员

积分
6347
金钱
1889
贡献
3949
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) # P. N: Y: X; |" p( q8 x3 V) g

: j$ m4 V6 o; k6 F虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
0 |$ f, h" F2 z% Q$ |, k, D! o6 M5 w8 a( _. p/ ]$ E- Q
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。) m7 _+ w2 R4 t
  2. //) l/ c" h1 C' R6 j

  3. 8 \6 ]6 j1 s. b% C" J3 [: f
  4. #include "stdafx.h"
    0 i! [6 I. B) ]2 @, _
  5. #include <iostream>; [" N- W: Q9 G- F$ a5 Y
  6. #include <Windows.h>
    ) G+ C, j+ i; y" f( e! A9 G' M5 R9 X
  7. #include <io.h>; N; f2 |: \8 {5 n, O! {
  8. 9 g5 d+ W3 {0 q$ ]3 Z/ n; N
  9. ( p6 U+ K& s! A% N3 b! d7 c
  10. int _tmain(int argc, _TCHAR* argv[])0 e( H5 t- e9 P# x3 N5 S0 _
  11. {
    % t. n3 B$ Y/ N5 I% {9 ]$ B+ E
  12.         printf("Dekaron-Server Launcher by Toasty\n");0 H) A/ k% v/ e/ U9 j: B" F
  13. ) k% ~: t' f+ r- T; G
  14.         //查看文件“DekaronServer.exe”是否存在; n% }! |. m4 t* `6 Y* z9 r* f
  15.         if(_access("DekaronServer.exe", 0) == -1)
    4 z! a) m4 m/ U
  16.         {9 A( {$ H1 Y* q
  17.                 printf("DekaronServer.exe not found!\n");6 g3 `  I+ o+ C* D5 p. ]7 S( {
  18.                 printf("Program will close in 5seconds\n");  L) q# K# v8 M
  19.                 Sleep(5000);& \0 i! C- B, h; B1 G
  20.         }
    ' S; O* S5 [2 U4 q1 q# N
  21.         else: t1 t4 {9 k9 S; `2 v; B3 h; {
  22.         {2 E6 }6 q+ T/ {  Q
  23.                 ' y  {( z& o  F* F. O' r
  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
    5 V# B  l* T* p, n
  25.                 STARTUPINFO si;
    / u; Y: w, ~  ^4 N7 f4 A- j& l

  26. * E  p6 j. Z& Z- Z+ e  d/ N
  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
    ( P/ y9 T6 u% a6 `: a
  28.                 PROCESS_INFORMATION pi;
    8 X& P! l  M4 O* W" `. }
  29. 8 ?1 N4 W2 [$ {$ G( \
  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).aspx9 ~1 [) L' b  B8 T8 Z
  31.                 DEBUG_EVENT dbge;1 M3 c- ~5 Z& l

  32. % O4 k6 X9 A/ O9 F
  33.                 //Commandline that will used at CreateProcess- k  Z+ U! K# i+ I8 Q; l
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));8 q6 p9 h+ A7 t8 \0 j2 L, K

  35. 2 d* s1 P$ T; X
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)$ X/ ?: W8 {& e& L! \5 E
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    0 _' }: r2 g  e: x( y
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)/ k. j9 N/ e' }' X  ?

  39. : b, Z. E7 z; t3 s, y7 A  V, [
  40. - w+ S# b  H: h: w+ O
  41. ! F3 S; A" i( \  h. L/ Q9 s8 t4 g
  42.                 //Start DekaronServer.exe 1 }8 m% O/ C3 ]! L* C/ ~7 J
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    $ p- a# S3 q% t: _: G, W
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    4 a3 H( S% [( P+ _/ _9 S
  45.                         szCmdline,        // Command line- D% j- `+ ]# N1 T# {! W. Z
  46.                         NULL,           // Process handle not inheritable
    2 Y2 d8 p* h3 B( x7 l# E3 u
  47.                         NULL,           // Thread handle not inheritable
    3 p6 @) R0 i! \% w& o2 y/ K6 G
  48.                         FALSE,          // Set handle inheritance to FALSE( t1 ?/ K2 P9 }# v1 O1 T
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    # x# j$ i1 K5 M( P% L( Z
  50.                         NULL,           // Use parent's environment block
    2 w4 F. ~; f4 b+ ~* z+ F
  51.                         NULL,           // Use parent's starting directory
    " c+ s' B2 D9 P3 ^6 i
  52.                         &si,            // Pointer to STARTUPINFO structure/ t6 Q4 Y8 H4 `7 I
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    , X! m3 F( u2 X
  54.                 )
    4 p8 z3 \7 Z# T& ~- O
  55.                 {/ y8 D: B% G5 P+ }
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    . v+ u9 }/ N' T6 r( F" Q
  57.                         return 0;
    - E4 M; @* @% T8 g5 Q* k
  58.                 }! X% D1 p$ N) F/ H8 \0 A6 V
  59.                 //Creating Process was sucessful
    1 @7 r4 Q4 R( x8 L! [+ K
  60.                 else6 ^, [4 N) s7 j2 H* j
  61.                 {) Z/ G5 y, F) B- [
  62.                         printf("Sucessfully launched DekaronServer.exe\n");/ A$ e7 E- C0 J

  63. / ?) p0 n: T3 f# J* i; A7 Z5 R0 t
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure' B1 D8 w$ g5 D2 [5 X$ q
  65.                         dbge.dwProcessId = pi.dwProcessId;0 }$ X3 ~! L7 h* V$ o
  66.                         dbge.dwProcessId = pi.dwThreadId;
    & A# R! f: _& }: X
  67. ; O8 F; J2 m' _9 Z  U: h+ y
  68.                         while(true) //infinite loop ("Debugger")" l, T8 A4 G% S- e9 ]
  69.                         {
    % ^$ G- r5 [8 O- d7 a3 b
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    3 Z/ {5 Q+ l1 n( T
  71. 6 s- d1 _% x2 T  W1 `0 R8 Y
  72.                                 /*! ?. S6 D# o; {1 I& j, ~
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

' C/ O# K, n7 s4 y; k0 L9 @" l/ }" s3 p+ D8 G

; K* B2 N* N3 y2 }  t3 }
商业服务端 登录器 网站 出售

14

主题

255

回帖

1234

积分

金牌会员

积分
1234
金钱
844
贡献
116
注册时间
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 | 显示全部楼层
学习学习赞赞赞

14

主题

255

回帖

1234

积分

金牌会员

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

3

主题

102

回帖

6003

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-18 11:18 , Processed in 0.078471 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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