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

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

[复制链接]

136

主题

168

回帖

3159

积分

管理员

积分
3159
金钱
1034
贡献
1821
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
* x  J4 s2 X, ^) D- J4 b7 C! h; h7 ~+ a
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。& h, G: R  ?$ ?5 x( W
* R" M$ v, r0 d" B5 X0 [' W( w+ @
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。1 C, t/ Z3 |# v) m, Q- x
  2. //1 X/ @2 f$ o. P) U5 h- c+ b" \7 r& Y
  3. 8 [6 O, `+ t+ K( F  `# {% q
  4. #include "stdafx.h"
    6 E) T  z( B( X! n! r. Y, b) `
  5. #include <iostream>
    : l$ J6 d8 U; q
  6. #include <Windows.h>" e$ T; `; u" j% }2 G4 [+ m# O
  7. #include <io.h>
    $ ~$ H; C! f# [8 u' j, }
  8. 5 @4 i) ]( ~8 q% r6 g* q6 @

  9. 9 H0 N: S" S" }% @5 x$ Y3 d/ d
  10. int _tmain(int argc, _TCHAR* argv[])
    2 z5 Q% m; |; g# \2 `& h
  11. {
    : F8 O% ^1 o( ?# U
  12.         printf("Dekaron-Server Launcher by Toasty\n");' r- N4 a3 D8 I- S6 W

  13. - F, a* p# g1 P% ]( q1 t: G
  14.         //查看文件“DekaronServer.exe”是否存在
    2 B! Z! H0 R! K$ c
  15.         if(_access("DekaronServer.exe", 0) == -1)
    ( t3 k! ?( g/ K
  16.         {
    & Z9 }- n9 W! p8 t9 T/ @" u, c: J, S( U
  17.                 printf("DekaronServer.exe not found!\n");; [: P/ m6 S. {) |# R! Y8 t
  18.                 printf("Program will close in 5seconds\n");
    6 W) k. w0 W+ c6 J
  19.                 Sleep(5000);
    ) k& ^$ E/ }  |% r, [- e# |$ Y
  20.         }- L0 V& H' u$ B4 X/ J, ]0 Q4 x
  21.         else" }& }& J7 L; A
  22.         {8 u( H" L. T3 T5 U) X9 l# p
  23.                 ; z5 r: \8 k/ C: m
  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- m4 l) a% @. m+ _) u" K
  25.                 STARTUPINFO si;3 t3 P) d! y6 [- t' d# z# N* A
  26. " L$ R7 q! `1 H4 m% r) g) 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
    $ I# X9 v1 @0 w  [: f1 G. `
  28.                 PROCESS_INFORMATION pi;
    ( f' O$ \7 O6 p# t

  29. 7 F& _( }* k. B/ K. q
  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).aspx9 E3 H4 v0 m9 F) L/ N7 J% Y# ~
  31.                 DEBUG_EVENT dbge;  l' a, H3 y6 [9 c' N
  32. * b, t' W9 ~  _0 [# c. V- O
  33.                 //Commandline that will used at CreateProcess
    , O) x3 u' R3 F( c# A, C3 o6 e
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));  }+ c! y- F- i8 |( \8 I9 T8 Q" O

  35. 6 N7 k6 `. I; l& y6 H3 e
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)( D4 e- x  R; s! w, ~& K/ D
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    # g* q7 M" T  d- \5 C; u, }0 i
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    , Z8 M: m% B; J% }

  39. * w7 \* i" e2 z! t" M; c7 x4 E! M

  40. % O: |: s0 e% x) C+ T( j6 I. q
  41. 8 ~3 _+ E3 R% e7 G  M- w  V
  42.                 //Start DekaronServer.exe % @0 D' x4 y) h& u* S# H
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx/ g7 A' Y/ U* w
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    ) n! Y) E3 _) x" B! b
  45.                         szCmdline,        // Command line1 A6 q2 g+ f$ K5 g) I3 B% l
  46.                         NULL,           // Process handle not inheritable6 Q. D3 i7 ?5 B
  47.                         NULL,           // Thread handle not inheritable( i* Z$ D" D: {  Q0 V" u3 Z
  48.                         FALSE,          // Set handle inheritance to FALSE6 D/ z. Z; j/ X/ ]
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx) [& P2 |: N/ K: ]& Q1 W
  50.                         NULL,           // Use parent's environment block9 j* D5 d( }5 a6 ?% M+ e$ B$ K; i% b
  51.                         NULL,           // Use parent's starting directory
    ; q6 z. }! S2 S  l' U3 f
  52.                         &si,            // Pointer to STARTUPINFO structure
    . t1 [: s) r) C2 |0 Z% d: V. P2 B
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    . P4 k" K$ c7 L/ o
  54.                 )
    8 X& |) `! S" j! E7 q
  55.                 {( X! r3 \6 O9 a5 d* w& W
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    6 l3 J: u) r/ G, G# _0 K
  57.                         return 0;
    8 n; w" r( `& `
  58.                 }- E* Y9 e9 N& O5 _
  59.                 //Creating Process was sucessful! X" f, |' R& Q7 T4 W
  60.                 else
    9 i1 @- m3 r' i: X& a; q% R
  61.                 {
    $ x4 d- c2 t' B. s+ }
  62.                         printf("Sucessfully launched DekaronServer.exe\n");/ W) H$ b+ K7 `' D4 `: K4 U* c2 l
  63. 6 m# y) x) g7 a  K2 b! {
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    7 B  c- u/ D+ O; S3 d9 x/ J
  65.                         dbge.dwProcessId = pi.dwProcessId;2 ^0 h: g8 n  N$ q" I1 R
  66.                         dbge.dwProcessId = pi.dwThreadId;# S+ W, u# L; a9 ]- c8 B4 G
  67. : d6 R# }3 i0 y; P0 k7 r. o$ I$ y
  68.                         while(true) //infinite loop ("Debugger")
    ! n" F& V6 Q# Z/ [! J! R
  69.                         {7 A1 y7 Q; s3 n0 p
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    + V  a0 a  Z( o) U! s
  71. - P' B: G/ h$ |0 U
  72.                                 /*4 l% v$ u3 h& O: [2 k  S# J
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
  ]* ^# h1 l. H4 v% I
1 q- }2 A: ]+ U, k% t$ h/ K" [2 D7 {

3 }/ g4 ~# h) d) h
商业服务端 登录器 网站 出售

8

主题

230

回帖

816

积分

高级会员

积分
816
金钱
487
贡献
86
注册时间
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

主题

189

回帖

298

积分

注册会员

积分
298
金钱
106
贡献
3
注册时间
2024-5-14
发表于 2024-5-14 15:56:57 | 显示全部楼层
学习学习赞赞赞

8

主题

230

回帖

816

积分

高级会员

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

2

主题

81

回帖

614

积分

高级会员

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

本版积分规则

Archiver|手机版|小黑屋|EGameol

GMT+8, 2025-2-23 23:04 , Processed in 0.047461 second(s), 25 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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