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

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

[复制链接]

157

主题

362

回帖

6880

积分

管理员

积分
6880
金钱
1946
贡献
4415
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
7 L9 O  Y: G" T& B: {; {" p4 w- N
4 ^0 U' b: L  Z* U$ k+ v虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。8 {, Z# B  Q: h, {( @2 @

- z# V% ?9 b9 G
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    % t9 W" O9 }2 a+ u8 B
  2. //: I: n& [5 {1 I& S* s% F
  3. . ?& P1 |8 N7 C$ f9 h
  4. #include "stdafx.h"
      }! F0 s# N; X$ _" A8 G. D. b
  5. #include <iostream>* z7 u! m  T8 D; C/ l
  6. #include <Windows.h>+ U2 e* I- t  s% N( r) v- U2 i
  7. #include <io.h>
    5 J: m1 H; h# P6 @6 w

  8. " L2 }  j9 v1 F) m1 Y/ f

  9. 1 J4 Q( w1 P: `- E( O7 }
  10. int _tmain(int argc, _TCHAR* argv[])
    $ F& W  k2 R2 n! j: F4 S3 \* n
  11. {
    % _( T$ o/ k% U: A  o: m
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    , b) [6 }+ [% A0 q  \* u1 `

  13. , w% _7 P+ k5 \- O- I' y+ G
  14.         //查看文件“DekaronServer.exe”是否存在
    : s4 |- P! A0 {
  15.         if(_access("DekaronServer.exe", 0) == -1)+ H" g; y9 g1 J  ^
  16.         {
    & c0 v+ x* g9 h6 T
  17.                 printf("DekaronServer.exe not found!\n");5 W; e" {6 e$ F# ?& _* i5 `( Z
  18.                 printf("Program will close in 5seconds\n");5 A7 ?9 F9 u+ ~3 H! t. W: z( _+ L
  19.                 Sleep(5000);
    $ K; I6 u* F; P1 x2 q
  20.         }- c7 I' F# b; B( T
  21.         else( M' U" d  A3 G
  22.         {! p9 R& _  V; D- S- a& N. G
  23.                
    2 V$ ^( f2 q! R  b
  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  l4 a$ x/ `1 n: K4 `9 w. ~9 N
  25.                 STARTUPINFO si;/ b: X0 [+ h1 q' l# b5 t& ?
  26. + R# P# N4 j2 E; n6 T, I& p
  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
    $ N* s; H2 Q5 g, w& e
  28.                 PROCESS_INFORMATION pi;
    9 P. M: D& k* r/ L7 F; _

  29. 0 Y6 K& s2 B& R
  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
    3 J: |: a9 T* m1 w: B! v- N" G
  31.                 DEBUG_EVENT dbge;
    0 H: G9 _" m( R2 s1 H
  32. ( u/ d4 B8 J1 w
  33.                 //Commandline that will used at CreateProcess
    9 R# w( O' }; o, }2 ?, g
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    % H2 Z1 M9 k1 q1 G! O

  35. 8 I0 s2 `# S$ u% y' m! u
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    % x, |& _0 {$ F5 y# i( N
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    . j/ h9 r7 \5 K
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    - i) }0 s# j( I/ y% A$ D

  39.   B, S# h, D! \$ y9 }
  40. 6 Z% }1 d$ w+ f" r+ @% u) t  j

  41.   W. K. W. c! _, Z. m9 k1 I
  42.                 //Start DekaronServer.exe ; Y' m3 `8 Z3 f5 l- ?" V& j7 A7 ?
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx7 i2 F7 y, k7 K4 F2 c4 l: a
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)( W7 F1 u+ t& q9 y, O8 c
  45.                         szCmdline,        // Command line
    7 v! d" e. g" R+ |; h
  46.                         NULL,           // Process handle not inheritable
      X0 _; O) Z# I4 H# d) [" U5 _
  47.                         NULL,           // Thread handle not inheritable9 O' o7 O- D+ B+ ]7 T
  48.                         FALSE,          // Set handle inheritance to FALSE. M5 y. k# y: P; a
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    ! f" {4 c$ m( `, u
  50.                         NULL,           // Use parent's environment block( j7 P  n7 X* W5 P/ h/ [7 i" ^
  51.                         NULL,           // Use parent's starting directory & H7 ~6 k* r3 t( V7 g1 f; J, W9 V" a
  52.                         &si,            // Pointer to STARTUPINFO structure- t4 Z2 D0 F5 Z  T0 A
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    % k( K: N* g, _& B- g
  54.                 ) / M* t( y) r! q8 ^( m" x0 j. e4 D
  55.                 {
    2 k; I- S( n* B5 X* i" s5 ~4 v
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );) Z1 S! ]% z* C$ O! \
  57.                         return 0;
    $ J! g4 i+ {! g9 F
  58.                 }* F  E0 f  G5 {8 b$ s/ |* v
  59.                 //Creating Process was sucessful) I, d# ]) T6 f, u) D, o6 G$ U
  60.                 else
    $ q/ a+ U9 H1 o. E  H
  61.                 {4 n3 D5 s; y* U2 ]6 _( ^% J$ W. ~
  62.                         printf("Sucessfully launched DekaronServer.exe\n");) @! ?8 X7 ^2 X) ]  H1 ]
  63. ! Z5 h) q- G) O; b; i- L
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    * y/ r. i% k7 Q( `) q) z+ D* X
  65.                         dbge.dwProcessId = pi.dwProcessId;
    , K+ ~5 [/ N  @- Z/ @; c8 @" u
  66.                         dbge.dwProcessId = pi.dwThreadId;  f$ n- `0 ~  o
  67. & j9 s  l% P; Q$ U  l! j' e' j+ b
  68.                         while(true) //infinite loop ("Debugger")
    7 y% @" n  }5 A; ~  Q) I
  69.                         {! ~% s- H( ~) a3 c! H1 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
    8 h: b! O! d7 _' @% b

  71. * ~2 V1 s5 x5 ^% I* ]
  72.                                 /*( ]3 |$ q# H* Y& E
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

1 j; B2 k1 m) r( |" e+ c
5 c" d& J! z2 Y: C: Z3 m" ]% ]8 c/ A9 f) v, m) O, Z
商业服务端 登录器 网站 出售

15

主题

257

回帖

1252

积分

金牌会员

积分
1252
金钱
882
贡献
93
注册时间
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

回帖

1252

积分

金牌会员

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

3

主题

102

回帖

6646

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-24 09:56 , Processed in 0.142645 second(s), 26 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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