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

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

[复制链接]

154

主题

343

回帖

5846

积分

管理员

积分
5846
金钱
1835
贡献
3514
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)   c/ [# w0 H) Z' W
' t$ K5 E' I3 J6 w
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
4 w. }9 n+ R6 Z7 G+ A$ |! q
: c! K1 U5 n' i' X- ^2 l
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。, m% f* T; L: R+ S
  2. //5 C% O2 m' @( S* D1 @7 R

  3. $ p+ {3 u- z/ s/ o( J
  4. #include "stdafx.h"
    ! ]% Y2 W2 K( F( T% u* b6 {
  5. #include <iostream>" u4 o% X( R6 h# V' |0 A9 O! R
  6. #include <Windows.h>& y! v/ y; D: X7 g, A8 t. F
  7. #include <io.h>
    2 `4 t# R- s* j6 y; G

  8. - q. ]5 H7 a& B; q

  9. . y& |6 y# J# K8 F2 z
  10. int _tmain(int argc, _TCHAR* argv[])
    ! C2 M# P' S: r  k/ t3 b
  11. {9 S: x! ^# T1 g. c  X; f/ l
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    ! ^0 [  x7 X8 _" y6 u

  13. * R6 A( B# @- u' s$ M
  14.         //查看文件“DekaronServer.exe”是否存在1 S8 ~  X1 L$ ~/ g8 N7 `  A
  15.         if(_access("DekaronServer.exe", 0) == -1)
    5 T1 I* d- \. K- y
  16.         {
    ; B4 \/ n, e( ~4 X3 K, z
  17.                 printf("DekaronServer.exe not found!\n");
      A1 o+ Q. }% z" [: t0 D! `
  18.                 printf("Program will close in 5seconds\n");4 ~2 y$ ^& `: t9 e
  19.                 Sleep(5000);
    0 z/ u3 P/ W( ^
  20.         }9 T4 z4 `$ r1 Q1 S' q9 G$ I# G
  21.         else6 s) D- g# Q4 A% e3 T
  22.         {
    1 {$ w- p1 _6 h; q' p% y
  23.                 8 c" M: O' l7 M2 M3 J$ a, P' W' 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
    . c) \. ?' y! v/ [% G
  25.                 STARTUPINFO si;4 ~: k4 r0 `$ [: n

  26. 6 k3 W2 x" z, T8 o; n
  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" J9 {7 i4 E7 ~( Y' [
  28.                 PROCESS_INFORMATION pi;
    2 s- S& A& b9 {. n* l

  29. - Y- i7 c2 w. o& Q% f3 Z
  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
    7 _4 L1 T  x/ S, h4 _# ]! C! x
  31.                 DEBUG_EVENT dbge;! |) }- z- ^, k) w
  32. 5 l) R, \* t1 p4 u  J
  33.                 //Commandline that will used at CreateProcess
    ' d- [% `" Z* `( J
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    7 d5 z0 R% l" C) d+ c* b7 p% u: {
  35. 8 i/ ^) c( p, j$ e; Z" ~! l
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    # t0 m+ c, y8 J/ }
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)( h' I" W2 v# n- z. ^4 z* d# P
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    6 U8 P, C/ t5 p, l
  39. ! P) L; `! d5 u" O2 p) N
  40. # Z# W- ^* f0 A9 v, ?) H5 @7 A
  41. 2 r# @- v% q! g8 }
  42.                 //Start DekaronServer.exe
    2 Z+ R9 |) \+ _7 Y7 Q7 ]
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx) M, Q; i% K$ k
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    , @# E( W6 x5 @# G" w$ M% H
  45.                         szCmdline,        // Command line
    1 {, E9 C" g% W7 }: ~
  46.                         NULL,           // Process handle not inheritable3 K! O8 ]4 x/ i) x( Z( ]/ N; f
  47.                         NULL,           // Thread handle not inheritable7 z3 ~$ ~) J: F, d
  48.                         FALSE,          // Set handle inheritance to FALSE
    1 N6 j4 g1 [% E3 Q! a( ^0 g  J
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    : N4 a' b* d4 z7 g4 z
  50.                         NULL,           // Use parent's environment block, j6 M' q& ]2 P# o1 o
  51.                         NULL,           // Use parent's starting directory
    : B8 P, m; f; l+ l! v# V
  52.                         &si,            // Pointer to STARTUPINFO structure5 c' k' b, {0 r+ j" G9 |
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    . e8 U6 Z8 |2 @! d" [
  54.                 )
    9 `/ ~: l" R7 O
  55.                 {
    : m; E- V/ R' N
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    $ m% ~3 {: A, d8 E
  57.                         return 0;
    # e2 X7 ]. ]" h% t
  58.                 }
    , ~; R+ u# ^! T, |6 F0 {" r/ J
  59.                 //Creating Process was sucessful$ i0 t' q2 m& h/ b
  60.                 else8 Z5 D8 d8 ?- b  L: t) j
  61.                 {
    * B' I7 R* K( ?; h2 J$ H, c9 I
  62.                         printf("Sucessfully launched DekaronServer.exe\n");! h9 F. r' A1 N- `- m0 ?- P% e- c

  63. ; u0 B  n9 z7 n5 _0 r
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure4 d: H- B- J0 r: c  N
  65.                         dbge.dwProcessId = pi.dwProcessId;
    9 h# P* Z  F& @! j# Z7 ~
  66.                         dbge.dwProcessId = pi.dwThreadId;$ p) Q% E2 S3 p$ [/ f. T/ N
  67. $ M3 }. G2 i  o: U& a0 ]
  68.                         while(true) //infinite loop ("Debugger")' N; }/ V. i8 e7 Z5 _* z8 k
  69.                         {
    ! `% U, W  {0 z, F5 @
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    / G% d5 f1 {- t% |# |
  71. 2 u, ^: T0 M  v7 M8 |- }2 s
  72.                                 /** w  B2 I9 Y8 O: t+ f0 z' r& I( g
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
0 S8 A5 q! T1 `4 o- {

& G6 _& r- Z0 ^7 u7 Z7 m7 S4 f
% C: T) ?% i  t, z. z: n
商业服务端 登录器 网站 出售

13

主题

251

回帖

1249

积分

金牌会员

积分
1249
金钱
796
贡献
184
注册时间
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

回帖

1249

积分

金牌会员

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

3

主题

99

回帖

5373

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-10 13:38 , Processed in 0.079124 second(s), 26 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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