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

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

[复制链接]

157

主题

366

回帖

7070

积分

管理员

积分
7070
金钱
2012
贡献
4535
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) & ?' n) `4 p& i: t6 u9 J) r; X. H
" g; J- X+ a) E9 d
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。2 A7 x) E: r% y# H/ j

" t& h" c+ i% A# J
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。  I$ r; T/ G: g0 }, d# n
  2. //4 ]4 b* _1 y6 ^  p) W2 l$ y
  3.   u, y2 O4 S4 k1 J5 R; R
  4. #include "stdafx.h"
    8 `& B7 w3 D% {' j2 i( y& V7 I
  5. #include <iostream>
    8 `2 p1 ?& F( y! t) {8 i
  6. #include <Windows.h>
      V" @6 i% @* |6 w  d& C# {# s
  7. #include <io.h>
    ! A5 Q( O: ^" k4 o0 j5 W) z

  8. # u7 O( s) Z+ `9 M4 S: R
  9. 1 Q$ H$ L" {7 [) F
  10. int _tmain(int argc, _TCHAR* argv[])
    . V% {$ p6 h8 h! f- _- m6 Z/ V
  11. {
    / k2 a$ O* W: T* {" H
  12.         printf("Dekaron-Server Launcher by Toasty\n");! U5 i1 e- k: r7 L  |
  13. ' U8 ]% r( G7 h( ?+ A1 h
  14.         //查看文件“DekaronServer.exe”是否存在* b6 N. z( I* e+ w1 `# x' M
  15.         if(_access("DekaronServer.exe", 0) == -1)  x) g8 _! a7 d6 ?
  16.         {" _9 F1 x# t6 ~2 {
  17.                 printf("DekaronServer.exe not found!\n");
    6 |+ T2 Y0 N& M3 e2 c. F5 \: }* R
  18.                 printf("Program will close in 5seconds\n");; N2 X! ]; j. w, E3 A/ I  n
  19.                 Sleep(5000);  L7 c3 X% O* l: m
  20.         }! s6 W& g8 b1 D5 K0 D3 i; Y
  21.         else- a9 \) m" b. n% H8 G+ |
  22.         {
      m% x$ u, j. K
  23.                
    , y4 R' v' S. @! C6 H: t7 c* C
  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
    : ^- N, j3 F& a' X
  25.                 STARTUPINFO si;8 I7 R% }. l' {# m  P3 n8 j

  26. 9 X. {/ ]6 c6 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).aspx
    7 z0 \4 E! y4 L) K3 n. t
  28.                 PROCESS_INFORMATION pi;9 b; J0 P! h2 P$ p4 r& H
  29. ) U. W' w& q+ g: \2 M0 J, H
  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' c/ |. H! B8 A8 O- g
  31.                 DEBUG_EVENT dbge;
    ! Z) ~+ ~" q, h
  32. ; v! z* g9 o+ s; e6 h- g3 P- Y" z
  33.                 //Commandline that will used at CreateProcess2 h- O% K8 w+ E, U0 R" @2 {
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));8 `3 Z' ?, `+ T( \1 T

  35. ! w; D  B  s7 X# L  S4 B
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)) ]' S* U& @+ l; ~2 U' i1 W# C+ z
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    4 _3 _, O4 }2 W( h$ [6 t
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    4 h' h( y' p. t, `) `2 o

  39. / }6 u* A3 V4 N2 h! m& p  Z$ d

  40. 4 ^. {1 `6 j, T+ {& G8 [
  41. ( P) K& x) ^9 `" W
  42.                 //Start DekaronServer.exe
    0 \$ _+ V2 y/ J* X3 \$ S- O
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    5 y5 }- s5 m6 G# v
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    - m/ Y: N" O; U* f' K. l: d% W
  45.                         szCmdline,        // Command line
    ( F# `% [3 U6 C: S$ [4 c
  46.                         NULL,           // Process handle not inheritable
    2 v1 b7 k7 y3 B# H5 h  F
  47.                         NULL,           // Thread handle not inheritable- A+ z# Z, O( R5 Q
  48.                         FALSE,          // Set handle inheritance to FALSE: f+ d4 q; u4 X. G
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    * g$ ?  f/ a3 ?
  50.                         NULL,           // Use parent's environment block
    . I( g. R" _; _( ]$ Q' U: ]
  51.                         NULL,           // Use parent's starting directory
    + J& u7 A# U  s& I) a
  52.                         &si,            // Pointer to STARTUPINFO structure9 l8 K4 {/ s0 t
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure$ Z9 r: x3 @' B4 v% c( T
  54.                 )
    4 U" `# A! ]: H: h1 R1 Y
  55.                 {
    * N" ^9 ]& ?  }2 G3 |
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );, t2 I; q/ d' o4 U1 R
  57.                         return 0;
    3 g: o. E, p+ u& J6 Z( j3 s
  58.                 }& o( [6 v5 W8 y4 }- a0 g0 r
  59.                 //Creating Process was sucessful
    ( m! m9 T/ \4 L0 Z! y- @
  60.                 else
      e% d8 Z3 W, B. `# Q2 d& _7 t( W
  61.                 {. v  ~+ A9 x2 l5 b& |4 R* K
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    . c5 T7 u0 K- f2 ^% q9 ?
  63. 0 I* M+ I5 [( e& E
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure2 l3 _6 c: j: z3 r- z! I8 m5 ^
  65.                         dbge.dwProcessId = pi.dwProcessId;; f5 [  q% \( e  C
  66.                         dbge.dwProcessId = pi.dwThreadId;( F; x: n* K2 N
  67. ' q- H, K. H7 E3 H! g
  68.                         while(true) //infinite loop ("Debugger")
    - g; E+ B% ]" l
  69.                         {0 r% G2 p5 b3 U8 `
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    . X: C- Z( D" d- [

  71. 2 v& k' Y8 f, t/ b! m
  72.                                 /*5 H2 A& G  ?5 w% j4 i" \/ X& ]
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

9 a4 }& n2 Y' ^# T* L) j) q6 _9 @% h* H
8 t" i/ K  Y) Y' _
商业服务端 登录器 网站 出售

15

主题

257

回帖

1231

积分

金牌会员

积分
1231
金钱
894
贡献
60
注册时间
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

主题

257

回帖

1231

积分

金牌会员

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

3

主题

102

回帖

7177

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-3-25 15:17 , Processed in 0.033972 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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