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

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

[复制链接]

157

主题

367

回帖

7119

积分

管理员

积分
7119
金钱
2043
贡献
4552
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
/ S' Z9 }1 h; v" }; I. R) O: e  u) @1 U$ _% J3 T
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。/ t3 b# o- d8 p9 S! l% X+ v7 V

4 L$ g+ \3 \* C* ?
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。, [3 O  y" i5 s3 Y
  2. //" H, Q2 [8 i$ r1 u0 j* \
  3. 8 |! w' Z7 a/ G0 a# l
  4. #include "stdafx.h"
    ' ?' a( G1 u+ M* v
  5. #include <iostream>6 q. C( p( A& P: {" N) X  O
  6. #include <Windows.h>/ X" B0 D& E! W" i. v
  7. #include <io.h>% v/ \1 V/ }* O5 D: ^3 ~
  8. * j/ J, b1 @& V' ~8 c# ]4 {

  9. - H4 C% `1 ^: w( b0 p8 u, I
  10. int _tmain(int argc, _TCHAR* argv[])0 E/ d: e8 g4 _* y6 z: a- z8 P
  11. {
    3 L# A" P5 U! X% j
  12.         printf("Dekaron-Server Launcher by Toasty\n");  r, F3 A( W* [7 |. s  S  y1 G

  13. 7 j4 r7 N% Q3 a) h" V' W
  14.         //查看文件“DekaronServer.exe”是否存在8 T4 {( P- d. K* i( |5 h
  15.         if(_access("DekaronServer.exe", 0) == -1)
    7 _- L! b, C- I/ b, Y6 G
  16.         {
    ' b- L  J5 Z. ?, a1 q5 ~8 _' @0 S
  17.                 printf("DekaronServer.exe not found!\n");" C9 n- b# K5 K' m0 Q1 B% Y2 }( C! x
  18.                 printf("Program will close in 5seconds\n");
    5 v  c5 X: \9 p) @1 z9 l
  19.                 Sleep(5000);
    ! q" g! r" A4 E
  20.         }
    7 A' |" n  V, _  a* u! x
  21.         else' r/ N$ R6 V5 D; Y) I
  22.         {" j' J) \, z8 i- h! V+ ]
  23.                
    ! m9 W7 ^% k+ \2 k+ B
  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
    8 g* ]( w9 F2 D2 q7 L% A+ d* g
  25.                 STARTUPINFO si;
    & e2 R6 M, _8 V4 Y  ^
  26. ( M# s2 L" E6 s: D  Z9 d/ f2 [2 c
  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
    + w4 \* u5 K/ G5 U9 v4 R, E
  28.                 PROCESS_INFORMATION pi;& ?) z% K0 H' m

  29. 4 H  l( Q( C2 P& L( y6 b
  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 z& i6 y0 ^: G4 q( i4 P
  31.                 DEBUG_EVENT dbge;7 t# ?( U( l  K! H! G2 z

  32. 8 y: z. d4 h1 v9 w0 a
  33.                 //Commandline that will used at CreateProcess
    - d& z4 }1 u; z1 }
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));0 U) a. R6 a7 d% M! F
  35. # S) v3 x! M& u, F, |
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    6 P' c! @! a+ C8 q8 B! u0 x
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)8 {/ x5 S, c! `0 }% \+ Q, s
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)$ @( I' J9 g$ \4 j: {9 d0 O
  39. $ V7 T: n/ T/ i6 f# a

  40. 8 K5 m' e$ M) p
  41. / x  G) i1 s  o
  42.                 //Start DekaronServer.exe
    4 a* i4 f) W% T
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx% U: v' q" B6 }& _7 p; W
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    / u  n% y" J: O% E4 e6 h
  45.                         szCmdline,        // Command line
    ) C6 G  B! E) r" k1 G
  46.                         NULL,           // Process handle not inheritable
      H8 t% _8 U! Q) A/ G% `: f" h0 \$ G
  47.                         NULL,           // Thread handle not inheritable+ }, F7 w# w& D% O8 U
  48.                         FALSE,          // Set handle inheritance to FALSE
    9 t' p0 [  q' c; ^* l; q
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    5 U4 _& _/ w! a4 D
  50.                         NULL,           // Use parent's environment block
    & i, i) M2 R, E
  51.                         NULL,           // Use parent's starting directory / C/ c8 Z* C) d7 q+ s& o# V6 N- d  A
  52.                         &si,            // Pointer to STARTUPINFO structure
    8 l, }! n. d0 \' c" ~) l4 V( [
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure# j$ r! R; w' E  }: C+ f
  54.                 )
    ' L8 Q8 V# V. H% t- N# a, u
  55.                 {
    ' P. F+ a: X# N0 ?' a. H
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );& s) |& {6 c/ J% k8 e; D( M5 j
  57.                         return 0;2 S, w, d! Z5 [: w. }7 ~# f
  58.                 }
    " _4 Z! _7 w" Z3 P3 I
  59.                 //Creating Process was sucessful
    7 j7 r7 i) x+ X% r3 s
  60.                 else% t* l) {7 d) ?: K8 L# _
  61.                 {2 B# a) T+ Y. C
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    8 \, H5 @2 F3 L" r! Q. H

  63. 4 @: I( p; G' y7 b/ S" H# m
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    * h' w" H2 Q+ `6 h0 L0 [- I6 ~3 \2 ~, E
  65.                         dbge.dwProcessId = pi.dwProcessId;( m" I8 A9 A7 B
  66.                         dbge.dwProcessId = pi.dwThreadId;& x/ a" p+ e& i) h
  67. + L$ Y* [5 ]6 S. r; A: p( \
  68.                         while(true) //infinite loop ("Debugger")
    2 }6 Y0 [( C& h& n# r; r0 M
  69.                         {
    ' j+ L  K0 e/ U3 P7 {9 L
  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 v1 F" X0 E; T: t. h" q6 B& c6 f

  71. : c* x9 R* T+ X+ v
  72.                                 /*
    ; d2 f/ r6 x3 D2 N- l& \
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

( j) h# ]' b" {/ @" f; I: P) q
1 K" X. H" v. u$ _
6 P# ], G, a+ ~, y
商业服务端 登录器 网站 出售

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

回帖

7357

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-3 06:49 , Processed in 0.041680 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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