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

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

[复制链接]

166

主题

426

回帖

8116

积分

管理员

积分
8116
金钱
2378
贡献
5146
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) : d& t9 w. n) q1 o
5 ^. @! j7 Z: [5 i
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。( C$ V% K% O& D- V4 z
% V* Y, g  W( {- \- k7 _7 \, l
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。" a/ `) c4 K- ^1 ]5 Q# e/ U* ?2 \! ?
  2. //& I; T0 ^+ T  H& R* h' `. m6 ~# l
  3. * ^, e0 j& j0 K  P4 f
  4. #include "stdafx.h"6 E1 v5 V! h6 \! f: A
  5. #include <iostream>
    8 P1 \1 k! O, L: J. U! u2 G
  6. #include <Windows.h>
    9 ?% y+ ?. Y- @4 r% F* Z8 Z" x% k
  7. #include <io.h>+ ^; L5 z$ _1 j

  8. : E5 c0 o$ M3 ^+ |5 o8 O, Z1 C$ ]# a
  9. * [/ T( X8 H' j, i( y
  10. int _tmain(int argc, _TCHAR* argv[]). Y. J( n* ]7 c, v+ C- \6 ~
  11. {
    9 T* F/ m- {, u' G- r
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    4 u4 \, y; v6 w6 p" |. M: V
  13. 6 J0 E$ M! E0 v
  14.         //查看文件“DekaronServer.exe”是否存在
    3 R. ~! h  y! |& [5 q, t9 R
  15.         if(_access("DekaronServer.exe", 0) == -1)
    - P% R3 z' B8 k
  16.         {
    1 ]! ?+ }- Q4 P0 |: N
  17.                 printf("DekaronServer.exe not found!\n");
    ; Q* }  n0 o/ @( P! o. q$ C
  18.                 printf("Program will close in 5seconds\n");
    8 Z" Q% b( J! J* X! X5 t2 K
  19.                 Sleep(5000);1 j& b, |! t; E* A) |% `( ]8 D, ]
  20.         }5 T1 v- x8 W. O8 g- c) B+ C
  21.         else
    9 h) _$ _" E- u) H. \( u  W4 J
  22.         {- [+ S) A9 K( v8 i0 e
  23.                 + G8 E2 w- o8 S! E2 L
  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
    % B) k& P8 N7 v
  25.                 STARTUPINFO si;( M# p$ {( s7 `

  26. , ^" x" J; |, H# 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( T. X( A2 o6 d) b
  28.                 PROCESS_INFORMATION pi;4 d) a: o2 l  U5 G  k& a$ o% _6 W& x
  29. ; ^. u7 ~+ ^! I% q4 n
  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 z& S" a; M2 z% q2 G
  31.                 DEBUG_EVENT dbge;' Z; N: \- X, A$ L1 G

  32. , N6 z1 t. s4 G
  33.                 //Commandline that will used at CreateProcess
    $ {  B5 Q% k" k, q6 G! N- x' n
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    ( G. ?8 w$ O; \( o( X$ m
  35. 3 h3 g( J3 z3 v5 g9 v
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)/ o) h) i3 g6 s$ M8 q4 l7 `; p! ~
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    . b* B( Y$ M- ?: D9 \: @9 H
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    9 U5 e% X, k$ W% d# @) D& i1 o
  39. 7 D9 q8 o. n8 q6 F+ R- B, Y
  40. + N5 i, A- R6 x% a  k
  41. ( u& o9 @" Y9 N
  42.                 //Start DekaronServer.exe
    + D, O# N" k, n3 m* d
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    ) K0 ?+ Q) M7 `
  44.                 if( !CreateProcess( NULL,   // No module name (use command line). L0 K3 `" x7 @: |, i& Y
  45.                         szCmdline,        // Command line  M7 w# N8 v- S
  46.                         NULL,           // Process handle not inheritable
      ]% Z  I8 h0 t4 @) c6 a
  47.                         NULL,           // Thread handle not inheritable/ h7 n( t) R- h: X3 K, |1 X7 s4 E* @
  48.                         FALSE,          // Set handle inheritance to FALSE& ?6 [3 b, N0 l9 }: `1 `% u7 p
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    7 [8 l& I( n. {( [/ H( |8 ?
  50.                         NULL,           // Use parent's environment block
    ! r% u8 S3 @6 P  `3 ~, n) l
  51.                         NULL,           // Use parent's starting directory
    ; K- v7 ~8 |( M) l. A9 _. V* }+ x
  52.                         &si,            // Pointer to STARTUPINFO structure
    - \) d# K' W# S- K/ n: }" F5 ~
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    0 e9 E3 y2 S4 d; h$ q/ y/ R# I  t5 b
  54.                 )
    + k$ f  Z5 a. @( V/ t
  55.                 {
    7 S9 E$ P, w2 j  j9 l4 s
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );8 t+ U, g. l5 w( g: p! V
  57.                         return 0;
    8 h7 u  x+ n- D% j2 T
  58.                 }
    , x' v: |5 p# F$ Q% E# c; i
  59.                 //Creating Process was sucessful# o' [, B6 m) |3 O; h* D
  60.                 else* k6 M1 u  c3 H, q" w; _9 D4 x
  61.                 {  E  R; Y3 _- S8 W9 T
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    6 j/ H1 E' b4 O; Z  Q1 A

  63. $ O% o: D2 ^6 B+ |8 S+ H
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    , k4 ~& R+ W$ g+ K5 X
  65.                         dbge.dwProcessId = pi.dwProcessId;
    : y' V+ E* i# z% K+ q
  66.                         dbge.dwProcessId = pi.dwThreadId;" I5 N) y  ?9 d# f
  67. 1 g2 {, [5 z1 ~  y6 T% G
  68.                         while(true) //infinite loop ("Debugger")
    & N. `1 p, |9 j9 T; j* J
  69.                         {8 D3 w, f7 ^. Y, S( G
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    9 @2 H6 l" N. \* a0 ]/ s1 B+ _  z
  71. : c0 Y; }3 e' O2 B! K8 [
  72.                                 /*4 e8 p. x  n0 H: O
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
; E6 D7 B5 M& i# g( ~+ |
8 p# |8 C4 N7 C" j4 n) |
2 o2 O' w* ?; T* b# R) n1 |1 c
商业服务端 登录器 网站 出售

16

主题

268

回帖

1475

积分

金牌会员

积分
1475
金钱
1075
贡献
111
注册时间
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

主题

211

回帖

365

积分

中级会员

积分
365
金钱
152
贡献
2
注册时间
2024-5-14
发表于 2024-5-14 15:56:57 | 显示全部楼层
学习学习赞赞赞

16

主题

268

回帖

1475

积分

金牌会员

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

3

主题

103

回帖

9308

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-9-28 03:01 , Processed in 0.062807 second(s), 30 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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