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

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

[复制链接]

157

主题

364

回帖

6930

积分

管理员

积分
6930
金钱
1966
贡献
4443
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
  K3 J" E6 {8 p! k! |( C: X# k1 S7 F  f' e: @- k  B( ~& ]8 ~4 G
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
% k1 O3 i0 k" I1 E7 J
1 q4 S) L. B. x* `7 E
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。* e; r- G- ^4 j& C$ E& Z- J
  2. //
    3 Z, F8 V# [4 k- k4 G+ g- n) f

  3. , ]) x' R, u1 T
  4. #include "stdafx.h"
    9 s; T4 P1 x' P- e
  5. #include <iostream>% R8 Q8 S+ C) }5 z& Y$ e
  6. #include <Windows.h>
    * G% Y# V+ o5 S5 _* x' v, c
  7. #include <io.h>
    - D* {/ p9 H7 j* D, P
  8. / C/ L! n# p6 U7 ]" e- N! K$ p

  9. $ ^2 }3 B" K- B! Y
  10. int _tmain(int argc, _TCHAR* argv[])
    " @" U' G) L6 @0 P& e( E, O1 r
  11. {0 G' V7 W) O; ~% d/ B7 f& U% U( ]7 n+ Q
  12.         printf("Dekaron-Server Launcher by Toasty\n");# a$ P2 U, y4 m9 y8 P+ z  B  I. l
  13. 8 ~, q/ {6 z5 e" q- F# @
  14.         //查看文件“DekaronServer.exe”是否存在
    5 ]" K# F" l1 u' V- ^
  15.         if(_access("DekaronServer.exe", 0) == -1)
    5 @8 ^# k3 d: p6 y% J3 E* I2 f8 H
  16.         {
    2 ~( c6 J5 N' m- B3 V3 G
  17.                 printf("DekaronServer.exe not found!\n");
    # ?( T+ Z2 T( R! g8 q2 s
  18.                 printf("Program will close in 5seconds\n");7 v7 @1 ^! g( N. M8 A
  19.                 Sleep(5000);
    " r( f4 m* f8 z& N4 \  V
  20.         }9 s9 Z, E- i  R2 {
  21.         else0 X+ c4 l% N  C+ n6 u+ v  a
  22.         {3 g' I: z& j2 u+ H" {! N
  23.                
    9 Y. [0 B8 g' \1 z( A# ^' `1 G, m$ `
  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
    : L. Y; l) o0 k7 c
  25.                 STARTUPINFO si;7 G" ~: U. S9 V! v" G6 Q
  26. 2 }$ D/ w8 k* n% J# T, 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; e, S3 O6 N9 f, m
  28.                 PROCESS_INFORMATION pi;
    , N9 Y+ C' n, n# _* U/ R- o7 T
  29. % ]- [9 V( `; d( V
  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
    / h) ?7 I" v, r9 A. C
  31.                 DEBUG_EVENT dbge;. Y# ^, T, z/ U7 N1 E& Z/ k, ]- U

  32. # P& M; Z( P' ]2 O2 v
  33.                 //Commandline that will used at CreateProcess
    1 ]5 ]: E; A' p. Y% ]0 [' |, |9 u* b
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));: [3 q) _  g+ R/ ]$ q

  35. % ^. i' b  u/ x6 [/ c/ P9 N* n
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    ' G+ H4 N* v& e
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    1 E. f3 R0 z4 N- u7 ~
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)6 e! Y* u2 j# u9 W
  39. 8 R6 N3 ~- E, e( l9 D7 D) V
  40. / p  t4 s" t) L( e- M, w) F, }
  41. # w, y: J( Z0 v0 E
  42.                 //Start DekaronServer.exe
    3 g: n0 c/ X) Z4 d5 Y6 ~
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    : I, z- e/ p/ E
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    + z# L, N3 x- [/ ^" M7 d
  45.                         szCmdline,        // Command line
    ) T) S& W  {' K* S, R
  46.                         NULL,           // Process handle not inheritable2 }9 }2 B" M' J: y4 D" L
  47.                         NULL,           // Thread handle not inheritable
      z5 ~7 Y+ p' T# p# a& g* @
  48.                         FALSE,          // Set handle inheritance to FALSE. H4 o) r( G7 l  i6 v* S
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    0 j" P5 e. g7 Q- V1 m
  50.                         NULL,           // Use parent's environment block
    1 {8 ^! c- q- y; Z% R0 c
  51.                         NULL,           // Use parent's starting directory " A) Y7 X/ Y3 L* X1 f1 g9 T
  52.                         &si,            // Pointer to STARTUPINFO structure
    8 M+ b  g" L+ s0 A2 R4 q* T1 A* b
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure- {2 \- x1 B; E+ H# Q7 d
  54.                 ) 5 L/ X7 x2 \$ A7 h
  55.                 {
    1 e  }! y! r+ q
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    # S  H1 n- f. F- C. f
  57.                         return 0;
    4 f& k9 S; P1 O8 G' l4 x, M
  58.                 }
    ; Q. ]1 Q8 S: E, Y9 {
  59.                 //Creating Process was sucessful
      E4 L5 ?! S/ S8 B- U8 w1 i
  60.                 else1 ^/ k. V8 K% r4 x
  61.                 {
    , W% ~0 `5 p  C+ I+ h0 S& F( M7 u6 [
  62.                         printf("Sucessfully launched DekaronServer.exe\n");2 B) B( t! h1 B% G5 m+ q

  63.   i, {% @2 q, l4 E6 U5 k1 ?- ?- a) S
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure' q  h/ ~/ @' W3 W4 S$ _
  65.                         dbge.dwProcessId = pi.dwProcessId;
    + K$ e0 a6 a( I. U
  66.                         dbge.dwProcessId = pi.dwThreadId;
    ( m5 |. |9 L: Q% i! d

  67. 2 k' a" b4 O1 h9 w, d- ]5 T3 c
  68.                         while(true) //infinite loop ("Debugger")
    & R: v! k* l7 K. W3 E& k! D; ?
  69.                         {  I2 p0 W% G- n
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx) h# X' a5 Z1 V8 H) @4 i
  71. % v; U; |6 @! R! i. J
  72.                                 /*
    # x; K# u7 e" L. _0 x' V9 X3 A# i$ W
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
  Z2 A% D6 M+ x) t
; @' X& b# U8 p% J& O! X

6 b. V, w4 w% @1 i6 c0 w- |
商业服务端 登录器 网站 出售

15

主题

257

回帖

1226

积分

金牌会员

积分
1226
金钱
886
贡献
63
注册时间
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

主题

257

回帖

1226

积分

金牌会员

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

3

主题

102

回帖

6812

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-3-5 15:50 , Processed in 0.046082 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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