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

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

[复制链接]

154

主题

340

回帖

5815

积分

管理员

积分
5815
金钱
1828
贡献
3493
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
! D2 p/ ~- G- `- B9 c  F; P8 v$ p
" X& p$ h% r' g  f2 K虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
1 X6 Y" ^, R; e. o7 ^6 |! F. W$ e9 O2 }. c8 U+ @6 e* m
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
      T; M. Q1 h! G1 e  M1 W( B9 r
  2. //, e6 @; R  l2 m7 s# T3 e$ Z
  3. 2 ?7 V7 j/ a. G, s! ^
  4. #include "stdafx.h"  N! t! v! Q; h% e2 R
  5. #include <iostream>
    6 z# [. a- [( {$ D
  6. #include <Windows.h>
    4 N( A9 |8 a6 E4 Z: C
  7. #include <io.h>
    ' z3 l. U. K: ?3 A0 W1 d% L" C

  8. 3 t! s, W% }% N. N

  9. * m3 Y- Z7 c- l. s! R5 M
  10. int _tmain(int argc, _TCHAR* argv[])
    ( b4 a  _# H( W
  11. {$ l6 P9 I0 J# N) I3 L4 e
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    6 K/ V0 {) K, Q# ~
  13. 3 C' S$ g1 g) L$ n; s4 A) p
  14.         //查看文件“DekaronServer.exe”是否存在
    - ^7 K  `0 g& q% [# a: h3 ~
  15.         if(_access("DekaronServer.exe", 0) == -1)
    1 T8 l' Z2 p" W1 @( ~# k
  16.         {
      x' e) v, z: E8 H, e5 o. k" V
  17.                 printf("DekaronServer.exe not found!\n");
    7 Q* u) J3 ]4 I
  18.                 printf("Program will close in 5seconds\n");
    8 X; }9 e- v3 D1 L/ O, w
  19.                 Sleep(5000);
    # V; E7 p$ y! J5 i: m
  20.         }4 c+ b! l/ u+ P$ B5 Z" u
  21.         else
    + K1 G4 b- R* O( g
  22.         {1 s& \0 h5 r2 Z  t. ^
  23.                
    5 U4 |9 {! G0 R- r
  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
    / M) W; `8 b& G4 T9 c; }2 D
  25.                 STARTUPINFO si;
    6 ?" z3 c1 v7 w" Q9 K  W5 J7 \* x5 |
  26. * f8 i0 f# O7 z
  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
    * l4 k+ c# i. Y) x0 J
  28.                 PROCESS_INFORMATION pi;
    . b2 s( K7 l+ j
  29. , Y* h  w. N3 Y. T( `: w
  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( V- V. V( i/ b/ N- [
  31.                 DEBUG_EVENT dbge;
    0 Y0 D: O. i8 U( [( ]% A9 G; D# K

  32. # D( {! H( t! T7 Y4 Y
  33.                 //Commandline that will used at CreateProcess6 F- j: `2 {! \! Q" d
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    3 ]# L9 l. y2 v+ ?

  35. % D2 L/ ~* g- b/ O: ^
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    5 {* a4 x7 Q$ _
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)- b# s6 u* H# N$ e( t4 U! s
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made): K) b9 r; i2 j# I5 ]# @1 L" Z( z

  39. 4 E# a8 l  p4 ~7 B9 ~; u8 L

  40. $ K8 D0 `3 ^5 M0 n8 T. j5 M
  41. " @$ [6 t! l+ }+ _) I: ~* }6 ?% Q3 T# k
  42.                 //Start DekaronServer.exe 9 x7 t) I8 o* L7 D
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx. W) a" \" y7 G7 I. Z3 }' ]7 e
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    # \+ x* W8 t6 D$ z
  45.                         szCmdline,        // Command line
    7 B& f9 C4 l$ N. V8 _
  46.                         NULL,           // Process handle not inheritable7 G* z: i9 D  ]6 S: U
  47.                         NULL,           // Thread handle not inheritable
    : R' E7 _! e: z/ s! b8 f( c" n
  48.                         FALSE,          // Set handle inheritance to FALSE
    % u" g! T( n* O# _
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    8 e$ q7 q% z$ ]" b
  50.                         NULL,           // Use parent's environment block
    + j+ B4 j. U8 Z
  51.                         NULL,           // Use parent's starting directory 6 f2 ]1 f4 p! n4 ^
  52.                         &si,            // Pointer to STARTUPINFO structure' [7 ~& Q7 p. B2 u
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    + q/ o: p: |3 `" V. e; @# u! R! H
  54.                 )
    ! F: V2 u1 f2 \5 D
  55.                 {
    * q( X0 _4 x' g- X1 m
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );+ z; M: ~1 u, h2 q
  57.                         return 0;9 `" w$ l5 R7 [! z+ s/ u
  58.                 }: D# B. g$ r- S1 g- W# J! y; c; ?
  59.                 //Creating Process was sucessful+ b9 e/ w* L0 A
  60.                 else; f/ N. F  u, I7 L
  61.                 {
    ) `; U+ w# W7 H) o  `, N
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    ; i8 M. G7 w: K# U$ x) ~7 B
  63. , b& T  K: r" U8 G: K) _# l7 V. c
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    ! h; e% I6 O6 o6 c" v+ O
  65.                         dbge.dwProcessId = pi.dwProcessId;
    $ N; I2 F3 |- o' B  G
  66.                         dbge.dwProcessId = pi.dwThreadId;2 @! G/ J) @+ }$ A% ?  g  z# @! U  S

  67. 3 X, j5 q2 B. Z/ @
  68.                         while(true) //infinite loop ("Debugger")& l: B/ ]5 Q5 |6 d% G
  69.                         {
    # P/ @6 |% c5 y: W4 A# _
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    ' u, P8 ~: Z' }1 i/ ~- |
  71. . C: N8 i# u# w5 h3 z1 H, q
  72.                                 /*
    7 g0 k/ _' i' X) }: S
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
. U& [0 w- f; v
0 ^3 Q$ h* Z) i' s6 p

* a, x5 O2 x  ~- y, u3 |
商业服务端 登录器 网站 出售

13

主题

251

回帖

1249

积分

金牌会员

积分
1249
金钱
796
贡献
184
注册时间
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

回帖

1249

积分

金牌会员

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

3

主题

99

回帖

5313

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-7 15:31 , Processed in 0.070240 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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