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

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

[复制链接]

160

主题

385

回帖

7408

积分

管理员

积分
7408
金钱
2123
贡献
4740
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 9 e6 a0 ^; M6 f9 f8 o7 T0 M

7 Q4 B1 s" {/ ]+ }虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
/ D$ o! ?5 Z9 R, r. U3 }9 E& Y0 s9 A3 j+ w* q5 Q2 `- i: l
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    ' h1 _, b& R) c" G2 ]3 g
  2. //6 ]( K4 K& t1 b1 V0 x
  3. ; }" H2 b7 r1 |
  4. #include "stdafx.h"
    % ^: X+ Z( ?" R8 M
  5. #include <iostream>4 e: W9 H" K/ I
  6. #include <Windows.h>
    0 B* t' D! Z3 R/ O
  7. #include <io.h>/ S( n& K8 c8 g5 z7 M6 i* I

  8. " M( F& F. X- [' h3 t9 Z' _2 I

  9. 9 j/ S$ @4 q. ]; B, f  G/ ^# B
  10. int _tmain(int argc, _TCHAR* argv[]). X1 @" Y$ p/ Y- O/ k4 q9 u
  11. {- R2 p/ m, D) H, J0 {9 r( u
  12.         printf("Dekaron-Server Launcher by Toasty\n");* u, N4 R4 f: ~  T
  13. + c8 ]& [* n/ q$ \8 v0 o, Y
  14.         //查看文件“DekaronServer.exe”是否存在# ~8 D& U  j$ R- A! @9 {& ]
  15.         if(_access("DekaronServer.exe", 0) == -1)7 Z, C+ W4 }2 q
  16.         {
    & [( `' M% a" X3 p7 H6 q
  17.                 printf("DekaronServer.exe not found!\n");
    ( F: z; H- w- M
  18.                 printf("Program will close in 5seconds\n");$ N5 _; D* p3 e/ q
  19.                 Sleep(5000);3 L9 G! m) _6 S
  20.         }
    - W7 x4 y4 V) ~
  21.         else$ `$ p! I( v& e0 I& c( b8 z
  22.         {
    ; x1 B' T* |+ ?( A4 q/ I) z
  23.                
    & P1 c4 Z# y, R9 o
  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
    0 U; p0 \* X0 u* ]/ A0 z
  25.                 STARTUPINFO si;
      ^! m, W5 h7 l2 `+ l& G" ?1 g

  26. 4 T0 m/ {- f4 ~) A9 S
  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
    ) s  x5 s. n# M% t4 D" E- N
  28.                 PROCESS_INFORMATION pi;4 l/ v+ _- A- T! f3 P9 h1 y; T: g, m8 S
  29. 6 |$ y% r. `) [
  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).aspx5 \$ k: d( H7 \( r8 J
  31.                 DEBUG_EVENT dbge;
    " W. U+ b/ w6 M. H
  32. / _8 v0 I9 ?) P/ b
  33.                 //Commandline that will used at CreateProcess% ~0 \7 _' F0 W8 E  `7 ]% k
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));! p* N0 M: y8 m

  35. 9 u5 |# F5 K% j2 d$ H& F
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)# y3 ~* S6 W: |( {; V
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    3 H# m9 G8 {) t9 u
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    6 S* ^& D7 a2 I

  39. ( F# }9 X$ l& E  ^% i0 ~- _: y

  40. 0 g/ v4 F. C+ c2 _) U0 O

  41. ' N3 Y+ b( K4 O- a1 b4 Q1 ]
  42.                 //Start DekaronServer.exe
    " i7 n; H; n0 u2 T! z% c
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    0 L2 ]1 @% M4 i: T' d
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    9 e1 W8 A. t) h; @
  45.                         szCmdline,        // Command line
    3 @2 b1 o* q; D. M, T5 P( A
  46.                         NULL,           // Process handle not inheritable
    5 f  p$ F" |- y; n9 [
  47.                         NULL,           // Thread handle not inheritable
      K+ N, ?$ t: N: w( p3 _5 f
  48.                         FALSE,          // Set handle inheritance to FALSE
    ' h; ?. }5 A& p! [. M
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    - s5 g/ G/ y+ U, ~- |# H  L4 a1 u* ~
  50.                         NULL,           // Use parent's environment block# l/ ^# N. R) H" U# F1 u
  51.                         NULL,           // Use parent's starting directory / G6 W8 _0 y; C' y1 p3 N& t" ]
  52.                         &si,            // Pointer to STARTUPINFO structure" G0 t* R& a/ ?& G
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure2 C& f. a& {. ^, Z( x3 O
  54.                 )
    6 f" h- R& ~# N1 }. Y+ V8 `: m
  55.                 {' a; S9 Q$ ^- E5 G0 y
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );4 t/ q9 C, @1 B; @, L  ?1 n* S' s8 ~
  57.                         return 0;' q# w: y* }( o' J# U# h1 s
  58.                 }. ^; V9 j6 ?5 R0 b& s; r# B
  59.                 //Creating Process was sucessful
    2 F& J4 h" R2 i9 ~* V9 P; C
  60.                 else
    & r" t$ ^8 }' F$ z& ~
  61.                 {3 d' S$ }. t; W" L5 @
  62.                         printf("Sucessfully launched DekaronServer.exe\n");  b' S5 Q6 d' p) E

  63. 8 c3 v2 U. y" K" s6 U; o
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure$ D" t/ i: c& C, A/ L4 A+ s( Y
  65.                         dbge.dwProcessId = pi.dwProcessId;
    * Q# i% ], U! N+ b. F9 v& I
  66.                         dbge.dwProcessId = pi.dwThreadId;
    2 o! z& I' A- k; L+ R1 I4 i
  67. 3 k& S7 w* U& p, x# s9 W: a& V
  68.                         while(true) //infinite loop ("Debugger")& p7 e1 h% [3 O9 x* s
  69.                         {7 `3 f, i: Q3 i7 Z1 {7 ]; O) W
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx( E+ n& i- s# f0 O1 F6 i% k

  71. + X9 M7 O0 K4 C
  72.                                 /*$ H- H' n, l9 F9 s# A7 U( e9 t
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

6 e, L5 [" X+ ]9 [; H( ^4 }- j, a/ f# Q+ @

6 \* O+ @8 u2 F0 z( J5 P
商业服务端 登录器 网站 出售

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

回帖

7817

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-26 23:31 , Processed in 0.034711 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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