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

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

[复制链接]

157

主题

362

回帖

6843

积分

管理员

积分
6843
金钱
1944
贡献
4380
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) + s0 t/ O6 C0 q5 \4 r7 h

0 _- h6 k9 t5 J4 G3 a虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。% _. O0 X3 d5 w  ^# y
' e( N3 Q7 {$ E% O0 w* X
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。' I* n) }, X# l% P" [+ Q
  2. //
    # H6 O4 r; H& g- [/ \
  3.   e  @0 V# U7 b6 ^: @
  4. #include "stdafx.h"
    ) D9 k# J$ Z8 S% G  H( O; t
  5. #include <iostream>
    3 s, w7 B3 n. ], p: ^4 T
  6. #include <Windows.h>) P6 S% S1 E3 v" ]! G$ ]. }
  7. #include <io.h>7 b+ W. V* `. @* N. j: H5 v( `
  8. / l1 D6 a, W* ~- A6 _% K

  9. & {6 o7 G- S5 M& q
  10. int _tmain(int argc, _TCHAR* argv[])0 l, m* j  f$ |) {: Q& E; _! ^( l
  11. {, K; e# P# z0 G: u7 M
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    : u' H5 ]8 }. f+ s% F9 O) g

  13. $ t6 ?6 ~$ X) ^. b+ I+ I' x' s
  14.         //查看文件“DekaronServer.exe”是否存在- R( H; i- B1 i, T5 f% l/ J2 N
  15.         if(_access("DekaronServer.exe", 0) == -1)
    " F8 I4 ]# [& v' L5 D( ]5 r6 V/ ~& {5 `. o
  16.         {. L1 @6 r$ E3 U- [% g4 l% Q5 R3 ?
  17.                 printf("DekaronServer.exe not found!\n");/ m- B0 j. O( G5 M( ]4 E
  18.                 printf("Program will close in 5seconds\n");
    5 T8 M" l7 g# l+ t% O$ E
  19.                 Sleep(5000);2 H/ R* n, N0 J% z5 }
  20.         }7 U# n# N  B4 K4 D
  21.         else; c  v  O7 m2 a' {
  22.         {
    ; P, v5 b( H7 [# E* [! a
  23.                 ! f9 ^% v9 H- 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
    " s( o7 ?, j7 n0 \$ _
  25.                 STARTUPINFO si;) B- b# i9 h5 r, b

  26. - M6 z2 B, }/ l. B6 p- G
  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 O% c' n4 q2 A
  28.                 PROCESS_INFORMATION pi;
    6 [# W7 E9 Y% K  U
  29. # h  _7 ?- {( R, K) z! c
  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
    5 U$ L6 ]- b3 p
  31.                 DEBUG_EVENT dbge;
    $ ^  c1 O9 D; g
  32. & \$ F" Q. E( d+ V7 g
  33.                 //Commandline that will used at CreateProcess
    # u4 A: x, A# n4 P  @$ R8 @. S
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    ! D. A- `' C+ ]- Y! q5 F7 n

  35. + C; d9 t: S( T3 Y" p
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    : B( k' M4 n4 r
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)/ ?, Q# U( P8 [! w5 k0 J
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    6 m8 \1 _) a2 K: A2 ?7 l
  39. 9 J7 N- ~8 H7 ?. {- C2 }# w

  40. 1 v1 w9 W6 M8 d+ r$ B& |

  41. 0 x. E) k6 B* B) g
  42.                 //Start DekaronServer.exe
    0 S  y$ Z) A$ E. ^. G
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx" s0 _+ s9 {, Y/ f* {* C
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    6 O. D% z7 L: @) K, p9 A+ v
  45.                         szCmdline,        // Command line
    8 r: X% S% `0 `  [; }5 W. b
  46.                         NULL,           // Process handle not inheritable
    , |. E9 T5 x* t! k5 J3 A% V2 Z
  47.                         NULL,           // Thread handle not inheritable
    ' u* k4 z# \0 i
  48.                         FALSE,          // Set handle inheritance to FALSE6 j; `3 e; [; Z+ x7 n
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
      E" W8 q2 [  e! M
  50.                         NULL,           // Use parent's environment block
    " n8 L0 }# J) ~
  51.                         NULL,           // Use parent's starting directory
    4 E2 }1 D0 ]1 a2 [
  52.                         &si,            // Pointer to STARTUPINFO structure
    ( l' k. k: {9 [. l3 o3 `0 ^
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    ' [" c+ F: X# W) P2 b
  54.                 )
    6 ^% f8 h- A, A* b5 u4 m( O3 J
  55.                 {3 R- H8 @. j3 o! k( W
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );  i! \# ^" v3 D; R/ r1 }$ D
  57.                         return 0;
    - ^0 r7 u. M$ Y' l- r
  58.                 }
    + w; W' n$ y' P0 o
  59.                 //Creating Process was sucessful9 x; K( Y! n/ S: C6 I
  60.                 else
    7 ~% b$ `- }  c+ h5 J/ `: I/ |
  61.                 {
    # j9 \- [$ \  z7 w6 h
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    6 \- i% T6 Y, O' `+ I

  63. + O& f% X8 g' }  I# D
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure4 Y9 m- X' P  o* \& ?" [7 Y& p
  65.                         dbge.dwProcessId = pi.dwProcessId;/ ~* Z" Q7 u' s; C  e
  66.                         dbge.dwProcessId = pi.dwThreadId;
    / X  c2 b- O6 D8 |; Q7 `5 w

  67. 2 Z* M4 w( P" X. e& l" O: o' ?1 A
  68.                         while(true) //infinite loop ("Debugger")5 ^9 t' u* t& U8 m( W6 Y
  69.                         {
    7 v+ |/ O0 c, I# _: L% l
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    5 Q4 P0 S+ |/ g) q4 c" W% @2 R$ @" {7 g
  71. - {$ Z$ Z; I. n) D& w
  72.                                 /*
    ; ?# H- F) e  y, c! [
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
: n+ e% j) E/ H- P& l

+ e+ t% P0 p. }
; V  }; }' j3 M" R7 h& @
商业服务端 登录器 网站 出售

15

主题

256

回帖

1271

积分

金牌会员

积分
1271
金钱
873
贡献
122
注册时间
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

回帖

1271

积分

金牌会员

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

3

主题

102

回帖

6541

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-16 13:10 , Processed in 0.061496 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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