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

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

[复制链接]

155

主题

348

回帖

5989

积分

管理员

积分
5989
金钱
1864
贡献
3622
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
; j3 ]; ?4 n1 y% Q- N
$ b5 p5 F+ F. m+ h- h/ |! v3 w虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。& b8 [8 f" J) t! u9 X& H
6 e1 \3 `- O# M
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    $ K- O( p. Y4 K* R
  2. //0 p  f' A1 I% w9 W& s
  3. 6 {% `7 F* ?# m7 {" U
  4. #include "stdafx.h"$ ]* n+ Y& W, E
  5. #include <iostream>6 J/ l! _" H  K# a7 Y
  6. #include <Windows.h>, A: S8 A) P/ M. [6 k
  7. #include <io.h>/ A! G# V! ^& W# b" l# }0 ^  p
  8. 9 G+ @  Y1 p( Z. M) o! R

  9. : S  ?8 S4 m8 e3 b; C! Y. G+ Z! h
  10. int _tmain(int argc, _TCHAR* argv[]); E0 f) v: V& T8 Z
  11. {& L* _5 ^; W( B$ |3 y' t4 o, c
  12.         printf("Dekaron-Server Launcher by Toasty\n");9 K! N4 ?- N. y9 Y) I2 r# R1 h
  13. 2 }; W; }- D+ N- n! e
  14.         //查看文件“DekaronServer.exe”是否存在
    4 h" s9 f( [5 e' l  ~2 }
  15.         if(_access("DekaronServer.exe", 0) == -1)
      o0 {, E3 ~2 M0 w9 a
  16.         {
      q( w" b0 B1 Y/ V. j# L$ Q
  17.                 printf("DekaronServer.exe not found!\n");# q: M: U6 M" \, r7 L% U
  18.                 printf("Program will close in 5seconds\n");7 V( {: G7 N/ `  }$ \
  19.                 Sleep(5000);
    # b* N4 ?& R( A' p& f
  20.         }
    $ a& f9 g6 l4 g- W/ f7 i; E* c
  21.         else7 ^  F. A1 }2 q7 B0 U7 a
  22.         {7 N& n( p5 ]4 o, W
  23.                
    + @& [- |5 G- b- _2 U! K
  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; d# ?& J0 H7 j( B) S4 M) g
  25.                 STARTUPINFO si;! M( b; c* M: d. j7 m# Q
  26. ! U/ n- Q! [* v: }$ U4 {
  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).aspx3 q: @& z+ k, a3 p1 Q. h$ V
  28.                 PROCESS_INFORMATION pi;
    5 m" x7 d4 i, J7 ]0 o  T) I8 q" ~
  29. ( w& V. o! m) y: n
  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).aspx8 O8 Q5 H5 l2 |( l! Y7 ]4 ?
  31.                 DEBUG_EVENT dbge;
    . y' |- Y" c, G3 ]

  32. 7 }0 U+ T; Z& @' {! H9 I* r
  33.                 //Commandline that will used at CreateProcess; k& @: |5 C! R0 [; W
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    % ?. a1 M6 @  {3 ]* b+ D

  35. ! t9 |! g% N. J' L1 E% u2 W1 D# Q" x" U$ D
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    ; \: |$ q+ B3 L# X
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    - _& c3 S' d: D+ n3 J) i
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    6 Q+ y! T/ _( p) ^* Q3 A

  39. 1 U  M& D( Z$ b' |& `. C$ f  V2 D7 l
  40. 4 @4 l- ?2 D& v
  41. ( I. V/ i  ~! @
  42.                 //Start DekaronServer.exe : h4 A' T' u% h% m
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx, H2 G. y! T; ^: a! i0 Y6 n8 L
  44.                 if( !CreateProcess( NULL,   // No module name (use command line), F' \9 o( }3 \. M  z: r! L5 V+ M
  45.                         szCmdline,        // Command line7 u, T% f( t4 t* I' s0 B4 ^, Z
  46.                         NULL,           // Process handle not inheritable* r  f# s3 A5 L+ U1 F
  47.                         NULL,           // Thread handle not inheritable
    6 N) e# P6 b' b  d
  48.                         FALSE,          // Set handle inheritance to FALSE
    ) B2 [1 I+ j7 @  K  ?: ^8 _1 z9 @
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    $ M+ P& H% c# ^7 R1 U6 ^
  50.                         NULL,           // Use parent's environment block
    / a; f$ H/ A2 T& f
  51.                         NULL,           // Use parent's starting directory 6 m: D2 E7 G+ A# I* Y2 c
  52.                         &si,            // Pointer to STARTUPINFO structure
    7 W! O' i' q0 I4 f( ?8 _# y
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    - K4 ~* A  C, `) w* g
  54.                 )
    3 m$ f% {* |* H3 Z) k
  55.                 {
    # [* @. S+ \# l; h
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );2 X3 O( d7 Y  c# Y2 p
  57.                         return 0;& q4 E  e/ U4 y9 V7 E# f$ E
  58.                 }$ G, F# t6 s6 [/ }; C
  59.                 //Creating Process was sucessful7 [! {9 @$ x: }4 Z
  60.                 else3 }0 x* v  x4 V: Q: y
  61.                 {/ t7 D& t+ Y6 }  S! E- i
  62.                         printf("Sucessfully launched DekaronServer.exe\n");7 T3 ?3 Z$ w/ [6 I/ E
  63. 5 I6 Y. |8 n7 o7 F
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure: l+ s: g1 d! |/ h1 [0 b& S1 {
  65.                         dbge.dwProcessId = pi.dwProcessId;, N6 k( p( n; i: d# e& h' H4 Q
  66.                         dbge.dwProcessId = pi.dwThreadId;
    : g7 D' j- B( o$ u6 p- R9 H

  67. 3 }* g& F- p1 r  ?6 _8 W
  68.                         while(true) //infinite loop ("Debugger")
    * Y8 Z6 A3 B2 e0 \: ~
  69.                         {
    9 N( C& I$ \5 q3 k+ S
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    ; I/ T5 `  Q) e3 w3 j' j3 N+ U
  71. ; L% A  W! v! s; v( y. `! X
  72.                                 /*
    * p  T6 y7 ^$ F1 _6 y) m( r
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

: F+ m& M* L5 g1 Z
- J6 v! Z' @, t( {6 j% g# `7 w6 c8 Q+ `5 _0 n+ E
商业服务端 登录器 网站 出售

13

主题

251

回帖

1242

积分

金牌会员

积分
1242
金钱
814
贡献
159
注册时间
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

主题

205

回帖

345

积分

中级会员

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

13

主题

251

回帖

1242

积分

金牌会员

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

3

主题

100

回帖

5713

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-31 03:22 , Processed in 0.072716 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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