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

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

[复制链接]

161

主题

389

回帖

7476

积分

管理员

积分
7476
金钱
2161
贡献
4765
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 6 z4 f! E/ G3 k3 z( B+ c* l
* b$ @) k, P5 J4 M+ ~
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。, z7 L, C' u8 Q' w) n% h
" W9 k! I) J: v, k5 w4 s
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    - T8 n( t( C1 @5 C! ~1 s* z
  2. //8 t3 f" N& b# {. S5 H. m. B: i6 C
  3. 2 v$ M& T' @" U; E2 {4 r
  4. #include "stdafx.h"' [' A0 `! g, r/ J7 F* ?' n
  5. #include <iostream>
    & _. E/ R  K0 s' m# y, e
  6. #include <Windows.h>0 `9 s! a2 n. K: ?
  7. #include <io.h>" ^( s, J3 ?+ n7 Y6 [
  8. % r# C9 D7 v+ E# a
  9. 6 p! `$ {; S5 Q! b& i, v2 Z0 U
  10. int _tmain(int argc, _TCHAR* argv[])5 f/ r4 i4 g( X" T  h
  11. {
    ; D8 [  m4 ?# M* B# }& w' m
  12.         printf("Dekaron-Server Launcher by Toasty\n");4 q! `/ B6 v8 h( F6 n, G( X
  13. , H) r% c( E9 u. d
  14.         //查看文件“DekaronServer.exe”是否存在
    6 ]$ S+ `/ S) }9 ^2 f/ t/ r
  15.         if(_access("DekaronServer.exe", 0) == -1)* o& T* n* e) J5 a) D5 o$ a
  16.         {0 H3 i3 W& M9 l8 {" U0 {- r
  17.                 printf("DekaronServer.exe not found!\n");
    9 D8 Q  b' W4 P. t  t
  18.                 printf("Program will close in 5seconds\n");/ T8 V! A9 T, Z9 y
  19.                 Sleep(5000);  J# {0 U1 r9 v! J+ `9 N+ x
  20.         }
    ( w% j% L5 d2 u; a, c# r4 F
  21.         else9 a; t4 N$ ^) ^" n" t3 e
  22.         {
    & e9 c/ y# C) {& Q  `
  23.                 4 J  x, y& K+ g; [& t" g
  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
    8 c8 X, z/ h1 j; C/ v. b! }: q
  25.                 STARTUPINFO si;
    - @" }: P/ M# a" t: J
  26. ; Q, |$ T0 Y& F  W( G0 }
  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# v* {. @/ y/ @, c
  28.                 PROCESS_INFORMATION pi;
    8 _: |5 s' k6 O# f8 G1 a; Q! i
  29. 8 G* I8 Q# y2 A- |# m
  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
    : Q( }! l; Z! C5 V0 G
  31.                 DEBUG_EVENT dbge;
    1 X' B( t% h* Z) }! f

  32. 9 }% Y! \8 e. S2 |* y1 ^
  33.                 //Commandline that will used at CreateProcess4 R1 c) Y0 _! h9 `
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));& p* o' K  ]' x# c% T; U

  35. 3 Y2 @# `0 B/ l3 {3 d; Z' i
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    8 P  l9 v: T: w0 ^! r8 e+ o
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
      W( S9 e  X" r, i4 l2 G& D' q
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)  `7 x6 }7 W9 L
  39. % v5 x2 K5 W. G" ~. k* B

  40. & {7 d& V  T: B" f5 n
  41. 8 ~/ J. K0 e+ @2 B( P
  42.                 //Start DekaronServer.exe
    9 _1 C+ e# m6 V7 B8 _# k9 L
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    0 S" y, b% n4 T$ K$ s5 }2 Q2 D
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    , V- P( [6 v$ ^2 c  H2 a/ w0 V8 X. b
  45.                         szCmdline,        // Command line
    : ~$ Q) L( w9 j: R  _8 Z3 ^
  46.                         NULL,           // Process handle not inheritable
    ' Q, f" u3 g# ^6 S$ v
  47.                         NULL,           // Thread handle not inheritable
    , t5 [% x+ P2 u! h& f6 N
  48.                         FALSE,          // Set handle inheritance to FALSE: ~1 S: j+ e: T& S7 l; W( |3 |
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx% C) a& }+ ?. s% g) {7 P6 h
  50.                         NULL,           // Use parent's environment block+ s7 |, q9 D& k9 {+ B; Q% U
  51.                         NULL,           // Use parent's starting directory
    ( h9 X7 p# z, X' Z- [# v0 L5 k
  52.                         &si,            // Pointer to STARTUPINFO structure% w* Z/ w% C& g! R
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure3 p* T! I2 u: z0 R" j  a! B% T
  54.                 ) : J0 C. r8 x# n1 t# o* U
  55.                 {
    + k$ d/ k/ @( e. T' x
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    8 O9 U2 x! @/ b( k& d, {! [; ?
  57.                         return 0;
    ; d9 L& o& U3 n/ S" K- E5 Y) \2 k
  58.                 }
    ; P5 [5 r9 m9 w4 F
  59.                 //Creating Process was sucessful
    1 Y' ]6 [/ ?" ?2 j* r7 |; ~
  60.                 else
    % s/ w& |- N1 R( [
  61.                 {9 z" ^# i; v( N) u1 q$ R
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    # ^+ S* K8 {7 r; @

  63. 0 c  u( ?- V( `1 M& p, a* R
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure7 C# r) K4 w) Y4 y
  65.                         dbge.dwProcessId = pi.dwProcessId;
    7 P/ q9 t: u+ u1 }0 |
  66.                         dbge.dwProcessId = pi.dwThreadId;
    $ f, g+ _" l3 y

  67. - O$ R! C3 |: v" \8 T# a
  68.                         while(true) //infinite loop ("Debugger")
    # B5 o$ o- m3 H, ^- f
  69.                         {
    6 e4 G+ W' z. o4 Z& }9 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/ K6 \" r; S# F' G1 n
  71. & w) Y: V' o% ?% i- w3 V
  72.                                 /*
    ( Y  F  u$ l6 U: c+ m
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

7 C8 L" r' Q; x3 \# R) l9 R( S& M0 n" P/ {; r8 y$ A. R9 s7 f1 @

" z: k9 L2 A7 x) p& b1 Z
商业服务端 登录器 网站 出售

15

主题

260

回帖

1313

积分

金牌会员

积分
1313
金钱
945
贡献
88
注册时间
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

回帖

355

积分

中级会员

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

15

主题

260

回帖

1313

积分

金牌会员

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

3

主题

102

回帖

8177

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-5-14 01:19 , Processed in 0.063763 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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