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

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

[复制链接]

157

主题

360

回帖

6652

积分

管理员

积分
6652
金钱
1928
贡献
4207
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
" K; C7 F5 O+ d/ @0 a, B, i' s; Q! S8 h' ?) s* e# ?. ?2 r) D
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
' C- x3 u" [; v3 {% L
0 J# y/ s& E6 O$ \* Z8 |
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    . J5 B5 g; J' F: ^/ d
  2. //8 @1 N- X$ `% S

  3. - M; i1 g* q5 ?: a: f: x
  4. #include "stdafx.h"0 {9 ^5 W0 [3 ^' W6 n, B  A5 C$ j1 u
  5. #include <iostream>
    # p) Q9 K2 ?* ?
  6. #include <Windows.h>
    / }  h7 A7 J' L2 A" P* b2 j
  7. #include <io.h>
    ) i0 Y2 W0 J- e5 [

  8. 8 Z4 F- \5 L# A. s0 Y
  9. ' h% I9 _) F4 ]2 U5 d
  10. int _tmain(int argc, _TCHAR* argv[])
    * O  R: s3 Q' M; G: K
  11. {
    / k' d& b) \% d9 K0 h% w9 Y1 u1 i/ H/ M
  12.         printf("Dekaron-Server Launcher by Toasty\n");2 L/ T: s! q% P1 ^9 W

  13. * @, ^) x3 ~: r% J2 H$ Q
  14.         //查看文件“DekaronServer.exe”是否存在
    $ t/ H0 R+ c. ~$ e
  15.         if(_access("DekaronServer.exe", 0) == -1)
    . @- x+ E; P8 q8 M( m# o
  16.         {3 ?! Q" x2 e9 q1 i( T# G$ S
  17.                 printf("DekaronServer.exe not found!\n");
    8 C# U" O" O. c2 L, g& R  q  G
  18.                 printf("Program will close in 5seconds\n");
    - n1 L2 q, X8 v( X+ ~
  19.                 Sleep(5000);
    ! f4 g& O* T! K$ A1 r
  20.         }: _1 w; d# P5 o4 k& E4 _
  21.         else
    ) z" X/ v2 T" N9 j3 w$ D( R
  22.         {* W0 w9 \4 p# p7 C: X! }
  23.                
      @! @6 a$ d& L8 c3 A, ?; R! y; b
  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
    % `7 }: f& m. ~* Z
  25.                 STARTUPINFO si;7 f* y' q) }7 g; {6 R

  26. : M% O0 _; e, k2 p" P
  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
    ( b+ @, p  ]4 B# _( g- ]6 l! m7 R
  28.                 PROCESS_INFORMATION pi;) @3 _4 J, j1 [% z& W8 V3 w* R
  29. 1 q# A) _+ K/ I6 w
  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; O8 C  [) V) e! u) Q5 O
  31.                 DEBUG_EVENT dbge;/ E- u) s  }/ z: v! M

  32. * O4 p0 J& B8 w
  33.                 //Commandline that will used at CreateProcess
    " A# L. A  S6 ^
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));& S$ l2 [; m0 S# P1 n

  35. + i0 y  U& A, Q, q- v) E
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)* h! l6 d1 _7 ~, S% N
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)& r+ _8 S9 l* G+ H( ^
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    0 L( e- A$ h+ I, E* N
  39. + Y9 y" x- K1 n8 M& }" M

  40. 5 f9 S4 c8 b2 C; d% ]* n

  41. * G) a* {1 T2 M( m- b% l
  42.                 //Start DekaronServer.exe ; P$ ^! R3 ?6 {" Y
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    1 U/ ^7 N! g7 q" G. X0 n% c
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)+ h- l- y- ]  X1 Y
  45.                         szCmdline,        // Command line
    3 J/ \  p% J; ]: Z  i! Z: p
  46.                         NULL,           // Process handle not inheritable
    * S0 A: g/ h4 f2 p) h4 a
  47.                         NULL,           // Thread handle not inheritable
    4 ~, Q" m- K4 @( M. M3 V9 K  |! r
  48.                         FALSE,          // Set handle inheritance to FALSE
    9 J5 _# S+ P6 W! i
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    8 Q4 C) _. d# c- @
  50.                         NULL,           // Use parent's environment block
    6 T& T$ Q: ]  z  g+ p' n# L9 L# G
  51.                         NULL,           // Use parent's starting directory
    ( o& ~) i7 T* z1 O' L+ b" Z
  52.                         &si,            // Pointer to STARTUPINFO structure
    ; w! C3 b8 Y7 x6 G, G9 T
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    : h6 R7 {! Q% H7 b' _
  54.                 )
    4 H* |: e  I2 z
  55.                 {
    . ?+ x( I- l  q5 E* s* x
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );) W7 d6 m6 `# a2 J! V
  57.                         return 0;# |3 y+ I% m4 m& ?
  58.                 }5 f8 L( K3 V1 @( z- M
  59.                 //Creating Process was sucessful) f; c6 n" A; V
  60.                 else$ [( Q4 B2 Z+ j
  61.                 {: t6 s! a& d4 U6 F/ [
  62.                         printf("Sucessfully launched DekaronServer.exe\n");* \* I8 p; E* b2 J" @

  63. 9 q6 M. f; H* d% e! r" O
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    % w0 g/ T7 q/ X1 X
  65.                         dbge.dwProcessId = pi.dwProcessId;% w' V4 c+ w  M3 q+ U3 e% u1 {8 j
  66.                         dbge.dwProcessId = pi.dwThreadId;6 b' `2 {8 l4 u* p
  67. : O3 S% o/ n% p
  68.                         while(true) //infinite loop ("Debugger")
    : `# }: g0 k4 K* I
  69.                         {
    6 [0 V( l, S( ~4 [, _
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx" t4 \2 h8 W0 @  \7 ]
  71. 7 N1 E% t2 U  Y" i  P3 {
  72.                                 /*
    ; V) m8 j  C- F3 ]% \2 A, U
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
7 o; J* b% J6 s  H

* U1 n4 y, l( |* S) {
' W& D1 c( u8 a) u* @/ d8 e
商业服务端 登录器 网站 出售

15

主题

256

回帖

1259

积分

金牌会员

积分
1259
金钱
865
贡献
118
注册时间
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

回帖

1259

积分

金牌会员

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

3

主题

102

回帖

6321

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-4 15:56 , Processed in 0.066635 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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