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

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

[复制链接]

158

主题

372

回帖

7207

积分

管理员

积分
7207
金钱
2084
贡献
4593
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
+ R# |  u5 U4 v) Y# k1 R& t6 L% i
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
% C4 _/ l; r  P' h* ^& i. K- }" E0 |7 z" q* y
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。4 ~; F; y( `: U/ u5 r1 Y$ l) t
  2. //
    + q3 p' i% O! |& j3 F0 V, o

  3. 5 S! K# L( e  _0 u/ P
  4. #include "stdafx.h"0 m- U# P1 c  O# ]
  5. #include <iostream>
    7 T& w- A0 p/ d3 s
  6. #include <Windows.h>
    - j! y8 R% q" g5 l
  7. #include <io.h>
    , y$ O( }0 \0 e5 N" r+ K
  8. " q' r( e  X9 f& W0 R2 E2 ?  s

  9. 6 W# M+ D7 Z8 c
  10. int _tmain(int argc, _TCHAR* argv[])  G( f) C8 v  W, }# ^1 w0 b
  11. {' U" l9 N8 c4 \7 n4 H" k) ^
  12.         printf("Dekaron-Server Launcher by Toasty\n");& h) g( H- k  ^1 ~- o6 D# f

  13. 1 y( }7 ~$ `3 {* `% ~
  14.         //查看文件“DekaronServer.exe”是否存在/ n( q- u% b! w
  15.         if(_access("DekaronServer.exe", 0) == -1)  g) U8 y" N, p" U" i% U1 e
  16.         {  X. V# S! G8 w  ]/ y" p6 t
  17.                 printf("DekaronServer.exe not found!\n");' R5 C% u6 \+ K# o5 B
  18.                 printf("Program will close in 5seconds\n");
    " Z) a  A2 c' l
  19.                 Sleep(5000);
    ! u* o; x* |  R, y
  20.         }
    * w: A; w. v+ @
  21.         else# N+ i- T0 C1 k; V9 `
  22.         {
    / c% Z4 g5 D8 |/ W9 K+ W
  23.                
    / ?2 Q3 t9 ?3 @; Z4 S- a, f5 N3 X
  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: Q; B5 H* H% j* U3 n9 e) A
  25.                 STARTUPINFO si;
    % r2 w1 y( m* s  u& Q% Z
  26. , i0 |  N9 |/ e/ f
  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 U) H9 _* Z# d$ I- r& a
  28.                 PROCESS_INFORMATION pi;
    % D9 ~" X8 o! K2 g; d4 Y  D0 `0 Z( d1 r
  29. ! C& ^& i+ I( B3 c( o
  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$ T5 \! B' N# z' `
  31.                 DEBUG_EVENT dbge;/ S; W* h7 v+ [2 L4 O( [% k

  32. # }- j) ~# M6 I$ L
  33.                 //Commandline that will used at CreateProcess; C6 x% n  h! z% `' t+ X
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    4 A( J6 @8 a2 v" W0 a

  35. / O( `: ~2 b: F* u0 h
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    ! r- a6 z( M) O9 v% R) W( S
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)5 n5 `! Z1 t. l( K/ L
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    2 ]! b; K! A; d1 q
  39. % J2 e6 k  y/ a1 u6 d1 k% S) m

  40. : u1 D0 d$ M+ y: [* x5 z8 L
  41. + b  L: g. M$ g+ t
  42.                 //Start DekaronServer.exe 8 u' V: ~# a; x$ W9 ^
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx' P- ~- z8 S: y% ?6 m
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)" l8 H* j1 \6 o( ]3 L6 }0 v6 A
  45.                         szCmdline,        // Command line, _1 I2 r/ r4 `' v; q# b8 o  ]3 W
  46.                         NULL,           // Process handle not inheritable
    * a  i: @% d6 \+ ~) ?8 w
  47.                         NULL,           // Thread handle not inheritable
    * B! }7 U2 a% C  A2 p
  48.                         FALSE,          // Set handle inheritance to FALSE( f+ K4 k' l- g0 i( z7 f$ q
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    7 N9 J) V" b9 P$ \) a
  50.                         NULL,           // Use parent's environment block2 Z  H6 G6 J  L( ~  X
  51.                         NULL,           // Use parent's starting directory $ j5 T6 V+ _5 E3 }# n# R
  52.                         &si,            // Pointer to STARTUPINFO structure
    ; l. X5 u" ~3 R  j% e! \; R. I" j6 u
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    " M  N; n9 ~* |4 r
  54.                 ) & v! g4 ]' v$ {- {5 |% s6 ]
  55.                 {1 L: N; Z% p5 ?2 w
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );( ?* s! c; c" i5 i1 t; b
  57.                         return 0;
    ; k! u$ o2 E" c( D$ O0 O1 H
  58.                 }
    5 t6 V' J3 J1 R: P
  59.                 //Creating Process was sucessful
    : R6 x3 d- |& g7 ]& Y
  60.                 else0 n" C1 [; f% A/ q
  61.                 {+ d9 B8 U  E2 w% _- C6 n
  62.                         printf("Sucessfully launched DekaronServer.exe\n");* o) Y6 M0 h  c) m' z6 `* L7 w0 {
  63. ; o* F6 ?" v$ d4 @
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    - I. V0 V$ P8 o
  65.                         dbge.dwProcessId = pi.dwProcessId;8 Q6 S# C: w& W* a$ y! ?
  66.                         dbge.dwProcessId = pi.dwThreadId;' Q' x( v$ p2 V
  67. 8 O% ^8 t+ F) d  k; f; G5 S
  68.                         while(true) //infinite loop ("Debugger")) T, y- y  F% W
  69.                         {4 Q0 U% M* |# O  S' d" b# V
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    * i: [% j* w2 `" _

  71. - A, e1 l* K7 u) P' m. t5 Y
  72.                                 /*
    : j0 y% V/ t9 N
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
$ t5 c  ]1 T- Z/ I% p- d( Z
# S& {& w* l. T( f
! g7 y9 \* b9 A# P) D6 o$ g
商业服务端 登录器 网站 出售

15

主题

258

回帖

1254

积分

金牌会员

积分
1254
金钱
909
贡献
67
注册时间
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

主题

258

回帖

1254

积分

金牌会员

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

3

主题

102

回帖

7517

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-12 11:58 , Processed in 0.035460 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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