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

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

[复制链接]

156

主题

354

回帖

6539

积分

管理员

积分
6539
金钱
1908
贡献
4121
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)   |8 L, O& p) }5 D- B  @* Y
; F! ~; W1 a; B# R& h- P7 j
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。/ Y7 R; d# v: k
0 W* S* S6 }3 w; k
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    / f" c; b2 b3 s) @
  2. //
    * l3 V1 T0 }# T* i: Z

  3. / b5 X1 P- i# i7 [
  4. #include "stdafx.h"* F' o! E7 I0 C7 A4 \, C9 e, F
  5. #include <iostream>8 P5 E, d& S9 A
  6. #include <Windows.h>2 n( }+ y3 N; \2 O. L# [- B! f
  7. #include <io.h>
    ( G% G9 \2 H) Y7 B& W3 Z: A+ @
  8. ) _5 Q1 D! D, |9 w# Y  ?

  9. / A' a* G! {: i5 z( Z' d9 T$ u
  10. int _tmain(int argc, _TCHAR* argv[])
    2 t: j* k' l- |7 U7 N
  11. {/ J5 C: I+ q3 f0 F4 @3 Z
  12.         printf("Dekaron-Server Launcher by Toasty\n");7 |) B# G! J, H0 _

  13. 4 w3 }# E7 l  H2 M% Q: Y: c
  14.         //查看文件“DekaronServer.exe”是否存在
    % C; O" d2 N6 S- h9 }! T7 I! ~  R7 `
  15.         if(_access("DekaronServer.exe", 0) == -1)
    $ r$ v9 @' Y( Q- \0 z7 j5 T6 z) D
  16.         {
      v+ e7 w3 A) X# {/ a
  17.                 printf("DekaronServer.exe not found!\n");
    ' L2 ~' ]& X1 q) Z2 g
  18.                 printf("Program will close in 5seconds\n");
    0 H8 m7 ?+ h' Q
  19.                 Sleep(5000);
    8 F- j' G, N; {: u) b3 g
  20.         }
    4 p1 M3 R1 E% k% q* N
  21.         else" K$ v: T4 v; O
  22.         {
    2 e$ y- S% v7 x: I9 Y4 M; I
  23.                 0 ^" X, u$ X9 C6 n8 A' b9 b9 A, x" 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
    0 S+ R' M$ c6 R% S
  25.                 STARTUPINFO si;' n0 k+ K' r9 |/ d: l

  26. , v) c4 k, X. p* @4 S
  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
    7 F2 t) q  z( ^8 P
  28.                 PROCESS_INFORMATION pi;1 U+ f+ E- I. L+ R% r

  29. 3 h) w( K: |' Y4 a4 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- z  ?2 Z* |- G5 g1 v4 b- W
  31.                 DEBUG_EVENT dbge;6 K1 X# P1 c4 l8 i' L
  32. 9 r9 B: a9 v; T
  33.                 //Commandline that will used at CreateProcess
    ! k: M, w3 J& ]+ M8 W; t
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));4 \! l1 K) D1 i% d+ H) I

  35. " g$ ]; q! ?; A. O& Y$ \* P
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    4 U# v$ B( z* @* M3 x
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    8 V" r0 _& b8 w( m1 A' N  ?+ x8 g
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    + b+ ~4 j1 i4 T* k( x/ ?, e) P( P

  39. 7 Z9 ^- o' g7 `3 V# i4 z

  40. ( ]8 |5 ]8 l3 {( Y; s2 _9 O

  41. " f0 }0 S/ D8 x; T
  42.                 //Start DekaronServer.exe
    8 s4 d/ N0 Q9 A3 R8 y; ^
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx+ P+ W# ]- e$ Z# I
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    # b4 H" J& X9 j; r" u! r
  45.                         szCmdline,        // Command line
    6 a- c5 P/ R7 F' {# u
  46.                         NULL,           // Process handle not inheritable
    5 l, U2 [: W2 ~1 m$ ]: K
  47.                         NULL,           // Thread handle not inheritable
      h- ^- L. R4 B0 ?6 Y% m& e
  48.                         FALSE,          // Set handle inheritance to FALSE
    ) k8 \" s% C4 }1 C' `( x. d" f& I. f
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx  E2 F+ }4 @/ L, _6 ~1 a) [, |
  50.                         NULL,           // Use parent's environment block0 v/ H$ B9 N+ R8 B: Y  F
  51.                         NULL,           // Use parent's starting directory ' @* ]9 P- a1 @  E1 P
  52.                         &si,            // Pointer to STARTUPINFO structure( m# O8 `4 T  C! A( W
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure5 x% ~6 n1 G4 U0 v- y! D5 r% r
  54.                 ) ) K1 Z3 Q2 H, T+ B4 i* [) w
  55.                 {
    4 \4 ]: }6 j: P( k. T
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );2 P1 t/ p/ K1 J
  57.                         return 0;" n# ?1 U' |9 M& C$ ^
  58.                 }& K/ u4 p6 ^& c  O) I+ H
  59.                 //Creating Process was sucessful/ A& c" k$ W" m
  60.                 else* v8 N1 Q7 J& [
  61.                 {. U+ y6 v' a) C+ ~) t
  62.                         printf("Sucessfully launched DekaronServer.exe\n");' `* B% y! d( [! u  _+ I9 F5 O

  63. / e# M2 s  v% u; [
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    + }( Y8 i5 b  q+ K+ ^
  65.                         dbge.dwProcessId = pi.dwProcessId;# V, ?+ H4 o, B4 t4 F: \' L; g
  66.                         dbge.dwProcessId = pi.dwThreadId;
    : \2 P0 U/ x- d9 |1 a5 w/ R
  67. * z* y5 a' K4 X9 i; C4 e7 D: a
  68.                         while(true) //infinite loop ("Debugger")* `0 E/ g' e) ?. T# f4 V; [- v
  69.                         {
    + @& C  s4 H% S$ H
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx/ W  i$ N: b! i: ^
  71. # S* O- B. U- z1 T! X* Y% C0 {5 E$ l
  72.                                 /*
    , l& A- ]9 S+ V, Z+ [, r
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

8 T  @+ \, b9 h- k; Q) K# |2 a1 ^3 n* i9 ^" y! F  r

* Z6 v$ E3 L/ g( ]- T. e
商业服务端 登录器 网站 出售

15

主题

256

回帖

1241

积分

金牌会员

积分
1241
金钱
853
贡献
112
注册时间
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

主题

256

回帖

1241

积分

金牌会员

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

3

主题

102

回帖

6121

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-26 10:59 , Processed in 0.056010 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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