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

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

[复制链接]

157

主题

369

回帖

7153

积分

管理员

积分
7153
金钱
2049
贡献
4578
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 4 L+ J( _/ k) h7 U/ ?

8 v+ o8 S/ J; F: l' @虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。8 ?6 q' ?( J# _' u
( f2 m' S5 |9 J/ o- q" w, T
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    5 R: S; s4 C( w$ s9 N3 D7 h4 r
  2. //
    9 ]! l' j  Y. a5 n" U$ f
  3. * [$ v/ q3 Q& F- |: f
  4. #include "stdafx.h"1 Y, o9 O6 d1 H/ b
  5. #include <iostream>) R& Q) _, g+ h0 v
  6. #include <Windows.h>, B: v3 p. |. o
  7. #include <io.h>
    / [. |1 t; T: w. \4 _
  8. ) X8 d% b! J! x) z* v2 N2 F9 g) K
  9. . z1 f; ~8 P2 U) ]" U9 O) X# F
  10. int _tmain(int argc, _TCHAR* argv[])
    # L* p/ p; }) S/ v1 v" V) I8 ]$ c
  11. {
    0 d6 u" ]' k- P7 h1 A+ j, d* ?/ m$ k
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    5 D7 H* c- q# n4 R9 @: t/ Z1 }* f

  13. * X) S0 j( t+ {# A* @, h
  14.         //查看文件“DekaronServer.exe”是否存在* ]. S6 o$ Y* x5 S9 |
  15.         if(_access("DekaronServer.exe", 0) == -1)! R. I8 K) C; e
  16.         {* Q$ i. `+ G; E, f( O
  17.                 printf("DekaronServer.exe not found!\n");' y- @% N( a- l5 ?5 }
  18.                 printf("Program will close in 5seconds\n");7 _4 M. t5 W" V: m% P0 ]
  19.                 Sleep(5000);
    1 l/ k0 j6 i1 U; X; e
  20.         }! ^( w0 e+ ^( D9 S6 T7 M1 P* c
  21.         else
    % Q; B* T+ W* Y+ i2 J5 A
  22.         {
    & s6 U, _7 Z/ w1 U9 ^" d; M
  23.                
    6 ^- ?! g2 F& Q: _/ h/ G% D
  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
    6 N) G- |0 S5 C4 K4 n8 v
  25.                 STARTUPINFO si;! K) E/ p9 O, ?1 A

  26. 7 @7 v4 J! ~% E0 C
  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. N3 }+ _, h+ z% u: m- b
  28.                 PROCESS_INFORMATION pi;/ \* \# k8 |6 C5 Y: X# ^

  29.   D8 S7 |# U0 Z4 G
  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+ n7 X* Q8 \/ o
  31.                 DEBUG_EVENT dbge;; l5 U; W" e) j: P

  32. * _! k5 R; V! ^. S
  33.                 //Commandline that will used at CreateProcess- L: {2 E2 F1 H: t1 T2 N( r
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    2 }% w3 A& [2 A( L

  35. % P* [1 ]: F( n* I8 z' X4 P# f! j
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)& ^3 n: f" P3 C$ k
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn): x! p: K* T9 |$ A; R+ h( e6 R
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    : ]( \+ }0 U0 z; j! w, W' ^

  39. 0 B8 r( U* ~$ {8 W7 l2 }

  40. : q5 G- c1 U% Q+ i
  41. - [: F7 h4 N# C3 N, u: l. A
  42.                 //Start DekaronServer.exe ; A1 Y: M5 l  X8 x) R
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    : ]8 v3 b+ ^, ^. N6 ^3 ~
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    + `; P/ E# b$ v% R1 i
  45.                         szCmdline,        // Command line
    6 r- t3 F+ j6 F9 M4 X5 G4 `
  46.                         NULL,           // Process handle not inheritable
    + x# E; H) ?$ {. J; T( S7 D
  47.                         NULL,           // Thread handle not inheritable: B) d; L, J! C- T, c) s& ~  h
  48.                         FALSE,          // Set handle inheritance to FALSE$ a3 Z4 v( W4 d, T
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
      v% e* d% ~+ E* \: U  `7 [, Z
  50.                         NULL,           // Use parent's environment block  P/ ?+ g4 c- T% U% U
  51.                         NULL,           // Use parent's starting directory
    2 {3 R3 U, A$ b: _9 ]
  52.                         &si,            // Pointer to STARTUPINFO structure
    6 R' O0 s1 f" Y! x# l
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure2 B8 G8 T' M7 R) Q: f1 N
  54.                 ) & \6 g% i3 n: o% f: a
  55.                 {! v& I% |* s. E% w! ?
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );+ `1 e7 w4 a5 D% q. L4 a! {
  57.                         return 0;
    4 [0 t+ g" G0 L1 a, i
  58.                 }
    ; \( f0 w' K0 ?9 w* G1 D
  59.                 //Creating Process was sucessful0 K' @7 ~* n9 g) X/ a; T" w1 n5 k
  60.                 else* l+ x- C4 U" b
  61.                 {
      V8 M( z4 k0 F8 c$ z
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    0 q# K* e8 i2 {3 o$ ^$ o

  63. 0 Q6 C. J' w% @: M
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure$ `/ j. K+ n2 ^2 S
  65.                         dbge.dwProcessId = pi.dwProcessId;. ^% y, F; L. D% Z
  66.                         dbge.dwProcessId = pi.dwThreadId;+ }' d% [6 E3 x; G! X* j4 `
  67. : ^3 Q$ W3 O$ @+ c0 z* C
  68.                         while(true) //infinite loop ("Debugger")( K" A) |2 D2 [2 J$ A+ W8 \
  69.                         {+ H: x+ L+ |+ m, Y0 K$ ?
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx# `5 O7 `( r5 ^" e8 }1 x

  71.   z, C  ^$ B# c
  72.                                 /*- L; @% p; Y6 P8 t$ Y5 v; }: w
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
8 ]2 \; q6 P3 f. i

' B( @# O  H9 C4 ?% v- K2 ~# z# ?, Q# F9 d! _/ e/ Y. k
商业服务端 登录器 网站 出售

15

主题

258

回帖

1245

积分

金牌会员

积分
1245
金钱
903
贡献
64
注册时间
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

主题

258

回帖

1245

积分

金牌会员

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

3

主题

102

回帖

7417

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-7 10:08 , Processed in 0.041217 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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