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

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

[复制链接]

155

主题

344

回帖

5919

积分

管理员

积分
5919
金钱
1848
贡献
3572
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
6 n! V6 H( w4 v. \$ ?$ C! M4 g8 C$ A
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
' _: S3 a+ {- `' F$ d! V
$ t$ T4 E" _8 U. b3 r8 k
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    ' [3 B1 Y2 u7 v' @
  2. //
    * c7 W9 x$ w2 d

  3. / \# `3 o% ]: @4 X, p( p
  4. #include "stdafx.h"
    : R+ U+ l% q& b
  5. #include <iostream>
    ) P1 o- y: |8 J5 Z* ]' w- l$ @: @
  6. #include <Windows.h>
    , F8 O$ z1 }( K" G4 M  s  l' n
  7. #include <io.h>5 D+ D6 u2 G# {& k8 p0 k

  8. # x6 G; x/ }. Z+ q# p+ v% p# ~

  9. ; t* r7 _. m/ c" ]/ D3 f
  10. int _tmain(int argc, _TCHAR* argv[])
    $ m5 p+ ~1 y) D- {) J: S
  11. {  R, ^$ v. [2 [# K
  12.         printf("Dekaron-Server Launcher by Toasty\n");% k5 p( p! e) c
  13. ) W/ w7 G. h1 e6 I8 \/ e2 \0 j
  14.         //查看文件“DekaronServer.exe”是否存在
      u% W0 Q9 z# ~7 k
  15.         if(_access("DekaronServer.exe", 0) == -1)4 x, E1 h. \  J5 ?. i8 y2 F0 b/ c
  16.         {( {. \) d$ ~2 m: N
  17.                 printf("DekaronServer.exe not found!\n");
    . k# D9 i! h+ L1 U& X, i; K* _
  18.                 printf("Program will close in 5seconds\n");
    ' W  M- z- D# V* y9 `) }* m
  19.                 Sleep(5000);7 W5 t& ?# p8 `. B3 K. }
  20.         }; n/ p; p1 n* M: q+ `8 N$ |0 d/ M
  21.         else& J* W- W% ~! u( U0 j
  22.         {
    % p2 s$ a) _# e
  23.                
    ; B2 E2 M$ n( @2 v1 k, M; V
  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
    2 n; `3 ~# M  v! N6 D- s
  25.                 STARTUPINFO si;
    , j9 E: x& _# C" A/ Z! ?8 n! a, U( o

  26. / F; v" D* 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, E" a* O5 o5 B$ E1 Y$ {2 Y: r
  28.                 PROCESS_INFORMATION pi;  b+ e+ Q9 r4 K# k+ d! z9 u$ X( _
  29. 1 g3 c  _" |0 C
  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).aspx7 {  B7 L+ m. @" G% h
  31.                 DEBUG_EVENT dbge;1 q$ ~7 b2 u0 j- W# ^/ e

  32. & A- ?; ?/ |1 b9 J, `% e7 G  W
  33.                 //Commandline that will used at CreateProcess; U3 M- w- n0 E( i0 ~" C, L
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));. E* j5 t4 l) C9 y5 U2 l1 A' p: ]

  35. # ], a& j5 y) B  r0 E0 q
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    , i9 k, x# u6 c& A8 W1 l- k( ^
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)! k& l- o5 T8 x" r3 ]' Z* `
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    % V& a" l4 I" h$ |8 \4 Y/ m
  39. # |: x% `' r& ~. t; H1 h7 Z) {

  40. 6 ~. J! r' J/ u% u

  41. 2 E& p3 s6 Q" U# S! L
  42.                 //Start DekaronServer.exe 4 s8 S$ U& u+ N- {% C* }
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx  G2 A  W. z* T6 u
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    ' G, x0 C9 J* W
  45.                         szCmdline,        // Command line
    2 c: i) @, ?3 |' g1 d
  46.                         NULL,           // Process handle not inheritable
    + v4 Z  f4 ^$ f; s: q* a8 I
  47.                         NULL,           // Thread handle not inheritable7 }/ {7 e% Z" X9 p2 f
  48.                         FALSE,          // Set handle inheritance to FALSE* H( j, W- ?9 x2 h4 [
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx. p( @5 {( k& Y  G/ E( H& p
  50.                         NULL,           // Use parent's environment block
    5 g" W! v  R3 `* M2 e
  51.                         NULL,           // Use parent's starting directory
    & `0 J* J- s: o  }) N
  52.                         &si,            // Pointer to STARTUPINFO structure
    7 c$ y& o) `0 X8 }0 ?* n
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure% q& v/ D. U9 g- L* C- u
  54.                 ) ; i( f1 S  {" R  n& W. \. @
  55.                 {
    3 F4 I" D- P# j
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );7 ?+ x! N+ L% q" w6 p& [# R$ W2 q' a
  57.                         return 0;/ m' M4 a9 B! t4 ^
  58.                 }+ o9 M$ J7 a6 C4 `
  59.                 //Creating Process was sucessful# `+ w$ d4 A1 Y6 T+ }/ u7 e" j0 ]4 b( L
  60.                 else
    " W8 d, T4 B1 K8 D. ^! Z$ T& m
  61.                 {
    6 j- G  f. D5 u/ H
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    . X8 l/ N* h) _: q( l, b
  63. 8 `* D- w- K1 ~& E$ g. n' @# b: B
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    % s! _$ X6 U% U
  65.                         dbge.dwProcessId = pi.dwProcessId;
    ( |" f% E. R) v. m/ @9 G, e
  66.                         dbge.dwProcessId = pi.dwThreadId;
    2 d, p( K6 u0 D; D2 v
  67. $ h$ I, ~& x2 d% n
  68.                         while(true) //infinite loop ("Debugger")$ E- ]& t# p- x8 a
  69.                         {, K7 Z  q5 j; x& [, Y8 ?. c9 V8 E
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    - q3 x1 b) X0 p/ T2 t

  71. / J5 ^% [. ]4 z: _: D
  72.                                 /*
    - f6 ~, i9 y/ {# ?2 p/ _, l- @3 a
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

* a1 V9 P3 |" @' T, q1 |( I) b- U: q$ B/ E9 B

1 G# G- P4 T& D+ _
商业服务端 登录器 网站 出售

13

主题

251

回帖

1233

积分

金牌会员

积分
1233
金钱
808
贡献
156
注册时间
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

回帖

1233

积分

金牌会员

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

3

主题

99

回帖

5593

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-20 15:05 , Processed in 0.085067 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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