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

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

[复制链接]

156

主题

355

回帖

6620

积分

管理员

积分
6620
金钱
1917
贡献
4192
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 5 b& r0 N( l# D% u# b% `/ i4 e# p

4 P# b$ }0 h- Q9 r( e6 R7 c虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。( Y* i8 k1 S4 l3 w: N+ C  x, j

$ s1 R! O" z- v1 i, y" ^
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。" V) B: B- L) p6 K7 p
  2. //' \) p* H3 i5 |; b3 f0 Z1 E# A
  3. ! b( P4 c' i' Q" `$ p
  4. #include "stdafx.h"
      p* w& ^2 q9 a# W) {9 d4 k. e7 ?
  5. #include <iostream>1 Y- ~% s( {8 W' U  U0 l4 _+ ~
  6. #include <Windows.h>
    7 i- I+ ]8 X6 J/ B' g& f1 u
  7. #include <io.h>, H: h( N9 e( Q/ A- y( L

  8. ' J1 d0 T6 w9 g, j) u1 R' b
  9. 2 K( `8 H. E3 [' |' n  J2 }! k) N
  10. int _tmain(int argc, _TCHAR* argv[])# R1 F7 Q& |3 f: d) i
  11. {
    ( Y& ^( P# g& }$ O2 I1 E
  12.         printf("Dekaron-Server Launcher by Toasty\n");( t! l; Y1 D0 ?  h2 o) r

  13. - [& J, D9 {: o+ M- v. \$ }; C
  14.         //查看文件“DekaronServer.exe”是否存在3 R$ m, `' @: d7 T1 n. o, F
  15.         if(_access("DekaronServer.exe", 0) == -1)
    7 ^/ x, ]- `0 n# r9 X
  16.         {: x! I! V0 A2 V# {
  17.                 printf("DekaronServer.exe not found!\n");
    6 a5 Q2 n1 I6 F! b" o2 Y/ A
  18.                 printf("Program will close in 5seconds\n");- R$ [5 K4 s# H: a0 e& t1 W
  19.                 Sleep(5000);
    9 o9 z0 X) q7 h' W7 m( P' g# A8 B+ j. r
  20.         }
    7 c8 b% z( F" w4 C& g  ?# Y
  21.         else, f/ e) I7 \( h% Z
  22.         {
    6 n+ U- `4 Q; u6 ^* U& O8 _; b
  23.                 3 _1 P' W* S" ~! H( `) X  F' m1 t
  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) y4 F" T/ {" R9 K( c: u7 S& H
  25.                 STARTUPINFO si;
    & J0 W% |& i3 W1 M

  26. 7 _# i, n1 k: F6 W
  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$ Q$ ^% I# F7 O, R& v+ V( q
  28.                 PROCESS_INFORMATION pi;
    ) y% |3 y  @; g. h7 R

  29. 1 S2 C5 Z( i( g" F$ p% j# Q* T
  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
    3 [0 h) C* `/ t. d$ c! @
  31.                 DEBUG_EVENT dbge;
    ' H/ a1 H: d1 X6 [9 E6 a! X

  32. 7 V6 J) l" f- \4 R- H1 e/ ~
  33.                 //Commandline that will used at CreateProcess" F9 a3 v3 W, a  N1 M4 ]
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    3 @1 \6 j  ]" S" w0 L2 j! A

  35. 9 }  x! {* e2 z( T+ M: h
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    3 N; @9 A, ^* C& g. e$ C! ~6 d
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    0 W3 }7 B0 q! g- c
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)  |0 S/ R% w" c6 W8 Z  U! C7 c

  39. 4 g% u% S, @0 I  {0 a# l. r; O9 n

  40. 6 V' w9 y) R  G. h, \) h0 }

  41. & J- Q8 h. A6 |+ V% W7 T3 z- v
  42.                 //Start DekaronServer.exe ; T+ n7 h/ P5 m/ {& @+ C
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    & F1 Z: E( u! W; o! {
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)5 k; X( @% m* a2 c5 n: f# ~5 N
  45.                         szCmdline,        // Command line
    - R# H1 C, c- N5 u' }
  46.                         NULL,           // Process handle not inheritable4 m- V2 |# n$ j% {" K
  47.                         NULL,           // Thread handle not inheritable5 X1 k. w2 g- z0 _6 K2 o
  48.                         FALSE,          // Set handle inheritance to FALSE8 f+ [1 \, u6 U. [
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    ! L. Q% r! x) z; U5 W- m$ e7 b- I6 b- s
  50.                         NULL,           // Use parent's environment block
    9 `; \# R0 k% x
  51.                         NULL,           // Use parent's starting directory
    # `0 F& T( o' W! t' }3 [  R
  52.                         &si,            // Pointer to STARTUPINFO structure
    ; s: D( O5 S0 p; O6 b" a% O9 U3 _+ W
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    4 w- M- e: G( L& H) W
  54.                 ) 9 [3 J+ [8 D) x
  55.                 {% \" q3 q9 N0 r
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    / \2 A% Z" a% Z" v! ?) v% B- _0 d
  57.                         return 0;
    . z3 j; L, z6 r
  58.                 }
    : M# z# ]- T6 e4 O! }! ?# b
  59.                 //Creating Process was sucessful9 C, H) f. F2 N' f- G
  60.                 else7 i+ R! u2 T& K9 e
  61.                 {
    " W5 V/ e& J% K0 `& s( {$ d
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    ' f( G+ P  @$ v% u* Y
  63. ) c" x$ S% }3 @. j( J1 d5 u4 y- `
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure8 s7 |/ ~& S) p$ b- M
  65.                         dbge.dwProcessId = pi.dwProcessId;
    , P& @3 c9 c  D5 K/ @/ [
  66.                         dbge.dwProcessId = pi.dwThreadId;
    8 w' `' n$ _- n: q

  67. 6 F) a$ ^/ Z& Y9 u
  68.                         while(true) //infinite loop ("Debugger")
    " I- e, y3 c. O, a" A! z1 ~" S8 j
  69.                         {
    . {/ T/ F" {3 K" o* U: g4 M
  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' r. P7 `4 l' R4 y$ k

  71. * R+ E) \% Q3 J& n
  72.                                 /*) `1 P8 B( _0 B5 F9 n
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
/ T6 u, A5 y/ r! S$ k8 O% {1 m

* Q: @1 V' _( B- ^1 ^% B( w$ F" ]& A
商业服务端 登录器 网站 出售

15

主题

256

回帖

1250

积分

金牌会员

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

主题

256

回帖

1250

积分

金牌会员

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

3

主题

102

回帖

6201

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-30 10:43 , Processed in 0.070495 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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