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

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

[复制链接]

155

主题

348

回帖

5989

积分

管理员

积分
5989
金钱
1864
贡献
3622
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) ) @2 P$ F/ n/ r: f

) C* `( i( u( c虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
1 ]( K) p$ R4 Z) h, [3 q
5 B) p2 {! q+ }8 q0 I: Z
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    ! F# V4 G) g5 k+ _; m. v* A
  2. //
    6 @( U( K. N1 r# \. O- W' X+ c
  3. 3 T' E# H/ l5 J  I
  4. #include "stdafx.h"
    ' K6 L. E/ J" m. z% b0 a* J' z. _
  5. #include <iostream>% `, M3 }# O" J8 b1 W+ t9 o
  6. #include <Windows.h>3 `# ~0 D  g' {
  7. #include <io.h>
    * Q, S& B$ ]! w) o( @

  8. # j6 C( s3 R* g8 j8 Z" @

  9. $ |" l4 \! m/ h4 [) Z1 v% C
  10. int _tmain(int argc, _TCHAR* argv[])
    ( F! o* R( ~2 s
  11. {0 ]7 _/ o& E( B7 ]3 y
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    8 ]4 f% Z: {* q! O( r: Z: _. U
  13. ; h( [' I) B) w# Y: s& u- o9 M% J
  14.         //查看文件“DekaronServer.exe”是否存在% F' n& P( f5 `& |' M3 D; k
  15.         if(_access("DekaronServer.exe", 0) == -1)
    % W& R9 E3 b3 g* i, D; }
  16.         {$ H4 \7 I* q1 }8 E
  17.                 printf("DekaronServer.exe not found!\n");$ g" A+ p( c9 Z' p+ m4 Y
  18.                 printf("Program will close in 5seconds\n");! q! M$ P/ G; H: D, r
  19.                 Sleep(5000);! Q8 O& t% p& |+ S
  20.         }' V0 v9 a7 I! X! v- [, B5 {4 w
  21.         else
    1 G* D. E3 L) }. W, T2 P
  22.         {) I1 ]8 Q- i  m$ s
  23.                 - V" ?3 o" I/ b2 M: U% [
  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$ K1 d. o  o" Y- f
  25.                 STARTUPINFO si;
    , t( D- g* _# A. i! _
  26. 3 H* v( P/ R- m. x3 j
  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' N' l* T  j2 a$ w3 z# M+ b% e5 j
  28.                 PROCESS_INFORMATION pi;
    & G' n4 T6 W* p3 ^8 u

  29. * G# P% T; o/ b
  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).aspx3 c% E2 S6 S1 h; e6 X6 v% G
  31.                 DEBUG_EVENT dbge;
    - F) L: v/ S7 I) @& q5 g
  32. " \0 h6 z$ S2 ]- p5 g# h# P2 a1 F
  33.                 //Commandline that will used at CreateProcess7 C2 X, @/ E* p- l# N3 v
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));! f5 a+ @  f6 ~0 H3 T% w, ~
  35. : K& ^& E- \+ g
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)! p- a2 Z+ \, y# I8 \
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    * ]5 ~& [: u9 B' ]; V& Q  W7 a* k, W
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    4 F% D8 R$ h+ S+ X

  39. 0 X9 I, `4 E- s5 y

  40.   [5 Q) t) q/ h) T8 N2 M

  41. ( v9 E( c4 v' W
  42.                 //Start DekaronServer.exe 9 Y. G0 V+ o: h/ K; G3 Q
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    - E& D  J4 \* R3 {  z
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    : I. {, h) P& S- G. G5 T. Z; u
  45.                         szCmdline,        // Command line/ t4 s% K3 K% {4 ]8 E/ ]6 s7 i0 x
  46.                         NULL,           // Process handle not inheritable& Q( q& Z7 S. m1 P% N
  47.                         NULL,           // Thread handle not inheritable( D$ l( U; I' J% d) m
  48.                         FALSE,          // Set handle inheritance to FALSE
    3 H4 N9 A7 ^* f, ^
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx! L# K/ Y. Q+ R. j6 q
  50.                         NULL,           // Use parent's environment block
    ( M1 E/ N# v6 A  y+ J; o9 ?
  51.                         NULL,           // Use parent's starting directory ( |# {- u, `# W. S
  52.                         &si,            // Pointer to STARTUPINFO structure
    9 u) P- G. g) f$ Z
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    5 \" A( a* @$ }- S* L, T* a
  54.                 ) % A( ?4 H4 }4 W: B  Z' K
  55.                 {
    1 p8 M8 z) h' F, S+ t7 a) t
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    5 [- ~3 n/ ?- X4 R* Q( U
  57.                         return 0;
    2 g' E  O6 f' G: L
  58.                 }3 g; c  d3 u* C# v$ w: T; W
  59.                 //Creating Process was sucessful
    $ E" x! A! Z- S$ U: V/ V8 b6 ~. \
  60.                 else
    : F, [/ B2 {  a* Y" N) W5 u( R+ |
  61.                 {
    5 l4 G; d5 A, M! D: c% k
  62.                         printf("Sucessfully launched DekaronServer.exe\n");* A! ?( n, `, v( Y
  63. 1 m. s/ G( W) b" Q# p  S3 v
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    8 g0 ^  t- F% ~8 `
  65.                         dbge.dwProcessId = pi.dwProcessId;
    $ g) A8 Y1 ~3 t3 [. {4 Z, C& i
  66.                         dbge.dwProcessId = pi.dwThreadId;
    8 l; {9 N7 f  M3 b- y8 N" V7 G# H
  67. 5 A( z- I1 e9 J3 P
  68.                         while(true) //infinite loop ("Debugger")0 _5 o8 _1 e- j2 y, u$ X! _; i. \- r
  69.                         {
    1 ]5 [) L+ ^8 }/ U3 U. p- g1 d
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    3 l: O4 e8 \* l8 v5 t
  71. 9 l3 d0 }  `8 x
  72.                                 /*
    ' W. _! Y% ?( t1 i4 e# m
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
4 ]+ j! J6 j* g+ p4 k
$ K. Y& [2 M9 w, `- g  l
, R/ `9 x0 F; c' K' j
商业服务端 登录器 网站 出售

13

主题

251

回帖

1242

积分

金牌会员

积分
1242
金钱
814
贡献
159
注册时间
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

回帖

1242

积分

金牌会员

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

3

主题

100

回帖

5713

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-30 19:45 , Processed in 0.082323 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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