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

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

[复制链接]

160

主题

384

回帖

7382

积分

管理员

积分
7382
金钱
2118
贡献
4720
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) , p& j) I- M  y) p+ q& U$ a/ O
* [$ n3 Y+ O) @2 F+ n" ~4 T* S
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
  H. C1 Z; n4 N+ U" D; Y4 O% ]1 c0 Z1 z/ _( Y6 A
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。# \9 j3 R8 g9 {  Y) `: s
  2. //# ?, r1 `! u( f  C( H- R/ c
  3. % a1 M/ t# u" w, h" s4 O! J- L
  4. #include "stdafx.h", u# w1 x" Z' t* Q5 o8 o
  5. #include <iostream>; J" f3 b- \9 c: M4 \9 r; s
  6. #include <Windows.h>
    1 O1 _5 X# y; P6 p* J, n
  7. #include <io.h>
    % w0 b7 `' I  H4 d$ k

  8. , I  E' ^# I/ u4 I8 M" W
  9. 9 L7 E9 ^# _+ ~3 {4 k
  10. int _tmain(int argc, _TCHAR* argv[])
    9 l- }3 I% h& r* _2 p! T8 C
  11. {
    , X8 t; ]8 A% K. p: f
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    9 [* G1 v2 f) M2 @2 w% H
  13. # r4 ~9 [( A! I3 y
  14.         //查看文件“DekaronServer.exe”是否存在
    / W3 a. P4 @" o. z% Z
  15.         if(_access("DekaronServer.exe", 0) == -1)
    , g  D1 d, K# P+ P( J
  16.         {1 k. {3 j5 p# D+ O& Z
  17.                 printf("DekaronServer.exe not found!\n");
    % [# s1 q2 X/ G& Y; e
  18.                 printf("Program will close in 5seconds\n");
    % o" g' x: q" q% T
  19.                 Sleep(5000);: ~  N$ g6 Q" @4 o4 Y4 A
  20.         }
    8 R- y5 U, c8 W: C/ O/ o. B
  21.         else
    ) ]9 m& H- M) E8 t0 ~) `
  22.         {
    8 Q( v: e5 h* Q$ K: o
  23.                 2 O" [- Y( \2 c' E
  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/ D/ x+ Z0 a" Q8 Z3 [0 U  O
  25.                 STARTUPINFO si;  J9 p; N6 U( p1 {) F) `/ [

  26. / m& T, G* |; |; U
  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$ E- K' x  k2 p# _/ E
  28.                 PROCESS_INFORMATION pi;
    ! c- `7 w: B7 P3 K- ?- ^

  29. ! D" _# C1 ^' O6 v
  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).aspx3 x+ h9 Y" H( T' m( c# v
  31.                 DEBUG_EVENT dbge;
    - ?+ {/ d8 S' d# Z2 K' g# ~6 F
  32. & \' l! R( B& O( M2 o6 @' }' O
  33.                 //Commandline that will used at CreateProcess
    ! ~0 m& |% H7 d; `
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));9 N( l" |5 T3 W7 ^4 l6 W+ U" V% u

  35. 6 d2 ^- Y" k& D* i, B
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)- c: b9 T: o# n
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)  D$ e' \+ L" W. e2 _$ N; f
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)/ n9 V: f9 |. D0 s
  39.   Y# X* ]( ^9 Q2 K& r

  40. 4 j) {; Y' a* Y9 {  b$ P

  41. 5 f3 x8 ]  T! A% T( B
  42.                 //Start DekaronServer.exe
    / _, Q' O: X4 ^1 c
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    3 R$ d7 U( W& F9 S0 K& y
  44.                 if( !CreateProcess( NULL,   // No module name (use command line). c) Y# G7 ], X9 {3 p% z3 k( d
  45.                         szCmdline,        // Command line
    9 w8 W% i( o8 z3 [  {
  46.                         NULL,           // Process handle not inheritable4 G! `/ \4 d; ~
  47.                         NULL,           // Thread handle not inheritable2 \0 y. B7 o, q0 Z
  48.                         FALSE,          // Set handle inheritance to FALSE
    : h9 R9 V' E& `7 @5 Q
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx7 _1 R0 M# v/ q% B, f
  50.                         NULL,           // Use parent's environment block5 q) m/ r( f+ E# z: ?( F
  51.                         NULL,           // Use parent's starting directory " j* n0 X; X) s" s$ ^
  52.                         &si,            // Pointer to STARTUPINFO structure6 d' r* K; Y5 Q
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    # d% a* t8 h0 b, |6 x) ?
  54.                 )
    & ^% K% m# [. I5 m# @
  55.                 {
    . k9 E: R0 M5 P2 y3 r# e  \
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    3 B2 y3 R4 R; ?* X8 N
  57.                         return 0;2 a# y6 b4 O6 U& {5 w/ q
  58.                 }! J1 g9 X6 [7 \6 S" D. ^( @
  59.                 //Creating Process was sucessful8 ~( x; k; H* X" y3 s& Q3 Y3 Y
  60.                 else
    / T/ g) h) o- O: Z, T; a
  61.                 {1 H1 i; h! W" B9 |
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    6 o, `1 c( S$ o8 v* S

  63. " z+ q1 k! ?2 f
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure6 N! l: l# d! ~7 w( t* F; T
  65.                         dbge.dwProcessId = pi.dwProcessId;
      I* q4 K: F# s9 T  I- M
  66.                         dbge.dwProcessId = pi.dwThreadId;
    $ L1 R' b' V: }6 C5 U/ Q( N& |9 w

  67. 7 k1 Y1 |& U$ ^1 ~$ [  }6 f
  68.                         while(true) //infinite loop ("Debugger"): c& c- Q9 J9 C" ?6 {' X( O
  69.                         {0 N$ p/ B$ U7 q9 t* {$ [3 s" B
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx1 O7 W+ f8 Z+ U7 e
  71. 9 U5 o7 F) @9 Y$ Y8 N4 N
  72.                                 /*0 p5 G# U9 x& L; Q
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
& v9 o& h+ m2 m7 j  D/ _5 o

9 m  Z' F' _  J8 B/ U) q: b8 ~* `7 ]4 g( {* t( a8 N, E7 ^
商业服务端 登录器 网站 出售

15

主题

259

回帖

1275

积分

金牌会员

积分
1275
金钱
920
贡献
76
注册时间
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

主题

259

回帖

1275

积分

金牌会员

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

3

主题

102

回帖

7777

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-24 11:36 , Processed in 0.037799 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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