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

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

[复制链接]

156

主题

354

回帖

6542

积分

管理员

积分
6542
金钱
1910
贡献
4122
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
! l4 t7 G' X' ]* L* V
% G0 r# e4 h+ ]. |5 L4 V/ ^虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。) Q) |/ O( Y$ v% R/ C
' I2 z8 w- g. j% O4 t9 ]2 r# |/ c
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    3 M+ N3 T* D9 p/ r
  2. //
    * w! h+ ]! H( z2 [! C

  3. & X8 V: |& j! j; g1 n3 E1 U! {
  4. #include "stdafx.h"3 W+ I) q% p2 t) h' |* s
  5. #include <iostream>
    8 V$ b9 A" O  P& k8 V9 T' [
  6. #include <Windows.h>
    9 O, O: r5 x7 D
  7. #include <io.h>
    + ~( W5 A' E/ ]

  8. : b1 k$ v- ]0 q# L; r. k
  9. ( j5 ]1 C" W; J( u
  10. int _tmain(int argc, _TCHAR* argv[])
    ' w4 c4 l; [" ~1 r6 o
  11. {8 X0 {& [" f2 r6 c$ g
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    - z' c4 W2 A; i& F" W7 ?, ~2 x

  13. $ L+ s" J/ B2 j$ s, ^, F8 L
  14.         //查看文件“DekaronServer.exe”是否存在
    5 Y. C$ ]4 M$ M
  15.         if(_access("DekaronServer.exe", 0) == -1)
    8 `; B9 I" h4 z, b" f: |. M
  16.         {* `( R6 j6 B8 R+ j: ^
  17.                 printf("DekaronServer.exe not found!\n");
    2 b4 B4 f( }$ R
  18.                 printf("Program will close in 5seconds\n");
    " l# N  y% B; L+ R) H9 j8 ?
  19.                 Sleep(5000);
    ; r( p% k  \3 h1 _* r9 O
  20.         }2 R/ }& Y2 V9 \6 R
  21.         else
    3 Z9 S# M4 H4 `2 |; U2 H# U
  22.         {! p* D0 v, \" h6 u/ p; C& ?7 u$ O1 t
  23.                 * F2 G2 }8 N$ s, z. l
  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+ k) R/ ~- @0 K6 ], X! h
  25.                 STARTUPINFO si;7 {9 u& A3 m# z$ f

  26. ' Y' ?4 ~( Y8 s: k
  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
    ) X% {: a) F- J  ]: ~# K9 u  |* `
  28.                 PROCESS_INFORMATION pi;
      {9 ~1 y9 J4 k4 t- s3 X( Z: E+ I
  29. - w" l, ~3 s3 S3 Z' h3 r2 ^  y
  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/ R. |$ x& `: p0 }0 S; |
  31.                 DEBUG_EVENT dbge;0 }8 N4 d  u1 c5 e

  32. ( |! K+ {" C+ ]1 `# d5 H
  33.                 //Commandline that will used at CreateProcess5 V' V$ ^9 q, a( x% t6 D
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));# p5 z9 t; a+ F% z. y3 ?6 F) k+ Q- f

  35. # [6 Q' s2 \) e; r# B* q
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    ) m; ^1 K( J: _2 u0 G
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)9 r' n. L7 w+ k2 o( \; n! l
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    7 N, z8 @" o: u, v

  39. 7 K5 T0 {. A+ p: N( A) l* S6 |* k: |3 V
  40. : d! m; P; w2 v+ M4 y$ z

  41. . ?; x3 k- J- l! [
  42.                 //Start DekaronServer.exe
    7 Y, S0 C' l: d) c
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    / P' I# R/ z0 }3 E& P6 |/ g
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    % N+ b- k! j+ [5 o: v8 b
  45.                         szCmdline,        // Command line0 B& V1 ?# G* b. X+ D& G
  46.                         NULL,           // Process handle not inheritable
    6 ]" }+ o$ l0 h" e
  47.                         NULL,           // Thread handle not inheritable+ A/ |+ O" d8 {" Q0 a
  48.                         FALSE,          // Set handle inheritance to FALSE
    * |& }# ]# c! t/ M$ I2 A% u/ D+ ^
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    9 H) B6 \- I; |* `( S  l
  50.                         NULL,           // Use parent's environment block! C$ C8 a# ~0 g, Q$ L8 U
  51.                         NULL,           // Use parent's starting directory $ S0 I( W$ }1 e% S! `
  52.                         &si,            // Pointer to STARTUPINFO structure1 O$ R2 [& `* J# [: G
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure3 n: }- w3 }2 l/ {$ k1 g5 g0 E0 @. B
  54.                 )
    6 z# b  P$ e5 S+ d1 R6 X$ k
  55.                 {
    ' c- H2 k+ e+ ^+ P5 y
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    $ r  i4 X+ q$ r: W( f! U" r/ @
  57.                         return 0;
    4 Q- A0 a/ d2 L% D8 Q" `
  58.                 }
    : w6 l6 z- O8 k# Z2 L5 Q. |. V( B4 P1 U
  59.                 //Creating Process was sucessful
    , N9 R+ J; b3 }
  60.                 else5 e* V- r0 M" p+ ~; q8 K8 @4 r
  61.                 {+ D/ b  l' V! t; m8 O4 h# p# ^
  62.                         printf("Sucessfully launched DekaronServer.exe\n");( q  e1 y2 d2 L6 E$ z# |& n$ j
  63. 3 @6 G- y( D# y
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    * i5 p' `+ o: I3 A5 Q
  65.                         dbge.dwProcessId = pi.dwProcessId;# b  U0 B6 Z4 U5 N9 X7 D7 A6 g
  66.                         dbge.dwProcessId = pi.dwThreadId;
    . p* q  _% c, H+ f! R/ w! l1 Z
  67. - D: Z8 W, e  u# }) u
  68.                         while(true) //infinite loop ("Debugger")
    + P3 ^6 J; M7 ^9 b
  69.                         {
    6 M, z& b/ i$ I& p7 P" f4 _
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx7 d1 w8 B5 v9 |0 T2 T: `
  71. + c! Y6 z. N; A* P8 C3 z
  72.                                 /*  ?2 u6 s* f) b6 u* L0 C
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
7 [7 |6 w, b: {2 \8 C( v
/ z% j5 I% c/ ]! f8 b

  B2 T6 \$ N% a; n& j
商业服务端 登录器 网站 出售

15

主题

256

回帖

1244

积分

金牌会员

积分
1244
金钱
855
贡献
113
注册时间
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

主题

256

回帖

1244

积分

金牌会员

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

3

主题

102

回帖

6141

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-26 18:56 , Processed in 0.065885 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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