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

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

[复制链接]

161

主题

389

回帖

7476

积分

管理员

积分
7476
金钱
2161
贡献
4765
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)   \3 X, s' e' C) T% C, A2 `
' K5 c7 J& X/ C1 A) Z( a  K/ }
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
/ N# o% f( }% v: E$ {2 u* G/ _" d1 @# Q6 D" q+ o7 J2 \
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
      J9 a- e/ n5 S4 J% X3 h
  2. //
    7 v! C, n$ s) J. H6 j3 n8 E/ f8 f

  3. 1 u6 G3 j  [0 |$ L
  4. #include "stdafx.h"
    # o8 W3 C( J6 r9 `# r& C! G2 }
  5. #include <iostream>
    ' \1 L; |9 n  X& L. E0 N
  6. #include <Windows.h>
    % ^7 x+ B! v/ X5 b! P# M; j
  7. #include <io.h>
    $ @" R1 z' q2 n

  8. / c3 p' g8 d8 Y# _; p& i& B

  9. * f- y8 f, m2 ~* @5 ?
  10. int _tmain(int argc, _TCHAR* argv[])
      z) i9 K& e9 r4 y! N
  11. {( _, E, \- r4 J6 c( `
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    ) m7 Z! p( G/ u* A7 e! j3 O

  13. - W+ x! r3 ?- M4 l" Y% k
  14.         //查看文件“DekaronServer.exe”是否存在
    ! m! o: k2 K! B4 B; {4 ^2 N+ Q
  15.         if(_access("DekaronServer.exe", 0) == -1)
    ; L3 o$ o7 w' N! \6 R
  16.         {& c- u4 U" y( d; t
  17.                 printf("DekaronServer.exe not found!\n");
    . k% C3 I+ f0 N
  18.                 printf("Program will close in 5seconds\n");+ j* e. i( G5 ^( Z. I* d0 g5 F. r) t
  19.                 Sleep(5000);  Z3 p* m1 T  ~0 D0 V) H
  20.         }
    , A. m* M$ S1 J/ K% x. _
  21.         else
    + Y, B* M, J6 L9 W
  22.         {" R  Y+ a2 f6 T2 A& K7 g# H
  23.                 6 T/ A  k+ a6 D  \
  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
    ; o3 @( N3 ]# x1 d& {0 v0 a0 k
  25.                 STARTUPINFO si;- e* \+ U  ^4 V1 {% z9 Y
  26. # `1 D5 O# a# @+ {
  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* ~: o' [0 O; q2 _5 m  s
  28.                 PROCESS_INFORMATION pi;# s( [8 w0 Z4 v7 a
  29. 7 j$ u8 V) l1 ]# I* L- B
  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
    / C% E7 [1 D% r0 t3 N
  31.                 DEBUG_EVENT dbge;* a+ K) L, z6 T/ j. D

  32. ' t6 X" Q5 F# w" x
  33.                 //Commandline that will used at CreateProcess
    8 l. G) t. O7 g- Z; j
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    . m9 j1 _1 [8 c6 v1 S

  35. ' [& a/ h1 k- E+ D- W6 m/ P
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    6 m$ k) Y) P5 z
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    ) h5 o( J8 h* a% u& o+ l* C* M
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    $ M/ Q% t* b/ a2 ]; D& J
  39. 5 j- A% _, a: W- o3 H

  40. 3 x3 B2 N0 [- R5 E: m0 U0 z" Y
  41. ( h! }; |0 i% w. y! c% G0 }
  42.                 //Start DekaronServer.exe
    $ |7 r" ~  S5 [7 o& b2 C% H( p
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx9 g- t. P" ]9 K, N5 ?
  44.                 if( !CreateProcess( NULL,   // No module name (use command line): r  Y) H- W2 b: I
  45.                         szCmdline,        // Command line4 D  i# ?: N2 W# r% c/ x
  46.                         NULL,           // Process handle not inheritable4 q$ G/ Y5 ~8 L% a6 B1 h
  47.                         NULL,           // Thread handle not inheritable% Y$ X' o1 L% _( o, Y2 I) r( _
  48.                         FALSE,          // Set handle inheritance to FALSE
    7 R# w+ X1 q: c2 h% {/ P1 p/ C  w
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx4 s( z' U0 `' B( o
  50.                         NULL,           // Use parent's environment block$ @3 J- n/ A2 S- g
  51.                         NULL,           // Use parent's starting directory
    * a) ~0 S/ i4 P# Z* s
  52.                         &si,            // Pointer to STARTUPINFO structure& l7 ?* C- G( `: t
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
      f7 C! L3 O" f- K/ W+ w  y: E1 M
  54.                 )
    9 O1 c% I) b  g/ p! q) E
  55.                 {+ K$ T" m7 I; J2 s% t- j
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    0 r$ _9 V  ?  ~. S0 u. C  [
  57.                         return 0;, u" v+ O- b7 m# J4 ^& k$ m
  58.                 }
    0 V; M; Z- r4 i, @$ h0 E" O
  59.                 //Creating Process was sucessful7 t/ C- M/ Z& M+ T$ k
  60.                 else
    . }& |; y7 i2 q8 C+ T
  61.                 {0 _: Y# y0 a" \( t
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    ( D/ X0 Z% D5 h5 @1 E
  63. $ ?7 l+ A) R- I- G/ @& C
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure% g5 A7 F# H7 |. M) c9 G* u
  65.                         dbge.dwProcessId = pi.dwProcessId;; o) m$ N. ~6 a% u( ?
  66.                         dbge.dwProcessId = pi.dwThreadId;( e8 x' x) z- I$ I# b8 [! \3 ?

  67. $ H+ c: M% a% q) r/ \) |
  68.                         while(true) //infinite loop ("Debugger")& e2 r& h+ D) Q7 i/ l$ d2 s
  69.                         {4 g6 q7 b2 k  s/ F; d
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx% U* j; z# t$ {. b' V  E) ]5 Q3 x
  71. . |$ d; Z' M4 b# W
  72.                                 /*8 L: [3 {+ A+ O( }& r9 @' x
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
4 }& `2 ?' o9 ?8 j/ P0 k% X% W
9 `/ L- ]4 c8 Y) n8 H
* `% m. S# X6 I" C% A5 S/ E: a) U  P; K
商业服务端 登录器 网站 出售

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

回帖

8157

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-5-13 22:19 , Processed in 0.033028 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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