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

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

[复制链接]

160

主题

385

回帖

7424

积分

管理员

积分
7424
金钱
2131
贡献
4748
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 4 G  f% W2 g* M+ M
  X6 A9 P" m) z+ a; g7 ]' l
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
$ n7 n' a9 Q3 [! g. ^7 b
! e& v; {/ Y6 g0 Z
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    3 T9 B, \' ], B7 m/ r$ R9 ?
  2. //
    2 K' A' t# Y9 ~+ z  i3 C/ I

  3. 5 p, ^4 G2 s" T7 o( H6 z3 j/ n
  4. #include "stdafx.h"
    * k8 H) _# N3 o$ ?% p+ D
  5. #include <iostream>  d4 A+ b9 [$ E
  6. #include <Windows.h>$ ~; {7 G3 A/ B! o+ B
  7. #include <io.h>9 I4 L0 D" l# A1 A" F& Q
  8. & H# b8 p; E8 m9 a
  9. / v' V0 f% O- X6 |
  10. int _tmain(int argc, _TCHAR* argv[])
    . p5 V1 ]% W7 {1 `0 W1 Y8 w9 w- I; x
  11. {! q* C0 M. ?' j$ W5 ^
  12.         printf("Dekaron-Server Launcher by Toasty\n");( {. b8 K2 U* p6 i/ Z

  13. ! g, A' L, `6 {' ?
  14.         //查看文件“DekaronServer.exe”是否存在3 j5 C/ F4 r2 [- ]' o6 v2 z6 `) a
  15.         if(_access("DekaronServer.exe", 0) == -1)
    0 u! Y% J* v8 z' C. x
  16.         {
    ; X) p  s; q) O8 x2 s$ |8 U
  17.                 printf("DekaronServer.exe not found!\n");( L- u9 `6 o+ u
  18.                 printf("Program will close in 5seconds\n");( f4 U; y% c- g0 m& O
  19.                 Sleep(5000);
    ) h* ]9 f& Y& H( w0 a
  20.         }
    ( F" I: R3 e8 Q- D1 }# P/ X
  21.         else
    ) p& ~* ~" J. V# p4 G. ~) r
  22.         {
    + B6 c+ t6 J+ [8 L! Y/ t" g
  23.                
    8 O7 K- o( |) g' q
  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
    ( Q6 E, M. @4 k! |% t6 ?9 ~
  25.                 STARTUPINFO si;
    & b7 E2 Q$ r" Q8 z5 R. N' t
  26. ' {, p+ f& Q8 I* C% f! [
  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).aspx0 V/ c% L. d5 b) k
  28.                 PROCESS_INFORMATION pi;0 z3 d2 R- M' E& |' D
  29. 7 A8 w. y8 R% q1 L
  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
    ; g8 W0 n% k  O; t. J
  31.                 DEBUG_EVENT dbge;$ F/ E# O) ^( J0 C
  32. : u- g) \9 j0 r! x# P+ j: I( M
  33.                 //Commandline that will used at CreateProcess) `( y$ P* u) Y% S8 b" `
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));4 Y; p) \; y3 @8 O7 N
  35. 0 X+ A* v9 E# w9 U5 F' I' l
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)0 R' _- A( Z- X
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    - o  ^* x3 J2 k' @+ j0 z3 o) l
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    2 z* N  I" v7 H$ D) S) v$ S

  39. * M8 a0 k( D/ I+ W
  40. * H+ `; }) ]# B, q
  41. ; I( Z* h$ k, v5 p1 v' E3 l
  42.                 //Start DekaronServer.exe
    ' K& ^2 i' u0 }( W+ {
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    % o9 J) ^- ^! y- t+ e/ o6 D
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)$ q" \0 @6 v$ n
  45.                         szCmdline,        // Command line# ^$ l5 \* Q" c9 J% X. S
  46.                         NULL,           // Process handle not inheritable
    & Z# N: {1 }& l) u: ^2 x. |) k
  47.                         NULL,           // Thread handle not inheritable
    & J! C3 Q4 h* D  ?
  48.                         FALSE,          // Set handle inheritance to FALSE6 w6 b: l6 ], X5 U! U% e' r
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx! v1 w0 p# W) L; N
  50.                         NULL,           // Use parent's environment block+ P2 Y" s- `5 I: p
  51.                         NULL,           // Use parent's starting directory
    : J8 V- X6 l: z5 y. N% C
  52.                         &si,            // Pointer to STARTUPINFO structure8 _3 j' d3 ~7 n; O
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure3 _3 T5 U, I$ f# r* p2 N* s
  54.                 )
    * z. }$ k+ ]' |' e& W( H
  55.                 {: a( @" @8 ^& P5 F5 L: x
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );! o) _1 g" t$ f9 W% D9 T
  57.                         return 0;- F; b4 _; w' g) C
  58.                 }
    1 g4 \) i$ m7 `: E/ g
  59.                 //Creating Process was sucessful
    & Z( M. w) N* H1 ?8 V
  60.                 else, P8 ?% x+ y+ w8 v5 f6 V
  61.                 {
    ! T+ H# Z9 }& b  ?: `
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    2 A; _1 z/ ^* u; M" x8 O

  63. 6 ?" E- K# {8 l3 {, D3 \
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure. A/ ]/ E" ~% V* {
  65.                         dbge.dwProcessId = pi.dwProcessId;
    & N5 ~, G1 H6 ]$ \6 e7 o
  66.                         dbge.dwProcessId = pi.dwThreadId;2 y, R& l: R; e$ k

  67. 8 R) d% v1 I7 J- D) p7 h
  68.                         while(true) //infinite loop ("Debugger")- j# L4 Y# V" a5 C
  69.                         {, l/ y0 s3 e4 I5 H, J+ R
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    ; T+ [! m/ w. u4 I
  71. / C/ b: v# S  a! T* G
  72.                                 /*; g7 ~* S) J# G6 p. Z3 [) E
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
, E. W: k: X5 ^0 @
3 Q2 F6 l) E9 E

  c. Q" g6 Y2 P6 U3 u. w- o* @" }
商业服务端 登录器 网站 出售

15

主题

260

回帖

1292

积分

金牌会员

积分
1292
金钱
931
贡献
81
注册时间
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

回帖

355

积分

中级会员

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

15

主题

260

回帖

1292

积分

金牌会员

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

3

主题

102

回帖

7917

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-5-2 02:33 , Processed in 0.037276 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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