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

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

[复制链接]

150

主题

299

回帖

5277

积分

管理员

积分
5277
金钱
1689
贡献
3139
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
, d. v8 Y. W" j: i$ b% y1 Y# ]9 `% f
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。$ z8 Y* w1 I% H* U' ^
# r6 u0 C0 D& b9 f
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
      o: P! `: [0 j5 U
  2. //" P( f% b: Y2 j; p  s& u1 s) K

  3. + e2 x+ t# K( ]
  4. #include "stdafx.h"8 E& l2 R7 B2 ]+ {# t
  5. #include <iostream>3 q9 k2 q9 O1 ~. u8 a, C6 W4 O/ E
  6. #include <Windows.h>' J6 H7 J5 S; [4 L' F
  7. #include <io.h>
    ) \! I& }% O; E0 H  P0 \" o

  8. 1 l% O" h% z) N) q0 g8 K0 ^, y
  9. 0 F# Q9 _  \3 Z/ `6 t
  10. int _tmain(int argc, _TCHAR* argv[])) e; B$ J8 o$ O! W: X! C$ q
  11. {# x1 h& y4 w0 o9 t
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    ( T; v0 `; R( M% c& ~! M
  13. $ l0 Y+ v- n% h* e6 ?
  14.         //查看文件“DekaronServer.exe”是否存在3 Z7 [" m) @$ P2 ]9 o& s* j
  15.         if(_access("DekaronServer.exe", 0) == -1)
    & d) b" `( U+ V
  16.         {
    ( J7 Z* B: X+ S  h$ j9 M. d
  17.                 printf("DekaronServer.exe not found!\n");
    1 ^3 C, A; ^3 f% `9 ~- |
  18.                 printf("Program will close in 5seconds\n");
      f4 l( B4 n# b/ }7 l  O% j
  19.                 Sleep(5000);6 m& u0 C2 W* c: j' Q
  20.         }
    ' }2 U% F0 i0 S) r: n; p
  21.         else$ b4 e+ ?$ S1 _+ c; X2 ~
  22.         {
    2 A5 {7 j' Y6 I
  23.                 * S9 q& ^! u& J4 d* o" {. q* g
  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
    $ ~7 x2 W) {6 X# G4 |
  25.                 STARTUPINFO si;
    * g" E, R% A. M5 [: F
  26. $ \3 o' [) ?/ w* s
  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 t3 ~4 h) G$ u7 n! A. I2 D
  28.                 PROCESS_INFORMATION pi;
    $ U: Y0 I5 Z1 Z+ m5 f
  29.   d( _8 a! G& R! q8 @% K! e) P
  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
    1 o! ~9 B4 _5 O; T4 U
  31.                 DEBUG_EVENT dbge;
    0 J# [9 [: |: v  T) r2 S6 H  S# }
  32. 3 P/ v( _8 `2 d( e& ~1 D
  33.                 //Commandline that will used at CreateProcess
    3 u: z: g! T- z5 N: o+ s
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));/ Z* u5 ]/ r7 l: @% f

  35. ) ~: _) s, F3 d
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)9 d) _- l5 w# x6 i
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    " ?; v" W; ^9 ~' V* [
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    ! l% G. T: R: k6 C0 g6 C

  39.   d2 M4 [* Q5 D. ^

  40. ; u. `& _1 s; O! r

  41. , l* @: f. }9 P% M  b$ |* @
  42.                 //Start DekaronServer.exe
    0 P+ T9 |; Q0 D- A0 c$ f1 J" Y
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    ' U2 T9 n) a: L5 i' Z
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)' c4 m/ d# b7 @
  45.                         szCmdline,        // Command line
    $ [* y# l( M  _
  46.                         NULL,           // Process handle not inheritable0 S9 L' Y. _) I5 U( D/ }! g3 ]  p6 \
  47.                         NULL,           // Thread handle not inheritable
    - q. R# w/ s4 t1 Y- [7 K2 C4 D
  48.                         FALSE,          // Set handle inheritance to FALSE
    + r) K* Z- ]* J) m
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    ; Y- y6 s1 A% Y) j8 @
  50.                         NULL,           // Use parent's environment block8 l1 L2 m* w. k4 w7 l* Q" ?5 t* H4 r
  51.                         NULL,           // Use parent's starting directory
      r6 c: S9 t& E+ f: f; f) K
  52.                         &si,            // Pointer to STARTUPINFO structure
    , N. B0 Y7 s# u3 Q. Y( Z: \$ Q; g
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure. U* z7 v1 B! C8 R
  54.                 ) $ Z3 Z# Y8 _8 R! Q: j4 Z! \
  55.                 {- D* o: g) |+ P& F9 N
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );/ z; v; `2 m8 N$ B/ x! b
  57.                         return 0;
    ! U6 |' H* O2 M! w
  58.                 }) o2 }" U7 g- [' \8 Z( p4 Z
  59.                 //Creating Process was sucessful
    & q7 a- f" @% H- _, Z) y5 j/ D
  60.                 else7 @/ f- Q* ]2 m0 B# C0 ]. @/ }
  61.                 {
    * l9 }2 w/ o5 m* s
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    5 G% X$ v" f/ {  r7 ~- K( p$ b

  63. ( ]- `# R# h9 n, L5 g
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    6 s# e1 N1 n" d, C" ?" W4 R1 @
  65.                         dbge.dwProcessId = pi.dwProcessId;. Q0 o6 Y: t( N& E! J' `, s5 ^
  66.                         dbge.dwProcessId = pi.dwThreadId;
    2 m& t6 f( d2 J, L+ \
  67. # z: R- B: W7 L3 x9 I# I6 F8 h( i
  68.                         while(true) //infinite loop ("Debugger")
    2 ~) R  X' u1 X  X" Z, w* p
  69.                         {, i; ^  u4 A  g
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    ' s# z, M  }6 B. [$ S

  71. + q1 @1 G% l8 e( e
  72.                                 /*- F+ {) h4 u& W; g, g3 b& m& g
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

0 l- v1 g) Y1 A% w( S: j; E6 a' J8 A8 X# W

3 R1 n9 w  I2 f6 _# ?6 t
商业服务端 登录器 网站 出售

11

主题

246

回帖

1140

积分

高级会员

积分
1140
金钱
727
贡献
151
注册时间
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

主题

204

回帖

340

积分

中级会员

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

11

主题

246

回帖

1140

积分

高级会员

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

3

主题

97

回帖

4192

积分

金牌会员

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-10-3 11:28 , Processed in 0.050555 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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