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

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

[复制链接]

156

主题

352

回帖

6298

积分

管理员

积分
6298
金钱
1886
贡献
3904
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
' l0 }& j" {& X! c2 ], p8 x  I/ a$ ]
( G0 ]9 |. A  M0 l2 V% j虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。, Z2 b: P2 J" U5 ]
0 |8 T  ?. T9 Y. h& Z6 `8 V9 d
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    4 ^2 R- p; I  m8 `8 \
  2. //: Y, y2 `: P! \

  3. $ O3 Q1 |( E7 {; ?) \4 P) Z  w6 r
  4. #include "stdafx.h"% j) A1 h8 x2 p, n3 l4 I0 {4 m! K
  5. #include <iostream>
    0 |2 J% ]6 v8 I+ ^
  6. #include <Windows.h>+ Y8 Z- a) a- w3 `2 p& ?# F) r/ p# [
  7. #include <io.h>  ]$ \* W/ x9 n% e8 {' ?5 z$ k! b
  8. ( r+ c' Z* h+ S* g$ ~1 R% Q

  9. 9 a' g$ F& b5 X, ^2 F
  10. int _tmain(int argc, _TCHAR* argv[])
    0 e5 j/ }, d' s. ^" u$ T( |* r$ c( ]) J
  11. {
    % q8 K. z* M3 B9 j: z- ]. b
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    1 {3 J7 Z0 v' c5 I, o1 Q3 f
  13. " o9 ?' [) P; v0 B* M4 o
  14.         //查看文件“DekaronServer.exe”是否存在
    . V" R! \8 Z! S
  15.         if(_access("DekaronServer.exe", 0) == -1)
    + x; |9 g8 G: V0 F: T, w
  16.         {
    ) y* D6 ^2 a5 X* y) |/ O
  17.                 printf("DekaronServer.exe not found!\n");9 r* K% Q: W% U2 V
  18.                 printf("Program will close in 5seconds\n");" U4 f: B/ T) I  t
  19.                 Sleep(5000);2 U* D/ {7 T9 [+ t; A3 J; Q
  20.         }
    4 V* p- k) N' p% _, K
  21.         else
    1 c0 m0 w6 U, U- _6 o) [" l1 s: j
  22.         {
    2 w$ k- S( W1 z! ^
  23.                 6 @' _& \- c) l/ d
  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 i6 w0 j1 U  c& N
  25.                 STARTUPINFO si;
    ' ]  z% {5 `* `, h

  26. + O) O+ ]* |9 o2 T6 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
    9 H0 W9 z- `* Z( ]8 m
  28.                 PROCESS_INFORMATION pi;) H# T: r& [8 J! Q
  29. 3 X; f% d$ t4 X
  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
    + h3 i7 [3 i) n8 n- f/ G% P
  31.                 DEBUG_EVENT dbge;
    " ~! X$ M8 a4 U

  32. # Z- T: R( O% O9 y' s! R
  33.                 //Commandline that will used at CreateProcess2 a/ B: H: |7 j) D& I( m
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    ) v; f" d" D; M
  35. 6 H0 o& Q/ L# {
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)) H/ A0 P: d, K( V" U
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)8 Y9 |4 O- V! I3 ^& @
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    & B. J, ^$ N- m2 J: G6 }$ |" O
  39. # H0 X% I) \1 N: [
  40. ' ?# V) }1 P0 Y$ c

  41. 5 V% X1 c7 u; i2 D+ U& B& j
  42.                 //Start DekaronServer.exe 6 S3 x) |- w0 C6 W$ I
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    " i% G8 i+ |2 q8 a+ n0 g0 Q# ^
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    5 @, U$ a, U( T+ ?% ]
  45.                         szCmdline,        // Command line
    , g8 `+ u2 x7 q8 @3 K
  46.                         NULL,           // Process handle not inheritable
    4 S0 n! [1 S( O& E% @: q4 W# o
  47.                         NULL,           // Thread handle not inheritable7 P, ^5 k5 F5 T6 c0 N! K0 _
  48.                         FALSE,          // Set handle inheritance to FALSE: a" b9 _# o- W4 x
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx- d  X9 z2 M& i/ K( Y) H( B# o1 F
  50.                         NULL,           // Use parent's environment block
    : q) I0 M+ K4 H" X
  51.                         NULL,           // Use parent's starting directory . r' Z* n  Y1 s5 t1 |6 d
  52.                         &si,            // Pointer to STARTUPINFO structure8 v: a9 q& s: S' F, L& ~4 k( n8 Q
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure! N* e. i! H$ G8 V6 M; A
  54.                 )
    3 K0 U+ y4 \4 @9 W1 y: u0 I
  55.                 {2 Q9 F! t) {6 ~3 m1 n# d
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );+ r0 t5 W! n; l7 x; x
  57.                         return 0;
    - [2 W' c& J3 I+ f* O+ u. }. m6 x, G
  58.                 }
    6 Q1 L' {! @; E) L
  59.                 //Creating Process was sucessful
    $ L- ^% l! V% e, ^$ v3 Y1 t9 c
  60.                 else
      {1 ^" v' u& b, e' |) M  r) O
  61.                 {2 Q; I2 _  ^% p& W' N) V7 }
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    * l. e1 G; U" {  d

  63. 5 H5 e( S+ }7 `. w; I) |
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    5 p; s  H$ k9 N5 X+ j# I$ d# ]9 r
  65.                         dbge.dwProcessId = pi.dwProcessId;" \! L5 }# {) ^. J6 R" p
  66.                         dbge.dwProcessId = pi.dwThreadId;8 o9 S" j8 n1 S" T- D

  67. 8 g. W& S4 v. [5 z
  68.                         while(true) //infinite loop ("Debugger")% ^& T/ h8 B9 `* _. H  c( `
  69.                         {
    ! |' C4 {5 P4 W; @
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    ( x" z* s) ]  |; p! t, o, h# G

  71. . j0 i* O0 w7 ?
  72.                                 /*
    , @; d: y5 H% o3 z. d7 @
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
3 o. }* \, E& j# M$ L; q

, K% D) H8 V0 A2 A
5 {' s1 K$ N: \/ X
商业服务端 登录器 网站 出售

13

主题

253

回帖

1229

积分

金牌会员

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

13

主题

253

回帖

1229

积分

金牌会员

积分
1229
金钱
838
贡献
120
注册时间
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-17 09:02 , Processed in 0.076646 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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