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

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

[复制链接]

152

主题

325

回帖

5593

积分

管理员

积分
5593
金钱
1773
贡献
3343
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) : }  Q0 y0 r9 J! s. m; E# D4 b4 j
$ A1 O& @, N. ?! q6 T* _  g  k( c
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。/ A; V  R4 x1 ]

& F( a, g+ B7 D7 p3 t6 [6 Q0 p
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。8 ^( K1 ], @: X
  2. //
    " F9 P! [3 ?$ t! a/ V! q
  3. & L7 Q5 v6 o. K8 R; w7 q
  4. #include "stdafx.h"
    1 K2 {# z4 Q' H8 U* u
  5. #include <iostream>- L6 n9 ?7 u) D3 u* s) O
  6. #include <Windows.h>
    / a* d; @: V  P6 B, I
  7. #include <io.h>& W, ~* c5 Z5 I- v
  8. ; O2 H1 D' X( ?( B: J  A
  9. * n  r2 N$ J! S
  10. int _tmain(int argc, _TCHAR* argv[])
    & |, b: K# a  q( q& k/ T$ H: w
  11. {; c$ _8 `: W/ N: f  m" S2 n& w: J
  12.         printf("Dekaron-Server Launcher by Toasty\n");( W6 f0 r- |& M+ o+ g9 O" A( g

  13. / D- L3 q& _* i' m4 ?% g
  14.         //查看文件“DekaronServer.exe”是否存在$ H5 ]: g  q" K3 [2 W
  15.         if(_access("DekaronServer.exe", 0) == -1)
    * d& b1 s+ v* E+ G; x6 v
  16.         {
    6 a) }, P/ D* R4 S: P
  17.                 printf("DekaronServer.exe not found!\n");
    1 |* Q4 {  B" T
  18.                 printf("Program will close in 5seconds\n");! a$ L2 S- R, a- m
  19.                 Sleep(5000);
    5 Q0 J3 W* M8 N8 \- d/ K- L: ^
  20.         }, y* D6 J- `3 ]+ C; |# x
  21.         else
    ; D* G: ]6 M: z$ r8 `8 L
  22.         {" T# [0 X' S; J0 I; V% s. H- v
  23.                
    . K4 I8 K# K" r' y3 N. `5 Z; q
  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
    / E- d( z, r( e
  25.                 STARTUPINFO si;+ l# N7 \, @9 o0 n

  26. & t# _; f. ?: s. [& v0 V/ G
  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
    4 X5 f, t( |# J1 f$ ^, Z' z
  28.                 PROCESS_INFORMATION pi;2 j$ l" j- V' s  F6 X
  29. 0 k5 y# }6 P0 I1 ?% w
  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).aspx3 K1 S6 z& q7 n/ i% k5 q$ K  n( d/ D. A
  31.                 DEBUG_EVENT dbge;$ h, p+ a( V& e) l  [$ [0 D

  32. + n( H( m/ m. }/ Z! L2 w: v4 y/ b
  33.                 //Commandline that will used at CreateProcess6 c: {% D# Q" D) R, l: N+ a
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));% ?2 ]/ }1 Y1 T* `) w4 G
  35. 9 Y" J: M( |7 L% R* l' @8 B- [
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    $ P! R% T3 S5 O1 E* p3 T4 l# ?' o' F
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    1 @' h9 J  I2 g: q) a
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)0 n  N/ D' Z# F. A

  39. - ?& p; `- Z2 X5 _

  40. 4 b2 N5 `1 e, Y  R, ~7 {

  41. ( A! j$ }  U" e- y
  42.                 //Start DekaronServer.exe
    1 k  S, D4 p; a" W
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx; e: E  m. O# r3 g" N" `3 z
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)/ G! N; X- J, f0 O
  45.                         szCmdline,        // Command line
      T" t, a8 O: G0 p
  46.                         NULL,           // Process handle not inheritable9 n  ~3 L5 T4 r& F" ^: O
  47.                         NULL,           // Thread handle not inheritable, i( S* _  Z* {0 v- d' t
  48.                         FALSE,          // Set handle inheritance to FALSE6 G* |4 z, ], h
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    0 W' Y0 q( h: R5 ~1 ^6 ^( z
  50.                         NULL,           // Use parent's environment block
      o8 U6 p) n+ m  }" O
  51.                         NULL,           // Use parent's starting directory
    4 p0 E" x/ K- x' `: S2 {
  52.                         &si,            // Pointer to STARTUPINFO structure" h( o5 k, V8 F* a) J' E) |% c; r0 e
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    0 \3 r0 N9 [" c; S' n& M
  54.                 ) + P; ^# k- x8 `9 f/ P
  55.                 {
    ! R) E4 g5 n0 S  v. y6 z
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    0 `- @  a6 P! ?. J1 g
  57.                         return 0;
    : _4 N- O3 u5 ]3 r
  58.                 }; c+ j* I. A( L" Z* I/ z
  59.                 //Creating Process was sucessful
    % B. F4 m( y5 L" H( M! v* Y8 Q" i
  60.                 else
    8 z$ b9 d. e/ X3 o3 @  Y: o
  61.                 {
    & Q' W0 ]2 u  u: z5 |. K
  62.                         printf("Sucessfully launched DekaronServer.exe\n");4 y: O: R4 H5 l1 H9 ?2 o) q

  63. 7 L4 d: Z6 V8 P
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    ) n, W, n+ T: S9 s) p: j; G6 t
  65.                         dbge.dwProcessId = pi.dwProcessId;
    : y1 q0 b+ o9 y& N
  66.                         dbge.dwProcessId = pi.dwThreadId;
    0 }$ z( Y3 d# h8 c" f( ]

  67. , X) }8 Y/ y- r! Q
  68.                         while(true) //infinite loop ("Debugger")5 P  v) ^! R, `. D
  69.                         {
    + r/ Y, T. B; C, v
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    # P. _' y9 B- C* E9 i$ @' X
  71. 9 C$ E8 U3 ^0 F5 W
  72.                                 /*
    * ~! E9 |( u+ `6 h5 E0 ~
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

% ~" |6 c3 x2 V3 z6 o3 o9 w8 B% s3 T4 o$ Y

  Q" O5 @: x* a9 a' _7 A
商业服务端 登录器 网站 出售

13

主题

250

回帖

1199

积分

高级会员

积分
1199
金钱
765
贡献
166
注册时间
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

主题

250

回帖

1199

积分

高级会员

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

3

主题

97

回帖

4811

积分

金牌会员

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-11-9 01:07 , Processed in 0.076911 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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