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

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

[复制链接]

147

主题

281

回帖

5144

积分

管理员

积分
5144
金钱
1639
贡献
3077
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
* \" ^8 M0 g" q) J5 j" _
; S" q( j2 D9 c& S  k" f虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
) `# _+ J; `7 ^. V) s. ?2 I( g
+ Q' S7 b8 Q0 M5 L
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。0 E. Z4 t0 K) w/ N
  2. //7 |* T# V% S% q" B

  3. $ l4 i% v9 l4 _% u
  4. #include "stdafx.h"
    7 S9 `+ s: Q8 ~9 j: j4 m
  5. #include <iostream>
    / z/ ^7 r/ l6 i+ t
  6. #include <Windows.h>
    7 T; c2 z7 o' f
  7. #include <io.h>
      j7 ?6 j2 @: e3 Z
  8. ; R* _  H/ [6 z$ ]
  9. : B' }7 M6 d  M3 k1 T) Y
  10. int _tmain(int argc, _TCHAR* argv[])
    ( r7 `* Y8 @: w/ x6 N
  11. {1 u4 |5 M; @) V! D, g) O( A2 R
  12.         printf("Dekaron-Server Launcher by Toasty\n");2 ]" b6 |6 T6 Q7 Q) c
  13. * I% E& V7 s% v' Z- j  z) p4 i
  14.         //查看文件“DekaronServer.exe”是否存在+ c9 u. _  @  |2 t2 C$ f
  15.         if(_access("DekaronServer.exe", 0) == -1)
    ! h8 \7 D) }: `5 A: a, r- O3 `
  16.         {
    ) d4 N* {* {  q$ m/ [: S. T( L" ?
  17.                 printf("DekaronServer.exe not found!\n");% r" b* `' Y0 f- T3 L
  18.                 printf("Program will close in 5seconds\n");
    - N' l' B+ M4 R0 f. _! S
  19.                 Sleep(5000);
    , E% y5 ^8 }% M
  20.         }
    ' w7 i4 d, i" u/ D5 G
  21.         else
    ; u, c6 `9 f6 M% N  w
  22.         {+ ?9 Y. p  j1 ^* e# v
  23.                 " u; V# I  e# Z" B: i
  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
    - ^! a1 n, B9 ?1 Y3 O
  25.                 STARTUPINFO si;
    4 E  P" A! R! s, E

  26. # |& Z- F% R3 p  X( L0 [' h
  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. G) ]( K6 [# t- D3 b9 {" n! ~: ^$ M
  28.                 PROCESS_INFORMATION pi;
    & D: Y8 I0 B/ \* b
  29. ) {- K" U$ j! O6 ^0 V9 V+ E+ R
  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& U$ y) v. U  i1 S& R
  31.                 DEBUG_EVENT dbge;
    3 b9 `- n3 a: a7 e; [9 t% T

  32. ( o( U1 N2 g  G! {' W
  33.                 //Commandline that will used at CreateProcess7 z% H  _" |. R' h1 V
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    " O6 w1 A" `+ U
  35. ! |& t7 d) L$ x  ]( C7 N# [
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)% f! E5 e$ ]% W4 r2 g  }# U
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    ( `- y7 R4 g$ _0 `, ?  x5 o
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)) g* V! }( @# w# ^$ X- T! O, O

  39. ) p8 D/ Z5 ]- T0 W
  40. - K, }4 I' r, S2 |2 F3 ^
  41. 5 H- ?6 N, M2 e
  42.                 //Start DekaronServer.exe
    $ }6 o0 M; k$ \& N. l, Z
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx, d% b1 G( {# {' {
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)' x3 X! w$ {8 E% B3 Q, @' _! p
  45.                         szCmdline,        // Command line
    5 A1 {3 p* _' k8 V
  46.                         NULL,           // Process handle not inheritable0 v- b: W6 c9 N. f3 J. G
  47.                         NULL,           // Thread handle not inheritable9 r: D1 c& h% o  H, S
  48.                         FALSE,          // Set handle inheritance to FALSE
    & Z4 i2 Q% O0 {$ P* u
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    " l7 j& Q; j% r9 L: ?4 z5 H: g
  50.                         NULL,           // Use parent's environment block8 z  P8 s! k: T# c
  51.                         NULL,           // Use parent's starting directory 5 p/ {2 u9 z$ a$ `
  52.                         &si,            // Pointer to STARTUPINFO structure
    & B3 E0 @- }, H' R* D: {# e
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    " j/ j7 S3 {; _: Z& A6 T
  54.                 ) 4 E4 c0 p5 a6 V2 x* R
  55.                 {
    5 ?, o8 `! W" U! \
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    $ ~% w* u! M1 h1 K( D; c0 M3 _
  57.                         return 0;
    % Q- h9 R( d! }$ l9 d
  58.                 }
    2 B& W1 W) Q7 Z5 \5 g: s" ?" X- G* O
  59.                 //Creating Process was sucessful1 Q# N. o6 z( Q  H1 G
  60.                 else5 }% h, i1 I' a
  61.                 {
    * X# K( C7 S- X1 w2 H6 f  l8 h. Y/ ^5 H
  62.                         printf("Sucessfully launched DekaronServer.exe\n");; y+ S9 @( v) h/ V8 g0 S

  63. . A1 ^9 L' ]! Y' E! z
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure# P0 Q) u4 u1 p. A+ P$ Z1 c& a
  65.                         dbge.dwProcessId = pi.dwProcessId;
    ) b6 `- Y4 X7 i) J, c6 k5 P4 N
  66.                         dbge.dwProcessId = pi.dwThreadId;- m* ^8 I: R: I7 W
  67. ' n$ H. K* h7 L4 C: L8 b( e7 T
  68.                         while(true) //infinite loop ("Debugger")
    + M# \$ C& r- n# L
  69.                         {
    * |/ `* d& w; s2 N, O5 Z
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx; A& A* |+ x0 ?# ~/ A  X  S) ^# h
  71. ! z7 O, o- z% F( \5 v# o5 O
  72.                                 /*
    " x8 M8 n4 P" E4 b) d
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

/ O5 S7 B' G# C! c2 y" u  }2 _! Z% w- Y

% N2 j. ~$ P9 z
商业服务端 登录器 网站 出售

11

主题

244

回帖

1113

积分

高级会员

积分
1113
金钱
705
贡献
148
注册时间
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

主题

204

回帖

340

积分

中级会员

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

11

主题

244

回帖

1113

积分

高级会员

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

3

主题

97

回帖

3799

积分

金牌会员

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

本版积分规则


Archiver|手机版|小黑屋|EGameol

GMT+8, 2025-9-14 10:43 , Processed in 0.056618 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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