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

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

[复制链接]

167

主题

431

回帖

8245

积分

管理员

积分
8245
金钱
2423
贡献
5224
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
# M$ o/ }" |% k4 h: \% k0 S3 |1 P2 F: P. @7 c; I' Y: H2 f4 M& h/ q* Y
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。; X" L. u  Z; d+ T+ Z  f4 m
, T4 K4 a& G7 j% @
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    8 @9 q  f+ g( ]) j2 J8 f3 u
  2. //
    3 m& n8 v- \8 N# _
  3. 4 O. ^6 k5 P3 d4 j. {
  4. #include "stdafx.h"+ Q8 F# I! [5 U3 e' Y& H& x
  5. #include <iostream>
    % P' e5 l% w7 {
  6. #include <Windows.h>; m3 a# y8 i" z( i% r
  7. #include <io.h>
      a, A! B. n3 x! X

  8. * c7 s* a3 ?. z" c

  9. - I, |* p( R! P  A7 Y
  10. int _tmain(int argc, _TCHAR* argv[])
    7 ^  n! j1 e* p" ?0 E- J
  11. {
    6 h3 j3 Y/ m9 u6 \9 l
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    3 a! L' m( I/ s
  13. 0 t2 _0 {2 B1 D5 J5 ^0 C1 S7 w- f
  14.         //查看文件“DekaronServer.exe”是否存在
    4 @; W- ], c7 N4 z4 r% y7 R
  15.         if(_access("DekaronServer.exe", 0) == -1)
    ! c& H3 S) ^3 A5 U+ K5 ~0 w; r# g
  16.         {
    7 y* Y' h$ R' J  V# ^
  17.                 printf("DekaronServer.exe not found!\n");
    2 F+ A2 Y7 J0 S! N( g& Q
  18.                 printf("Program will close in 5seconds\n");
    + C$ Y2 a, G) G+ l- w
  19.                 Sleep(5000);
    3 k  m& A4 t6 L* B6 _
  20.         }
    0 c0 U/ S. {# v6 P9 p
  21.         else! E" Q% X5 P1 B# s2 w7 B
  22.         {, E+ c' T& n7 |9 f# `
  23.                 6 g$ u* }& {+ J6 {
  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
    ( h" y) Q' o+ p$ o# D4 J
  25.                 STARTUPINFO si;
    ( \( I! D3 J, t7 ?
  26.   o) l$ }5 d6 [( P$ I! ], k$ m. i
  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' D# w/ h4 D* e! b/ Y5 {6 b* B# q' G
  28.                 PROCESS_INFORMATION pi;
    % A, _( n6 I6 p4 g

  29. 4 A( U" }8 E% y
  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
    / \* O0 t7 {) b$ f: f; C
  31.                 DEBUG_EVENT dbge;
    1 v$ b+ H- F' R- L" [( [- i  H

  32. ( r0 t- k+ [* y$ }
  33.                 //Commandline that will used at CreateProcess0 J2 {( ?: E3 H. {% q4 m! D: C
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));0 N1 L& M- I* W) L7 Z0 q

  35. % I5 E+ f+ M7 a% [2 W
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)6 M3 N" p' i+ W8 V3 i
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    5 G2 t- E% x2 F* A9 j: ~7 o
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)/ Q# V, u1 z, U! e3 t

  39. ) ?) M( H6 v% I- G6 ^

  40. 9 p/ H$ v  j- N2 r6 c0 f3 ~5 X7 U% s
  41. 5 I! H' U  p1 d7 l- I
  42.                 //Start DekaronServer.exe
    # F- F  L; m4 R" @) f  M& Y' r7 M' I; [. ^
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx% y1 r, u& x1 o  k( Q
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)& N2 z. B2 z8 ^# O9 X
  45.                         szCmdline,        // Command line
    9 U; L" \( q# I
  46.                         NULL,           // Process handle not inheritable
    . \3 L; Y6 T1 Q' v! {
  47.                         NULL,           // Thread handle not inheritable
    % D" J2 @0 ?- `' N, c
  48.                         FALSE,          // Set handle inheritance to FALSE* o3 J* X" j9 t! H
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    7 F, O0 o" N# w. h
  50.                         NULL,           // Use parent's environment block0 I0 u0 L) s9 y
  51.                         NULL,           // Use parent's starting directory
    * \3 P( c( y4 z! f' }
  52.                         &si,            // Pointer to STARTUPINFO structure
    5 H0 K8 t% ~3 j6 l+ P
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    . w$ n- k% _. B$ ^
  54.                 )
    $ f5 u7 r7 d* N2 T' `$ l
  55.                 {% U2 V5 i3 i% \) ?* R
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    , E& H: B$ z9 d& X9 w& A" ~( h
  57.                         return 0;  c3 [" w8 v" Q6 W8 y- x
  58.                 }( M/ e2 e( v# H4 E& E- o
  59.                 //Creating Process was sucessful
    / E( M: D: L" c: Q
  60.                 else; T1 ?3 b" R. Z  t* Q
  61.                 {
    ( H5 i! s* a7 c4 d+ m
  62.                         printf("Sucessfully launched DekaronServer.exe\n");5 v! S; B( ?) y; t. l9 j

  63. 5 g" w8 ?! Q3 U! g
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    9 l) |  t7 |) s6 J
  65.                         dbge.dwProcessId = pi.dwProcessId;# ~9 z2 I, ~" j+ x* d6 B& ~* v5 ~( J
  66.                         dbge.dwProcessId = pi.dwThreadId;, E+ Z% Z8 M! |0 h9 E. ~. f
  67. % ^! K; l2 J. z0 @2 _
  68.                         while(true) //infinite loop ("Debugger")+ |* @. b  j; s) |
  69.                         {
    ) B" z# G+ r% l% p" c  C
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx* T$ o5 I: \2 e0 Q

  71. 3 e) ?3 j; u. v
  72.                                 /*
    2 @% [3 A* X/ `: d+ ~7 b
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
! q2 B& I! M1 h' `4 ?
5 @3 m# z2 ]7 W+ x+ ]- U! M

$ g; e& ]9 f* ~) U. G
商业服务端 登录器 网站 出售

16

主题

268

回帖

1567

积分

金牌会员

积分
1567
金钱
1139
贡献
139
注册时间
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

主题

212

回帖

370

积分

中级会员

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

16

主题

268

回帖

1567

积分

金牌会员

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

3

主题

103

回帖

9419

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-11-3 22:44 , Processed in 0.074140 second(s), 30 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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