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

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

[复制链接]

156

主题

354

回帖

6492

积分

管理员

积分
6492
金钱
1906
贡献
4076
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 5 ?( Z; W3 o9 d& M: f. B

. H/ r% b; t" f! {& k) l0 H虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。$ ?7 \1 k9 I) [
$ n3 A: x# [. ], r' X2 l0 Y8 q
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    8 [1 D' m1 O% Z3 M
  2. /// c/ g' ~( M" ~% H
  3. " W1 c) m  o' U
  4. #include "stdafx.h"
    * c* o; F0 W  F# H2 W' v
  5. #include <iostream>$ j, P6 Z1 U+ Z9 U- G
  6. #include <Windows.h>
    # v- x! N. V: _. k4 k% w: l2 y( D
  7. #include <io.h>
    ' q1 c8 `+ N% r  _
  8. . o4 Z9 s  P: Q4 s

  9. / r5 s$ |$ t# c0 [! O
  10. int _tmain(int argc, _TCHAR* argv[])2 ?, q$ P" @+ W/ w$ w" v
  11. {
    + ]4 t+ k( g' V; g5 O! R& J
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    1 B6 N0 x) N6 w3 f; G

  13. + j7 R) L  e+ o
  14.         //查看文件“DekaronServer.exe”是否存在
    . n4 x0 R  K  K- {& H
  15.         if(_access("DekaronServer.exe", 0) == -1)
    9 X/ \8 Z) l* l* R
  16.         {
    1 V* y; u8 d* V. z# {
  17.                 printf("DekaronServer.exe not found!\n");$ k6 C+ s" {* f4 z
  18.                 printf("Program will close in 5seconds\n");8 [: T( `9 a; E( e) y7 u% J8 [
  19.                 Sleep(5000);* c& e# N4 p+ j- Z, M
  20.         }" C5 c9 o0 H* K8 d3 ?
  21.         else6 [5 u6 c' z; R9 u) f5 y  W0 e
  22.         {' Y4 ~+ {/ ]3 q8 S4 g$ x- @4 R
  23.                
    + Q8 F; F# G7 `$ H# w" T
  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
    : S; C4 r7 u4 V
  25.                 STARTUPINFO si;0 R' K4 R1 `* D

  26. 3 k! e2 N0 l5 h! d8 d0 @
  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# i- L; y! u* B6 r3 p* r# N; N
  28.                 PROCESS_INFORMATION pi;
    * z  a, A1 r* P, s* C) \( |7 m

  29. ! s6 S! J. O5 t$ j' c3 [
  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
    0 @+ ~2 K7 [- o2 d& C
  31.                 DEBUG_EVENT dbge;
    0 L* {! h) S! h- |% M+ d9 @! {# _
  32. ! v' x1 k- \& ^, D' R6 u, m% C
  33.                 //Commandline that will used at CreateProcess
    3 t8 U  l( l- z
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));& J( K  i( W- o  |  j

  35.   @* U) ]7 ^' B& A2 D2 t
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)# d0 R9 o, u! H, b$ T) U
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    9 h) \& q: H* s; [) B0 y
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)& d+ Z7 B9 k" L& C7 I& w
  39. % m5 |- H1 w4 R+ r: e' S

  40. : z. P/ A$ K1 e$ J
  41. . `6 A/ y( m  y  u8 y* ]
  42.                 //Start DekaronServer.exe
    / o  H% e9 S, s; b( R4 o
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx) A6 [" h! g: `# G. r4 ]# O
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    ! T9 F0 ~8 G( L! ?9 Z
  45.                         szCmdline,        // Command line
    2 `5 J  ?) i4 g1 [, j' z7 D
  46.                         NULL,           // Process handle not inheritable
    ; E/ A# z& E9 N; N6 |8 d( Y  d. G- C
  47.                         NULL,           // Thread handle not inheritable
    4 U0 q4 k/ _& b3 [" G
  48.                         FALSE,          // Set handle inheritance to FALSE
    2 ~% F! d% ], Y+ V+ y
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
      _3 y$ ^/ U6 u
  50.                         NULL,           // Use parent's environment block
    ; c3 @. o) w2 u
  51.                         NULL,           // Use parent's starting directory
    & g4 \) F% ~$ {
  52.                         &si,            // Pointer to STARTUPINFO structure2 H. K8 t$ b& J: [7 |) o
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    8 ^- L: D( e0 L; j' C( Y
  54.                 ) ' a! f# e7 j# k, A- U% N" K6 i) `
  55.                 {' V, I+ ^& S+ K0 m
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    . |/ N9 l/ u4 K) ?/ \
  57.                         return 0;
    , y  x; }, j* \/ d( z
  58.                 }  p- t# o: e+ V% v4 u
  59.                 //Creating Process was sucessful0 Z0 r% H, P5 F
  60.                 else
    " H) i' D4 ~- J2 ^* K! y
  61.                 {1 }, P& s7 ?2 Z- ~
  62.                         printf("Sucessfully launched DekaronServer.exe\n");' t/ t! Z4 }4 `8 L5 V

  63. & |8 _' s% Y7 I3 F0 {
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure. n& o1 B) n* [. C+ J
  65.                         dbge.dwProcessId = pi.dwProcessId;7 i0 L1 W+ K$ U; Z5 d: k
  66.                         dbge.dwProcessId = pi.dwThreadId;* Y, R( U' M7 y
  67. , I- Q, m$ x  R1 ?) v' u* J  U
  68.                         while(true) //infinite loop ("Debugger")) U3 g* e: e, K  X1 G* ?1 z& U% b
  69.                         {0 w4 E6 E$ @- X6 s$ j0 l4 S4 @. x
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    9 V4 m" }! `, ]3 e- {
  71. 1 y4 b- L( T9 N8 l: K
  72.                                 /*
    $ R9 |/ N1 |; U' s; U
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
; @% A' ~' t) c: ?$ Y7 ]0 `. f1 C

8 C5 F: i  C  F$ T3 u: S( O6 ^2 }8 F3 L5 s* g' Z0 H
商业服务端 登录器 网站 出售

15

主题

256

回帖

1237

积分

金牌会员

积分
1237
金钱
853
贡献
108
注册时间
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

回帖

1237

积分

金牌会员

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

3

主题

102

回帖

6081

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-23 14:15 , Processed in 0.074973 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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