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

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

[复制链接]

161

主题

389

回帖

7509

积分

管理员

积分
7509
金钱
2167
贡献
4792
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) ; P! T$ i2 @  Y+ V! w( J

$ D: y! \0 o( r" M0 p' w" {5 O# @虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
8 F5 Z- g/ x! `3 ?" m, y7 S5 k2 f; K
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。* ^1 C7 w) k$ a8 Y. K
  2. //
    : `5 `( x3 G1 S4 s

  3. ! y! P6 x6 y' k9 D
  4. #include "stdafx.h"! d3 b. S2 J( }1 ^! Q4 D" u
  5. #include <iostream>
    $ f1 a3 C8 R" H7 V  c$ D
  6. #include <Windows.h>9 A( h5 f+ C1 ?$ G
  7. #include <io.h>( j# u" z: _' L7 j7 N
  8. 4 n0 o9 G# w3 ]- t# B2 }5 H! [
  9. - @( g: u  ?7 }  k6 M1 B# `
  10. int _tmain(int argc, _TCHAR* argv[])
    9 Y4 y3 S+ |3 S% l7 J" c% f
  11. {" t; ]+ \" q! z5 p) x" c% E' F
  12.         printf("Dekaron-Server Launcher by Toasty\n");: H! }" }+ n) q+ y
  13. , ^1 k( l, V& q9 J% h4 O
  14.         //查看文件“DekaronServer.exe”是否存在
    . p0 j9 Y3 a8 x& G' F
  15.         if(_access("DekaronServer.exe", 0) == -1)  j9 N: g8 G0 D7 k
  16.         {- R3 o$ g; F  u+ c
  17.                 printf("DekaronServer.exe not found!\n");
    6 R( t  [* v- Q
  18.                 printf("Program will close in 5seconds\n");
    9 D2 j% A' I% W3 Y: G% a
  19.                 Sleep(5000);
    8 O4 n3 R6 ?% {! G! L
  20.         }  o- `8 n  Z( p- G  L) v" E& M
  21.         else$ d4 r) a5 [2 H- f( \
  22.         {, [. X3 S( S: z( k9 ]# s
  23.                 + T! _8 s- T( o) Z
  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 C6 ]) h( w4 d
  25.                 STARTUPINFO si;7 O& ]2 {& L# c/ p

  26. ! g1 m( ~0 b& `/ M) k
  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
    7 b* v  G* s# [4 T
  28.                 PROCESS_INFORMATION pi;
    . C' M4 y; q; y1 C( N
  29. ( n7 K) [9 V- P# n3 H
  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) P9 w( }8 x3 D; Q. q. ]
  31.                 DEBUG_EVENT dbge;
    6 y4 `) L9 P' @" u) q8 y$ ^  d: M
  32. * t5 N2 f- w& n! o8 D
  33.                 //Commandline that will used at CreateProcess
    ( {- j( p0 W/ L! X% X2 [
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));$ Y2 a, [+ R+ g% G7 Z
  35. & d# d- V$ Z# ^$ y" M; G6 t
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)$ V6 ~# g( h( a* k: O: u9 z* m* `) y
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)4 k4 y" u8 N3 [5 b% }6 ]- u
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)9 O$ A: n' d* R6 \3 s, b! m
  39. 7 h! H6 M4 I4 d3 F1 C1 s; y

  40. * l0 R: U/ y; u  [
  41. # X+ n. I: H4 j' t% U4 `
  42.                 //Start DekaronServer.exe
    $ `0 H5 t$ {/ u. W" J9 y
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx! ?& S. }+ S- G" R( ?1 u! u9 ^2 V
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    ! ]2 v/ M3 X4 p4 e; k
  45.                         szCmdline,        // Command line% ^* M; P$ {) n- l
  46.                         NULL,           // Process handle not inheritable
    8 M! [9 S' j$ ?; J. X
  47.                         NULL,           // Thread handle not inheritable
    4 f5 R- N# r$ u+ I2 i' s, r) Q) N
  48.                         FALSE,          // Set handle inheritance to FALSE
    - h; j) ?! N/ W" S
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx6 }% W% N% o6 m$ p& G' R! L& \; X
  50.                         NULL,           // Use parent's environment block
    ; ]: ]$ |. w* p! v
  51.                         NULL,           // Use parent's starting directory ! O5 r2 S* X( _
  52.                         &si,            // Pointer to STARTUPINFO structure. g3 g# G  r  ?; R+ {) m
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    $ j# X  T4 y5 h2 P' P
  54.                 ) 6 t- S  s+ C( F
  55.                 {
    9 j$ e3 d6 k  J
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );& V* Q2 P! e2 t0 }5 l, v
  57.                         return 0;8 I0 e) a" g7 P* ^5 U2 S8 j
  58.                 }7 W0 e( ?- S- B8 p
  59.                 //Creating Process was sucessful
    8 `) \* P* U! p* K1 v  ~; ]
  60.                 else
    1 {' m; }" ]/ S! g1 W+ P( {) U
  61.                 {2 e6 `% }3 w0 `
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    . G0 D5 l" r5 _0 G: ]# K

  63. 2 K8 L8 b- b( v/ A
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    ' U2 x2 S% G* z0 K: c8 E9 ^( ?# q' K
  65.                         dbge.dwProcessId = pi.dwProcessId;2 b) A9 f7 L$ F7 \  D; D& k- M0 {
  66.                         dbge.dwProcessId = pi.dwThreadId;+ J( O8 i+ {# _5 X& v
  67. * \/ ~+ E5 D+ K7 p1 d5 |
  68.                         while(true) //infinite loop ("Debugger"). n2 t$ {" r: o/ X& I
  69.                         {3 G- V" G3 |3 c
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx7 K! q4 T$ A3 a% t( f9 Y2 m) _: n5 g
  71. 3 t5 n2 T9 o# G0 A
  72.                                 /*/ k6 j" K$ P. [# p9 s+ f
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
8 [& E0 G1 O# j& |

( S3 G) ], {) F) Z' a( c/ V- \
* L3 S! P% W9 R
商业服务端 登录器 网站 出售

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

回帖

8257

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-5-18 18:25 , Processed in 0.043557 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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