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

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

[复制链接]

121

主题

136

回帖

1910

积分

管理员

积分
1910
金钱
777
贡献
876
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 7 I+ B# i; l. }
& D( G/ f* _  P3 C! m  j& Q+ z
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
3 z7 U# h! s3 |+ ^: o1 p( D
, H& H# V) u5 Z% d8 u$ ]3 }, g5 K
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。7 u0 S5 E1 Z2 t, F- i) d/ l
  2. //- e' b, ^# t2 l9 `9 }) F
  3.   i0 N% ^, d1 E2 U# F8 x$ y5 E# z" |
  4. #include "stdafx.h"
    : g, u) t, X# `$ j+ c/ O6 j( a
  5. #include <iostream>4 {! m# `/ W& ^
  6. #include <Windows.h>
    8 P% j/ \6 ]! m- N1 `6 O1 H
  7. #include <io.h>/ A' f9 Q; F, E, A! m7 p

  8. ! R) z/ _: C% W

  9. 2 k& m+ O; g+ D4 B, x7 W
  10. int _tmain(int argc, _TCHAR* argv[])
    7 D/ e. P" l9 e3 X3 P& m
  11. {# ~* ]. {) o) f1 l
  12.         printf("Dekaron-Server Launcher by Toasty\n");0 o( W; S6 b+ [9 m8 ?8 E3 w
  13. # f. D! A( ~2 [
  14.         //查看文件“DekaronServer.exe”是否存在  j# s7 Q8 J2 B3 f% m7 j0 Y
  15.         if(_access("DekaronServer.exe", 0) == -1)
    " B8 C7 R3 R  h8 z# T4 \" D  I9 i
  16.         {$ g8 R5 K8 o& I" F6 J+ a: l
  17.                 printf("DekaronServer.exe not found!\n");+ i' Z- I7 q9 x# I- Y
  18.                 printf("Program will close in 5seconds\n");, r3 J8 a3 |2 N% z
  19.                 Sleep(5000);
    0 [: S) ]" u& n! l# R  r
  20.         }
      f% u, y: n/ X% D, d  `
  21.         else" U4 ]1 m8 H9 u4 E/ Y$ J
  22.         {" p/ t1 T2 H3 S  p
  23.                
    , U% I3 ]5 Y- p' D$ K. x$ k0 ]* m& A
  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# H* t3 a4 A6 _
  25.                 STARTUPINFO si;* g$ }9 z4 s" [. Y5 l; `. C8 s! |
  26. 7 `( r- A+ g3 F# y, j
  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# Y5 r9 @6 k$ e2 r
  28.                 PROCESS_INFORMATION pi;; |: s/ r; i% `! G8 ?" n

  29. * g% }$ l0 J' }/ k0 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).aspx3 b5 D- C; W) `' g  Y; E
  31.                 DEBUG_EVENT dbge;
    , T0 B' a$ _6 H7 i- J3 C
  32. % w0 e1 l6 @/ F% Q( o
  33.                 //Commandline that will used at CreateProcess
    ( o7 ?9 B0 V) z. U% B
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));* Y4 a- Z; N, c

  35. 1 \; `, B: Z9 [* O
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    ! e+ x3 D. }6 t- u) K8 N8 H  y7 Z
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    " M+ U/ n8 [  I  Y7 o
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made). J' g2 G8 t; j0 T4 G, j/ s
  39. 9 k. ]2 K& Z/ E3 h2 e
  40. 7 @+ ~' Q' {9 G" c

  41. # `+ F) J; P" e) g: ?9 a3 o
  42.                 //Start DekaronServer.exe 0 V0 F$ k8 y  v& v7 z* X3 A* B
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    / Q' K2 B/ l+ f# K( S; t
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    # o3 C0 g% x( S0 Y/ g0 ?
  45.                         szCmdline,        // Command line/ m8 L0 O/ _4 F2 ^% B# p  {
  46.                         NULL,           // Process handle not inheritable3 }) f  \( k& y) a
  47.                         NULL,           // Thread handle not inheritable! [* }$ y. G$ }5 U2 c4 x( c" A) t
  48.                         FALSE,          // Set handle inheritance to FALSE
    3 O. |2 C2 k2 T( ]1 z
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx4 I6 P: `/ d% w$ ?5 f
  50.                         NULL,           // Use parent's environment block
    ( ~/ g6 J  K4 M
  51.                         NULL,           // Use parent's starting directory
    4 t- {5 z) J2 {- L/ \7 ]
  52.                         &si,            // Pointer to STARTUPINFO structure
    3 h2 Q' v) Z. @' @  C* u" S) n8 \
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure( X1 p9 j9 f- [, N" N. ]6 L
  54.                 ) ' F6 [$ c/ }6 L* Y
  55.                 {$ o# p. l6 ~7 m+ ?& `
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );- r. P4 B7 K! U2 P& R5 l3 i7 B
  57.                         return 0;
    3 k  O4 P9 ~* H. n# T" N" M& K. L5 f
  58.                 }- W% k0 ~% P% Z
  59.                 //Creating Process was sucessful- r2 g2 M5 J- P, F9 ?' D) Q. y3 w6 }
  60.                 else! T# N' V1 U; {2 Q+ B8 A9 \
  61.                 {
    + A! a! F& |% A7 B: p* Y
  62.                         printf("Sucessfully launched DekaronServer.exe\n");# B( P9 l0 w: |. j

  63. 2 P( _4 G* p( S! ^
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    % l& m7 b* N& G% {$ g+ k
  65.                         dbge.dwProcessId = pi.dwProcessId;
    : W) l4 o- T; _. e, w
  66.                         dbge.dwProcessId = pi.dwThreadId;- `4 m1 F* j2 I/ |# V4 S. s5 d$ ~
  67. # O: X. r3 O7 M5 K4 l
  68.                         while(true) //infinite loop ("Debugger")
    ; B2 N, x5 Y+ z2 R2 n% H) g
  69.                         {
    5 q4 O) @/ J, X+ O8 K+ D' E! e
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx5 Q  p4 S  C+ `$ C# x

  71. " b+ _+ Y7 l  `
  72.                                 /*
    ( z& {- ]( L. k: R1 }, v" M
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

- h- R% W7 R$ t4 s. q! Y# D! n$ j( z( _$ e) _! P1 X6 X

& N6 P* ~0 p7 E4 a$ S  q
商业服务端 登录器 网站 出售

8

主题

216

回帖

598

积分

中级会员

积分
598
金钱
341
贡献
28
注册时间
2023-11-10
发表于 2023-12-18 20:34:07 | 显示全部楼层
我是来学习的!

21

主题

378

回帖

977

积分

高级会员

积分
977
金钱
421
贡献
157
注册时间
2024-1-20
发表于 2024-1-21 13:37:44 | 显示全部楼层
感谢楼主分享,我是来学习的

0

主题

91

回帖

206

积分

注册会员

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

8

主题

216

回帖

598

积分

中级会员

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

2

主题

75

回帖

310

积分

中级会员

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

本版积分规则

Archiver|手机版|小黑屋|EGameol

GMT+8, 2024-9-21 06:21 , Processed in 0.129941 second(s), 26 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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