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

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

[复制链接]

157

主题

363

回帖

6885

积分

管理员

积分
6885
金钱
1949
贡献
4416
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) ) g: q4 O# [* r8 c7 J5 v9 l7 x. }4 U

! ^8 ]! \# S; ?* z, _! M# I虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。: P9 h: F* J- P7 s& u
8 q; U0 i/ R) A) T0 I$ {
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。) j/ I; P5 x  @- A
  2. //4 F3 d! C3 b( z: }5 m. ^3 b

  3. 2 k" g- i( P3 h) \3 `- f
  4. #include "stdafx.h"& g2 J9 z7 g. b
  5. #include <iostream>
    ' b* U5 Y+ j$ \: q/ [. Z
  6. #include <Windows.h>  k1 d2 }$ ]0 g8 {+ L3 P7 M- s2 W
  7. #include <io.h>
    0 l. X, `- ~. z# v

  8. : V5 @4 q3 G- s9 X6 d
  9. - W) U) e  T( ~* ~% [8 B( r. N
  10. int _tmain(int argc, _TCHAR* argv[])
      M1 R. O+ y& |% R
  11. {
    0 M8 t, ]# N& G# a3 b
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    / }) x9 H. }- O4 }4 }3 W! u& p
  13. ; t6 n. I! A: r! h- `4 W. _" n) k
  14.         //查看文件“DekaronServer.exe”是否存在- n4 j( Z$ V( T4 m) i, N8 D
  15.         if(_access("DekaronServer.exe", 0) == -1)' T: G4 U# l9 Y, t6 `
  16.         {4 t! O0 L1 p' K2 v! k6 B1 `1 U
  17.                 printf("DekaronServer.exe not found!\n");) V- e5 K6 _8 c* R2 M
  18.                 printf("Program will close in 5seconds\n");
    , V; D! c; w4 `: M4 c  y
  19.                 Sleep(5000);6 y  g- E+ w0 M: d* H
  20.         }0 B0 _) n9 N: c, @) Y+ m2 s
  21.         else* U8 h) P8 ]! e& _- ~& Z
  22.         {
    ; b- L5 w- h0 F$ w  n
  23.                
    * W: Q9 I+ @4 O$ q& ]: d1 j
  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).aspx5 e, }9 y$ ]8 V4 U% \1 B* Z
  25.                 STARTUPINFO si;3 V. X' Z6 A' B: ^& w: U  ^' P. \+ Z
  26. " v) g0 y$ w4 F; g/ P% ^8 G7 B2 e
  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* F( G  b  J7 m& q; ~
  28.                 PROCESS_INFORMATION pi;; H! V9 @! D1 ~: V2 s

  29. 2 l! e3 T, ?) U* b. k
  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% e5 v1 i* |1 b8 s7 \: W' D
  31.                 DEBUG_EVENT dbge;% w  J- l0 h% O, W2 ~

  32. 0 u& O* w% o7 H/ f: j5 K
  33.                 //Commandline that will used at CreateProcess% M: e5 Y2 c1 k! u6 P8 Q
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));& `* y2 l# Q6 p/ T+ ~

  35. 6 B; h: {, A, x0 Y$ G- v# D
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    & f) `; a% M$ F. q2 m
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)+ O! F. a0 T, S: o. L6 Y) W1 J6 Q" D; O
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    " M& m0 d- ?$ f6 c0 I

  39. 6 P2 j- `8 u$ V2 D8 {  C' ^

  40. 6 N, D/ q" {2 r8 ^7 u$ e% ?
  41. 9 H" v, N: N( @7 b
  42.                 //Start DekaronServer.exe " c( ~0 F* T' S/ J
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    , `6 \" T! ?5 n0 L; W8 Y
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    2 N" E' n% h0 J0 T0 Q$ O5 n) F
  45.                         szCmdline,        // Command line
    / B' v' i' b1 j& W! ~% k: E9 A
  46.                         NULL,           // Process handle not inheritable: r3 y/ j. t( Z+ t! h4 H# f- \
  47.                         NULL,           // Thread handle not inheritable9 {, q3 n' @' E% y8 Z
  48.                         FALSE,          // Set handle inheritance to FALSE
    4 y/ N/ h& |3 Z8 q# N
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    " U4 @3 C1 [- ?9 _3 U, {2 N4 m
  50.                         NULL,           // Use parent's environment block
    ) b5 R4 E5 t. j+ d
  51.                         NULL,           // Use parent's starting directory
    ( d; ]: z: m: ]$ S) r4 M
  52.                         &si,            // Pointer to STARTUPINFO structure9 g( e2 O0 F+ S+ ?+ g4 Q
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    - o6 f& r: k1 ~0 H3 M0 ~
  54.                 )
    ' k; Q  b: \% z  C; m  M2 Y
  55.                 {
    ' a# \5 M/ t6 G2 n0 j  v, U, s- q5 j
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );; H# e' p# E: w/ m: Z5 v* w
  57.                         return 0;
    8 Z# M" D, ^8 ~' }$ N( ~  W
  58.                 }. g" I5 B0 J5 ]/ U1 b
  59.                 //Creating Process was sucessful9 H1 j* Q* ]' z2 |2 Z  T6 p2 y
  60.                 else& ?3 }5 x# R' E
  61.                 {
    / A, |- V. x& I9 U9 D
  62.                         printf("Sucessfully launched DekaronServer.exe\n");+ t) D0 @. C' M3 N: ^; h9 }5 ^9 G, N1 t
  63. % ]/ m; i8 L7 }# I* I) B9 I
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure+ w5 d. S  J: w7 e) \
  65.                         dbge.dwProcessId = pi.dwProcessId;% T, n+ H) z, X& S! s! C$ b! P
  66.                         dbge.dwProcessId = pi.dwThreadId;
    2 C+ A1 A: V- x# o# t: Z6 m
  67. + h& I$ K' q5 k1 W4 e, ]& W
  68.                         while(true) //infinite loop ("Debugger")
    4 O3 T1 Z- u& u7 C% |) w
  69.                         {" @! m5 C$ m# _7 v0 a
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    " x  R) ]. |0 {/ `/ [; t0 j

  71. 1 Y6 ^2 v6 V7 o
  72.                                 /*8 u) L% T$ ^( w; Y% c5 R
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

9 q9 _7 B4 A$ G  o  F9 Y
9 j0 H. L3 u3 M: Z/ x# t1 W# S1 ^/ \: n7 h+ A
商业服务端 登录器 网站 出售

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

回帖

6659

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-24 12:26 , Processed in 0.055972 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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