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

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

[复制链接]

155

主题

350

回帖

6215

积分

管理员

积分
6215
金钱
1872
贡献
3838
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 9 G# `8 o3 C' d5 t7 c& @" H& O
2 X- N( C9 ^) _# O/ L. b
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
# c# V5 n* ]3 |2 J3 T) a" |$ s3 ]. M
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。& m# _5 t  @- v7 L* P, G& \5 |# V
  2. //
    ) t4 V7 w/ g  G. ~) X
  3. , N4 i, b- a3 v5 s1 W9 L
  4. #include "stdafx.h"$ e4 I: [( G/ E9 k! g  R8 y
  5. #include <iostream>
    " g7 F/ w9 w& W, u( K1 `: \9 Q- i
  6. #include <Windows.h>
    + p9 {; g* |- E
  7. #include <io.h>
    / p6 C6 K4 G1 R3 v

  8. ( x  x, S* M; O+ P) b2 N. b2 B* r; H
  9. ! y8 k+ M/ S' S0 s* ?
  10. int _tmain(int argc, _TCHAR* argv[])2 v, z" O7 N& z% `
  11. {( }2 a! v. {: Y9 S3 [' n) ]) U
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    - J  [4 k% ]# M' d+ i
  13. , G4 g- e$ K& d2 F' z  Y9 b8 C, o/ y
  14.         //查看文件“DekaronServer.exe”是否存在/ C1 h9 H+ L3 v$ C7 B' F8 E2 k
  15.         if(_access("DekaronServer.exe", 0) == -1)
    9 [- @8 q6 N3 F5 D) Z. N
  16.         {
    . ~& u% n: O" O2 F( D
  17.                 printf("DekaronServer.exe not found!\n");
    + O( l5 t0 @' w
  18.                 printf("Program will close in 5seconds\n");
    # @# I% A/ V% }* g. r
  19.                 Sleep(5000);% {8 d* X+ h. W
  20.         }
    5 `+ n! o1 c/ |5 X( \+ v$ _
  21.         else
    5 f) @+ a5 a$ W9 \
  22.         {
    ; }7 E5 B8 X  n
  23.                
    % \5 F1 z% l4 Z  n( 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: y0 l% V. F0 d, S! M4 F
  25.                 STARTUPINFO si;0 U0 B. A* Q  b6 y5 d
  26. ! S# n& q) @4 L; O3 e2 J6 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, n1 c3 v& L# R$ A: S+ t
  28.                 PROCESS_INFORMATION pi;3 D& J( p% k, R8 w. `2 E7 p

  29. $ l- z; S0 G$ G6 J* ]6 o
  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
    1 k8 k: J( d; j
  31.                 DEBUG_EVENT dbge;0 Z9 b) N# l$ y8 I; i( p

  32. 5 I  z% r4 k# H+ y! n) s2 m  F
  33.                 //Commandline that will used at CreateProcess+ l4 Y- H% n, c+ i
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    1 u$ P) m3 n% S$ g4 E3 F

  35.   f3 Y- G! E' i/ r& g3 T
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)1 g" f0 k9 s/ j6 m
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    % x* k9 d3 k& E
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    ; u: ]( D0 p: C
  39. : Y( i- U. E. f. L
  40. + ]0 k* X- {' F) R

  41. ) B' |& H& t$ Q4 X! q8 d* ?: B
  42.                 //Start DekaronServer.exe
    ! w2 e0 \  I9 b" S
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    4 j. D! ]# n% V" s( v3 z
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    4 g; @+ T6 S! d: l
  45.                         szCmdline,        // Command line
    4 w$ K1 n7 ^( k0 p0 ~8 N1 z
  46.                         NULL,           // Process handle not inheritable
    " z; B( n  |# r# Z' g, m
  47.                         NULL,           // Thread handle not inheritable
    $ y* b  d) f4 F! c, C2 @
  48.                         FALSE,          // Set handle inheritance to FALSE
    7 Z' K2 a+ P1 z  q
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    * p- P0 H0 J' |/ b% j
  50.                         NULL,           // Use parent's environment block- j4 U) Y2 T2 {* j1 O5 f5 W' ~) `
  51.                         NULL,           // Use parent's starting directory - d% S5 s1 z& g
  52.                         &si,            // Pointer to STARTUPINFO structure
    * t1 x, N6 c2 C  r6 z
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure4 q3 V7 F" R% M7 L9 q
  54.                 )
    . }. z$ K2 H9 H
  55.                 {
    + ^: |- w" T  f# t# ]; M+ {& L
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
      j$ o8 [1 Z, |% N# R9 p
  57.                         return 0;1 N2 {3 H, X9 r# e4 t7 e
  58.                 }
    - ]$ f/ h. g6 g+ w6 L. ~5 T
  59.                 //Creating Process was sucessful" K! `4 ~  q- r- H8 M, S
  60.                 else
    ! C8 |0 m: ?0 ~6 r
  61.                 {/ Z- X4 u" N, x9 V' I+ N( S, }
  62.                         printf("Sucessfully launched DekaronServer.exe\n");2 `+ ~; a6 {# M& H
  63. . h: E: |5 t% ~4 k8 s$ J
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure' q' |* a! q* P* r$ V2 V% P
  65.                         dbge.dwProcessId = pi.dwProcessId;
    # X9 S  X8 B4 P: d
  66.                         dbge.dwProcessId = pi.dwThreadId;
    8 B0 R; S0 R0 i9 V+ {, d9 w* y

  67. - Y. K3 b* g4 t7 }
  68.                         while(true) //infinite loop ("Debugger"); u. `& Y) U* \! a* S& i% L0 b
  69.                         {
    * m" e/ Q. N0 {
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx7 ~5 G+ Q( [# ^& d( g# L8 A* f
  71. $ u  ~& J" M  i+ W0 _# G
  72.                                 /*2 d' a1 I7 E$ o
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

8 \" J- P% R, b! S4 \: j
; X9 o) ^  L- G  @; H3 p3 g5 J7 W- o4 _3 K! m/ J
商业服务端 登录器 网站 出售

13

主题

251

回帖

1250

积分

金牌会员

积分
1250
金钱
826
贡献
155
注册时间
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

回帖

1250

积分

金牌会员

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

3

主题

102

回帖

5863

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-10 01:45 , Processed in 0.078440 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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