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

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

[复制链接]

160

主题

385

回帖

7389

积分

管理员

积分
7389
金钱
2121
贡献
4723
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
+ Z! M& h! {4 e7 e( k+ d  j' L. w. |
( s: z8 _4 Y% M0 v; a9 u6 e; K虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。7 @9 w9 t. G, O# _( }
+ e4 S+ R4 e+ n$ U! q3 ?
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    + J+ m4 v6 t9 {& B
  2. //5 q& w. J. J' o1 o* Q) W
  3. " {( T/ _2 O1 v7 H
  4. #include "stdafx.h"
    ; F' o* {0 ~0 m5 \- P- c# H# G
  5. #include <iostream>
    8 L3 {$ M; a( q) o3 G* z2 |
  6. #include <Windows.h>+ \5 b) D; {/ r8 p" b$ u( T8 L
  7. #include <io.h>3 C7 R& Z5 Q+ x9 ]" \* _
  8. * @" {. ^3 y' L* J1 g- c. H0 {! y

  9. 4 B7 ~! B! T+ u+ y8 i$ E6 g  J( f9 u
  10. int _tmain(int argc, _TCHAR* argv[])
    : G0 q8 q# [% D* d$ R+ y9 F" M. Y5 B& w( M
  11. {
    $ j9 i, F9 g* U5 T( a
  12.         printf("Dekaron-Server Launcher by Toasty\n");. R# H' c. k) s+ f  L( N

  13. " S" w, E9 D2 L. K
  14.         //查看文件“DekaronServer.exe”是否存在( e7 L/ |, e4 }, E
  15.         if(_access("DekaronServer.exe", 0) == -1)
    / C: b. M: C- `% i& U! g2 V. {
  16.         {
    2 c' a+ |5 W* P- s$ L8 o
  17.                 printf("DekaronServer.exe not found!\n");9 q* `& X; c% W3 k6 I, [, f
  18.                 printf("Program will close in 5seconds\n");. j" p$ W4 }, f0 y
  19.                 Sleep(5000);2 J: h/ i. x# Z( D1 [8 H
  20.         }9 M: y+ Z5 p' _. v/ d
  21.         else
      r: }" I7 C( o, x, Y: J' e$ y
  22.         {$ e; Y  J5 E0 R/ [! n
  23.                 4 v7 L7 P+ `* F( m: ]& G* 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: W7 y, S  I; l; I5 f9 C
  25.                 STARTUPINFO si;! T4 w! i6 y7 J: n

  26. ' F. f3 q# ^/ a$ s3 k: 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
    ( O( Z) M5 `6 h" g
  28.                 PROCESS_INFORMATION pi;
      l! d8 U2 ^5 c6 ?, W6 w

  29. - e* a( Z5 K0 x2 r4 Q! }. L$ L
  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# S0 L4 ?8 f5 e* P! u0 w
  31.                 DEBUG_EVENT dbge;
    6 Y! |, B+ q9 ^1 s3 l4 u

  32. * \4 _# Y1 W# Q* w
  33.                 //Commandline that will used at CreateProcess" R! U8 b' S8 n  g8 A9 ]
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    ! X( p7 Q( Z: T: h* s. V, m) V$ ~

  35. ) P; ~9 E. Q# \  K7 u  F
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    3 `5 J$ x& G; t5 T3 J& G% f$ Z
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    1 {! C6 G, q9 C" e# p0 x, }
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)" U3 v$ P: x; Q6 I

  39. 9 N' A3 R8 x2 d: A' P

  40. 8 ]; ^# v" }8 A4 w' z
  41. ' x6 `) r" P' k& @# U# C& u
  42.                 //Start DekaronServer.exe   L  c  u  J5 ?, B5 o
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx, n; v: E* L( _+ @) k
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    9 F$ Q1 v! G) A' P: {% Y
  45.                         szCmdline,        // Command line( N% L, m: o- {7 x) O
  46.                         NULL,           // Process handle not inheritable) B, K: l0 d) A, {) f! A
  47.                         NULL,           // Thread handle not inheritable
    " p3 n; L" \2 i( Q
  48.                         FALSE,          // Set handle inheritance to FALSE
    3 F- i8 @: z' k$ X" Q; `
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
      V; ]: \9 s% d
  50.                         NULL,           // Use parent's environment block
    - A9 ]- V7 d* ?+ n
  51.                         NULL,           // Use parent's starting directory
    . ~5 K9 j$ u  \2 o  W$ q
  52.                         &si,            // Pointer to STARTUPINFO structure
    , ]  \2 |( F% @+ Y7 O5 G
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    $ R) e2 f! o) y' l, Q: v
  54.                 )
    " b3 n: }0 j' ]+ z, r
  55.                 {
    & z9 S) K0 [- @* L" O
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    * b+ y7 Y# ?& V
  57.                         return 0;
    , b3 L7 u) q5 O# m
  58.                 }
    7 L8 P) v2 V7 O- o
  59.                 //Creating Process was sucessful
    ; F# _* F8 S$ k8 e& ?4 w! ^: h
  60.                 else
    # K3 q$ E  V5 E- i7 s; F! ^4 m8 m+ e" P' A
  61.                 {
    6 D, S1 y5 D/ L! o
  62.                         printf("Sucessfully launched DekaronServer.exe\n");" A* J5 c$ J% v
  63. ; Q& S7 q6 N8 v0 y( P
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    ) M0 S: Y7 l6 N# }, i6 y6 ^6 X9 v
  65.                         dbge.dwProcessId = pi.dwProcessId;
    ' `0 z3 p1 V" J6 Z  C
  66.                         dbge.dwProcessId = pi.dwThreadId;( ]& {% V5 \' `0 w& w4 w
  67. ; C" T  Q9 ?+ @
  68.                         while(true) //infinite loop ("Debugger")
    ' Z% Y& {& j6 K3 G7 s9 C  X0 k
  69.                         {
    1 \+ l  x- w7 ^0 C8 o  X
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx+ u& O2 I/ ?5 s' h; C5 v

  71. 6 T- U( F: S" Y9 r, h, {9 w# L
  72.                                 /*2 \+ w' l7 [9 N, G8 U. D- ~
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

, Y6 i. {5 H" a& A. z7 I% ]2 H  m8 r: {  B1 e% C

7 f. {4 x+ a; z8 v4 R
商业服务端 登录器 网站 出售

15

主题

259

回帖

1275

积分

金牌会员

积分
1275
金钱
920
贡献
76
注册时间
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

主题

259

回帖

1275

积分

金牌会员

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

3

主题

102

回帖

7797

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-25 22:25 , Processed in 0.037276 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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