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

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

[复制链接]

161

主题

389

回帖

7509

积分

管理员

积分
7509
金钱
2167
贡献
4792
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
2 |0 F0 `7 Y3 O7 a( N3 k# d) W
6 c, F/ o! c( ~( S. y" B虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
+ V; t: c! w: D" u# }
+ \$ s2 }6 U, c# v+ k
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    8 Y, s0 d2 f3 _. I+ o% ~
  2. //4 Z5 J- Z3 A, y! S) M
  3. 1 c4 v3 M. ~6 {2 T
  4. #include "stdafx.h"/ l( T1 U4 \- o0 x
  5. #include <iostream>
    " ~, I" C. k' @( D5 S
  6. #include <Windows.h>
    6 X4 M; j9 w# h. E# m
  7. #include <io.h>
    * l: }0 O6 r- g- x! i) G6 R

  8. + K0 W2 Q2 Q7 Y; T0 s

  9. , V% j; i% C* X8 I7 T% ]# B$ T
  10. int _tmain(int argc, _TCHAR* argv[])
    4 E! n! o$ a8 m0 x
  11. {
    ' L4 n+ a9 U: A& ^" E, O6 ^' G# F
  12.         printf("Dekaron-Server Launcher by Toasty\n");9 u( A5 t' u& w" b4 v1 e

  13. - g" N6 g: r& s5 A  `
  14.         //查看文件“DekaronServer.exe”是否存在* |0 g/ {# t( V" h
  15.         if(_access("DekaronServer.exe", 0) == -1)
    ! K2 M; k% }" q$ f, u
  16.         {
    ' s( P4 ^3 ?- f  |& e! a. k, E# ^% {
  17.                 printf("DekaronServer.exe not found!\n");* g. e3 ]# e- B( n
  18.                 printf("Program will close in 5seconds\n");
    ' V0 r. l, V  u" g& Q) c; G
  19.                 Sleep(5000);
    ' [" X: T; U0 w
  20.         }% U" F6 _7 x2 G) c. |" h$ F3 u1 u2 `
  21.         else
    . B7 b$ E# E( e' `/ I, j$ v
  22.         {7 ]& {4 k% E, S1 y
  23.                 1 Y$ q4 Z+ E. G- Q  a* L
  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).aspx1 s4 D; u% U: F: F
  25.                 STARTUPINFO si;- d; G0 P) J, M% D& [; D* U

  26. 4 h- p1 Y+ K% ^: U6 b, h7 B& S& Z
  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
      I1 M: R- M3 s! G4 g
  28.                 PROCESS_INFORMATION pi;
    5 g& w$ q' C, @6 b- b

  29. # r# M! w9 _5 g6 t
  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
    - Z6 W) ?+ [+ Z
  31.                 DEBUG_EVENT dbge;1 e, @: O' p$ ]+ f2 _/ A) l3 j
  32. % g  k9 v( ~9 U$ ?
  33.                 //Commandline that will used at CreateProcess6 p2 O' U( N3 V, h# s0 ~! Y7 u
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    # i  r1 @2 n. }" S& W

  35. $ g+ Y. K" j, v. J5 Q; O+ j; \
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)6 @4 D( |/ {7 G8 [
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    - e9 g9 m; d3 b
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    2 s! ?3 e) x* e7 N* L7 J; g
  39. + j- `* B+ \9 B

  40. 1 Y4 \0 g2 v, G8 E4 T
  41. ' |& Z$ |2 A) K0 B8 {3 m. \
  42.                 //Start DekaronServer.exe & N3 Z; G7 j3 Z; x7 @7 ?+ f
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    & s) v* ~8 _9 J* A
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    & \" d3 S2 j" ?  R
  45.                         szCmdline,        // Command line  i) z+ Z3 O7 W, z5 ^, Q
  46.                         NULL,           // Process handle not inheritable' `+ J! h9 _5 R2 \1 i: h
  47.                         NULL,           // Thread handle not inheritable
    1 Z0 H  C; L* f; b5 y
  48.                         FALSE,          // Set handle inheritance to FALSE
    + ]3 _  b9 E6 }1 t' M0 O
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    7 f7 ]3 X- w1 E# U
  50.                         NULL,           // Use parent's environment block
    ( ?$ k. q  n! H' \5 n: _% D1 n
  51.                         NULL,           // Use parent's starting directory
    . w; Y; I- I6 o( J6 a
  52.                         &si,            // Pointer to STARTUPINFO structure
    9 T# a$ E# ]/ Y7 ~. B' T
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure6 x9 b; \6 Q5 n$ v$ P1 |1 S* T
  54.                 )
    % y/ j! m4 M1 v
  55.                 {; `4 U7 G3 b5 R& E; N9 Y  z: e
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    4 c; j% @8 E& f! p3 A( E* W, @$ F
  57.                         return 0;
    # r- g( t0 M3 {: P# d5 F1 t, E
  58.                 }9 c; x- N1 s/ n$ s" x6 Y
  59.                 //Creating Process was sucessful
    & o0 q; i% s2 z
  60.                 else
    ' D" I+ o( h" z
  61.                 {* C% L# Q* r( y  q
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    % A* Q- m" y+ A# E/ G1 v5 r

  63. ! e9 C3 l- x6 \) {, x9 k
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    * O  k3 l% j% M% r" l
  65.                         dbge.dwProcessId = pi.dwProcessId;2 o( O- K* T9 n
  66.                         dbge.dwProcessId = pi.dwThreadId;
    : ^0 H% ^# q* E+ E

  67. 4 p# ~! f( b. c9 a+ W- u
  68.                         while(true) //infinite loop ("Debugger")( ^6 o+ P2 h, @( K2 I
  69.                         {* |4 I% h5 `" q( y! f* A% P1 n
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx# i7 R: a6 C9 `" z2 S* X4 |. ~
  71. ( s. P+ h5 O6 O3 m  E8 ?+ k
  72.                                 /*7 M5 c5 Y* p, }; A; G
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

* u+ T1 M5 S/ h5 J- D7 v
$ I" a$ K+ S% R$ G1 l" g
* S! [, x4 c6 u6 B* Q: _
商业服务端 登录器 网站 出售

15

主题

260

回帖

1313

积分

金牌会员

积分
1313
金钱
945
贡献
88
注册时间
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

回帖

355

积分

中级会员

积分
355
金钱
142
贡献
6
注册时间
2024-5-14
发表于 2024-5-14 15:56:57 | 显示全部楼层
学习学习赞赞赞

15

主题

260

回帖

1313

积分

金牌会员

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

3

主题

102

回帖

8257

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-5-18 15:17 , Processed in 0.042161 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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