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

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

[复制链接]

156

主题

354

回帖

6558

积分

管理员

积分
6558
金钱
1910
贡献
4138
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
# |% f' i' w8 R& W$ D$ G! F# ~+ T- J% l: q, J
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。  x) N& U( g9 K, p9 }

9 J, o! r) F' k) I% b
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。4 e6 j) M4 P& q
  2. //
    2 E; K4 b) h) _; `1 e& W% K
  3. . s& K4 t1 i5 u7 m( y- v6 V3 A
  4. #include "stdafx.h"# }+ R5 M; U6 v6 s3 s6 d+ W
  5. #include <iostream>% u+ H7 \7 P. A. C; x) L! p
  6. #include <Windows.h>9 R/ y1 O9 a4 q
  7. #include <io.h>) `3 `  X! d0 f+ k4 A9 _) V+ Z

  8. + a$ p# ?3 u3 ^' K5 h) S- ^. D0 ~  _
  9. * C2 J; s9 t( \+ I2 R% }! Q, v" e% I: ?2 J
  10. int _tmain(int argc, _TCHAR* argv[])
    3 p1 ^2 h  a6 v9 @$ m; b
  11. {
    # W6 t2 C$ x6 S( I! o
  12.         printf("Dekaron-Server Launcher by Toasty\n");/ k$ [- `( I% Q. _0 a
  13. ; j) Y! R+ l, ~# Z: q) f, ^* O
  14.         //查看文件“DekaronServer.exe”是否存在
    - f+ k# P: H) P) m! J8 T3 K
  15.         if(_access("DekaronServer.exe", 0) == -1)/ t( l) A* X9 [0 g9 c9 W
  16.         {4 Z) O) }5 L5 d! s- b  F7 e2 i' v* X
  17.                 printf("DekaronServer.exe not found!\n");
    ) h, a) O+ p$ J4 w3 t3 }
  18.                 printf("Program will close in 5seconds\n");7 w& g7 f! i- z+ D; P! l
  19.                 Sleep(5000);
    * y. S, s7 S8 F. J
  20.         }9 h' _5 @- n2 g; K6 p
  21.         else6 H. @  g1 h- U0 w
  22.         {
    ( p/ T" X; i1 B# @; e
  23.                 0 l% D1 t$ J: I' q7 j1 d- d
  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; T( C+ p/ Q0 L' \
  25.                 STARTUPINFO si;
    6 I/ i  O; N$ R3 y( U
  26. ) _7 p0 d* K! o9 r" a3 R
  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
    : y4 w4 P9 \2 N, h
  28.                 PROCESS_INFORMATION pi;
    & j) U6 u1 k( g' |* S- J
  29. % Q+ \7 ~6 `7 ?- D3 b/ C( 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
    ' j; Q3 H  D5 z  R2 j0 j
  31.                 DEBUG_EVENT dbge;
    / @# T" G$ K9 h# J9 }- G! f

  32. ) c  W9 A- l1 `' f+ x
  33.                 //Commandline that will used at CreateProcess
    3 d. q- B" R( k3 K$ }3 f0 ^6 G
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
      z) i- l9 i% v) q$ x4 k8 l; Q
  35. ) N/ F& I) I3 S/ @3 ~
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made), u# [( u1 U* s% |; X' X
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn): B* G5 k3 Z* X
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    & P0 j0 t$ x0 K; l

  39. % w- z- a, N2 f3 e
  40. 2 Y/ X+ Z* Z( x1 U1 ~# L1 `
  41. 1 \7 p. o. c- M
  42.                 //Start DekaronServer.exe ; U7 z' R0 H1 d0 W
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx- n% @0 A7 \! g$ e) q$ d
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    1 c1 c+ V$ k  i6 |0 _
  45.                         szCmdline,        // Command line0 r! n; }% y. z: |
  46.                         NULL,           // Process handle not inheritable
    3 R8 v3 ^5 I) v: {
  47.                         NULL,           // Thread handle not inheritable
    $ n- Q$ `0 m4 Y+ |. L8 M
  48.                         FALSE,          // Set handle inheritance to FALSE
    5 k1 ?3 @3 E. U/ a5 |
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx  P& ~: O3 B4 I7 {9 q& l( e
  50.                         NULL,           // Use parent's environment block7 a" z% I% s9 B% A, W" Z; V
  51.                         NULL,           // Use parent's starting directory
    - T+ ~. v, J) K. s
  52.                         &si,            // Pointer to STARTUPINFO structure. x# `2 l3 A7 T( I
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    & x9 x  B8 [4 o) M
  54.                 )
    + u0 y$ b  F/ `
  55.                 {% y% W' `& ~* K5 Q0 S
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    2 a, z  l( a0 S6 q' f
  57.                         return 0;
    " a, k  F# C0 }1 t4 V6 B
  58.                 }: q& q+ |1 g' V8 u6 _  M/ z7 r
  59.                 //Creating Process was sucessful$ o8 T+ T: S0 Z0 I6 U* ]
  60.                 else
    3 Z8 y1 m6 c2 ^2 k& i$ ]
  61.                 {
      `3 x, ~: q; @7 [& r5 K
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    ( x1 F- A+ \* o+ S+ i' f
  63. 0 p  x2 A' O# B. N6 l8 i) H! a
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    " w) i+ y) _( y; M9 z, j% c
  65.                         dbge.dwProcessId = pi.dwProcessId;
    + r& }7 q  ?* D- H
  66.                         dbge.dwProcessId = pi.dwThreadId;- P2 a% A8 q+ e( ]9 u) F
  67. 4 A! q1 {* m8 f: [9 @* L
  68.                         while(true) //infinite loop ("Debugger")
    0 e9 i+ u  P1 o4 e+ Z9 d- ~/ d
  69.                         {- |" o0 a8 n( f5 z6 n  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. x& r" X; q- x5 u' G0 k

  71. 3 R6 c* m% {1 @: {( n; Y9 i9 @
  72.                                 /*
    ; [3 q+ @1 D( f3 u. F4 y4 m2 X
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

+ X0 U1 H4 ]: P1 L+ d7 v: u" C+ ~
8 o4 m- Y1 B# K1 t$ y% A9 [8 j6 E+ \* U& l/ o" n
商业服务端 登录器 网站 出售

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

回帖

6161

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-28 10:05 , Processed in 0.069323 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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