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

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

[复制链接]

157

主题

364

回帖

6930

积分

管理员

积分
6930
金钱
1966
贡献
4443
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
  Q3 C2 r. w7 ^! R# u1 }7 i
9 E) V6 B7 z8 @3 g+ p" V5 e虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。- S8 z4 G% Q* E4 k+ m8 q: O7 Q

5 ?( s8 P) B+ Y2 _. v! X- t
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。( Y3 r. e! i  \* L" s- s
  2. //
    0 p  K* X7 z6 n9 D6 F4 P1 \
  3. - x! X, Z1 s' W4 C0 |* P5 c
  4. #include "stdafx.h". x' [% M4 O0 @
  5. #include <iostream>
    2 Y* h! [! g7 H+ Q
  6. #include <Windows.h>8 Z1 G  L5 n+ `
  7. #include <io.h>2 k8 G2 s3 b" y6 x( k5 G/ j

  8. - r/ I8 b4 O$ C+ Q! |2 w

  9. 0 j& }1 G6 s( E* |" R% s
  10. int _tmain(int argc, _TCHAR* argv[])) f0 Y5 o% w0 B" T  W
  11. {
    " L% M& b/ n5 Z) |  T3 Q7 x7 o- I  t
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    - r! R9 S! D9 z4 j% b  ?  g% f; j4 M
  13. 7 p$ |& `9 @" G5 h1 g
  14.         //查看文件“DekaronServer.exe”是否存在( o8 v7 O! Y; X$ }8 y, [
  15.         if(_access("DekaronServer.exe", 0) == -1)
    ' }8 J$ ?" e5 T, J% b
  16.         {
    4 v# m; i, L7 O: _. K8 M
  17.                 printf("DekaronServer.exe not found!\n");
    1 r4 ^+ i$ G1 l5 U! w( Y4 C
  18.                 printf("Program will close in 5seconds\n");( u$ L% W- C/ D( v* J6 M7 _
  19.                 Sleep(5000);. H1 s6 {( N" K
  20.         }
    0 I  {: ?* {9 _8 Y$ C  T- Q; U
  21.         else
    * W! }% x7 J4 T9 S( F1 \& f5 e
  22.         {1 m& |3 p; a& {9 z3 x) Y
  23.                
    - W0 I% E5 u6 Z/ N! O3 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
    . {( H' V8 ]( l9 T/ n
  25.                 STARTUPINFO si;
    ) S5 F$ `  c7 {: J' a1 h

  26. 0 X3 k& ?+ ]9 e4 h% z8 Q
  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
    , X* G' @( r: t$ t: W4 i
  28.                 PROCESS_INFORMATION pi;# C, `1 K/ A% g: }  Z* L
  29. , ^0 G& h" r9 r* q/ Y% `  j) t
  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
    % e% o+ M8 f0 {  A
  31.                 DEBUG_EVENT dbge;! }3 I/ Q/ J/ j2 N9 I  A
  32. 3 R6 r3 u7 U' r
  33.                 //Commandline that will used at CreateProcess
    + U5 n( r$ P2 d* ?, x$ J. K. I. T
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));9 W4 h1 w, D1 y% G
  35. 4 @6 \9 d! Y8 Y& J
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    ( }3 i- E3 l( @( @$ T8 Y
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)4 t6 w1 S1 K: h- x$ E: c! L
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    3 {! _8 X/ `* m

  39. . N, i4 ~6 R5 _6 a

  40. 9 G' R- M- k  @9 l7 H; L  b4 ~
  41. ( s7 g8 Q% c0 x; C+ _
  42.                 //Start DekaronServer.exe - ^( Q" K  Q( G- r0 G, F
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx: U  Y) G3 D! f, P3 S( C
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    : E3 h; d4 ^- v  U- ~6 N1 [
  45.                         szCmdline,        // Command line
    6 \. h% \" D# `
  46.                         NULL,           // Process handle not inheritable
    8 m1 Z+ d2 ^% Y& x; P
  47.                         NULL,           // Thread handle not inheritable, w+ G2 h) g$ V8 c/ [! w
  48.                         FALSE,          // Set handle inheritance to FALSE& K4 g% i- Q/ z' m, `$ y( b, P$ `, _
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    1 j! b2 a/ q4 g
  50.                         NULL,           // Use parent's environment block! O9 j2 u8 U& {% `. O1 o4 M( K
  51.                         NULL,           // Use parent's starting directory
    / p" Y- T! e8 i. q: P
  52.                         &si,            // Pointer to STARTUPINFO structure
    0 s& k6 h+ ^# A
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    2 R) x, D& Y- W7 t: {
  54.                 )
    / A6 T# e$ S8 C
  55.                 {
    6 b3 H% H& A( N7 s8 Q) I
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );( B) d- R1 ^9 U2 e7 X
  57.                         return 0;" Z8 d6 r( O4 ]* @7 r' L6 b
  58.                 }* h' x; J- r; {, t
  59.                 //Creating Process was sucessful( r% [% [& M7 L
  60.                 else* z7 h, {3 w7 h
  61.                 {& S. `/ t& M1 G; N% @* W
  62.                         printf("Sucessfully launched DekaronServer.exe\n");6 w2 Q" |; j9 i$ s+ O+ O7 J

  63. - @0 q* A4 Y' S4 `7 D! H  ?
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    7 R4 s4 [2 E! W: t! w( h
  65.                         dbge.dwProcessId = pi.dwProcessId;
    9 g7 Y2 G8 q2 v7 e9 ~  G
  66.                         dbge.dwProcessId = pi.dwThreadId;
    ; a; d6 V- R8 W; S  q4 j" Q1 y

  67. 8 ^& i9 J3 T% S; E+ G
  68.                         while(true) //infinite loop ("Debugger")
    * x. n. X! f! p% W+ t6 m% n
  69.                         {, w# o& ^3 R) T
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx4 @' }- l' A, @7 F
  71. $ `3 o6 w6 ]2 O2 b+ v0 Z; q
  72.                                 /*
    8 [% t/ {# G6 M2 A1 D! h2 A
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
. y/ \$ f' u1 f" x' t

) X/ Z. W, @: l/ K8 j5 M
# S6 a/ X. B: H
商业服务端 登录器 网站 出售

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

回帖

6799

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-3-5 09:58 , Processed in 0.044969 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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