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

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

[复制链接]

157

主题

364

回帖

6933

积分

管理员

积分
6933
金钱
1968
贡献
4444
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
2 b$ G  ]9 L1 v9 _" b" V, N8 \3 R% H/ {$ A+ V
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。! z7 j7 F  w9 L
! d4 ]* s, k9 ~1 E! Q
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    ; k" C) M5 R4 Z* V0 [7 j2 i6 A
  2. //( r" X0 o) j7 a" J" s7 Q  ^
  3. ' t# `8 T$ m0 p/ C  N7 ~" W  _
  4. #include "stdafx.h"+ i0 A% N* l7 U1 ^3 _
  5. #include <iostream>
    % B7 ]/ ?& Z1 u- D( ^  q# D3 K
  6. #include <Windows.h>$ \! ]) Y3 `3 A/ O
  7. #include <io.h># P# S! \8 F9 N7 D. q" _" i- _

  8. / u* A. {% U& ^- X

  9. . b% D+ V: i2 P9 I# s
  10. int _tmain(int argc, _TCHAR* argv[])3 n6 D3 d) r0 }; C- m
  11. {. \; d: X- ^3 s6 J
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    8 q% a- w3 Y+ N

  13. 8 R- v, _$ c% `$ F, M
  14.         //查看文件“DekaronServer.exe”是否存在1 C; ]3 j0 C! l9 b
  15.         if(_access("DekaronServer.exe", 0) == -1)
    2 Y4 {3 V5 Z4 w' g
  16.         {
    ! N7 ?1 I4 [* i$ g% d
  17.                 printf("DekaronServer.exe not found!\n");
    8 R6 |: h& O& X$ L, d" W
  18.                 printf("Program will close in 5seconds\n");5 N( z8 u, T/ F5 `8 v
  19.                 Sleep(5000);6 N# W+ |2 u: S+ r- d& P, N: H
  20.         }
    ; p: C% j* y8 {/ B6 n. N
  21.         else
    6 \- h% h3 i; ]; |
  22.         {! a4 |; m4 z- ~9 u) l! S# O
  23.                
    ; X( e( D. I0 q% H
  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/ c% ]0 t& c# S  _5 e! _3 g/ Y
  25.                 STARTUPINFO si;" X6 i% a0 r0 A- W

  26. ; |5 b6 Q4 O6 ~5 U
  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. }: Q8 x2 E4 Z0 r; C" W
  28.                 PROCESS_INFORMATION pi;4 V2 k( d8 ]* @! Z, w& X9 ^

  29. 5 }, w" Z( ?* P+ P+ e
  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
    ' w4 N  z) p; L5 j# k
  31.                 DEBUG_EVENT dbge;/ c/ R- I" c) R# [4 G- s. M
  32. 6 |6 Z/ N; y+ Z  F- V4 _8 V
  33.                 //Commandline that will used at CreateProcess
    . T5 p; A! i; Q9 j( b( e6 _& B0 O# o
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));" b2 O$ q+ f8 V' K: _
  35. 4 q& G, o" N0 s
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    6 r4 A/ M2 c* L- s
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)$ o& m1 D* O* R+ L
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    ( M0 M8 E% f/ K! J8 p
  39. $ g$ X8 P9 y$ y: V& f
  40. ! z7 m8 P# C6 E+ W

  41. % i- l" J4 E: {. m
  42.                 //Start DekaronServer.exe
    # r, t7 m5 K3 f) E# E7 X0 e* Q
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx- i; N* [9 h4 M0 `
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)" w- P8 i& Z7 d6 T5 e7 c; `7 T
  45.                         szCmdline,        // Command line; Q3 c- G7 S! j) g( e2 `1 @4 Z3 Y; l8 W
  46.                         NULL,           // Process handle not inheritable
    ) q' N6 ~) L3 s: p
  47.                         NULL,           // Thread handle not inheritable; B, h& H1 J) R$ r) M) z
  48.                         FALSE,          // Set handle inheritance to FALSE
    / k7 i1 c8 o8 c+ I
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    & K: w/ J- V* c2 k
  50.                         NULL,           // Use parent's environment block# J0 W. b1 \1 t' q
  51.                         NULL,           // Use parent's starting directory 2 S) O' ]3 n9 \) ?4 m
  52.                         &si,            // Pointer to STARTUPINFO structure  a9 z: L6 E% f6 c  M! }
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure: f7 L1 ?0 r8 [
  54.                 )
    ' v7 z( h" Z. e+ V, l/ q; N* I
  55.                 {
    0 x" k% t- c5 Q. _5 L: F9 H% N* x
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    - A5 q5 ~) r$ B
  57.                         return 0;
    , C' k% f! F: S! H2 [2 u/ f1 ^; n$ l
  58.                 }  ^: r0 l: j1 E- |! @" l
  59.                 //Creating Process was sucessful
    - t3 K9 h/ C* J- y% T& j& ]" V* d
  60.                 else
    " {' d1 \0 S- `- `8 v
  61.                 {
    9 C7 l% q7 H5 K; w
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    ; c2 [& Y* z0 p3 P8 L

  63. 4 G/ D' n4 Y9 \7 D  @0 b7 {
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure1 P9 z- x/ `  n- W
  65.                         dbge.dwProcessId = pi.dwProcessId;
    + E0 g6 A9 S; G% e- _
  66.                         dbge.dwProcessId = pi.dwThreadId;6 u! o  E: @9 ]1 {7 j; d

  67. % E, D& n, g5 e* o# f2 n9 j5 X: ^
  68.                         while(true) //infinite loop ("Debugger")# N% h! l+ D6 Z  @) M( g
  69.                         {2 k+ j6 e, ~" ~* b4 s
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx1 S9 [) r$ E. u$ p6 b" A- p

  71. 0 \! ^/ S+ S; H( v( [$ ~
  72.                                 /*
    ) C5 x8 T. K1 T0 @( u5 P
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
. j; g5 r& S. V0 n: T$ o
  E9 V' P- U* Y/ M
& |' |( c* t& z* u# m( n9 M. R1 r
商业服务端 登录器 网站 出售

15

主题

257

回帖

1226

积分

金牌会员

积分
1226
金钱
886
贡献
63
注册时间
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

回帖

1226

积分

金牌会员

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

3

主题

102

回帖

6825

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-3-7 12:06 , Processed in 0.049346 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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