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

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

[复制链接]

157

主题

362

回帖

6843

积分

管理员

积分
6843
金钱
1944
贡献
4380
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) ! B! v- o4 _% B) F3 Q
; D' p$ v3 i) J3 D1 o# b5 Y! [2 }
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
1 E( B1 H* b6 S: e7 I& |% U. E" u
. s$ O# M0 d  y  u7 C
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。: K2 k: K1 g7 y, c3 t
  2. //6 h$ u8 Y2 y0 D/ a  D

  3. , `( _4 c0 z' k
  4. #include "stdafx.h"! l7 T1 M  ~" S3 i9 w$ a0 J. Z
  5. #include <iostream>
    2 M% u5 Z" W2 L. C; y
  6. #include <Windows.h>
    8 T% G; i0 H/ W6 s% _# M% D, m  v
  7. #include <io.h>' u8 {2 u$ U9 a5 ?) {

  8. * u& q, B+ c( L  Y# {

  9. ) N! v: Q# k& t; e) P
  10. int _tmain(int argc, _TCHAR* argv[])5 L7 F9 r; w! K4 ?9 q  ?/ ^4 P
  11. {+ b8 T. N9 n  k9 e) T: H- a1 m, ~  \
  12.         printf("Dekaron-Server Launcher by Toasty\n");3 h, q  o8 l2 T0 }! i1 K# k5 j

  13. ' [! V5 l+ U- f
  14.         //查看文件“DekaronServer.exe”是否存在$ F9 p: `! M2 n4 [
  15.         if(_access("DekaronServer.exe", 0) == -1)
    ) Q- c. [* H( ~4 z; `: U1 i$ Y0 K$ H3 u
  16.         {
    6 K8 d. p) v" E% i
  17.                 printf("DekaronServer.exe not found!\n");
    , I: ^! @3 K9 `) q
  18.                 printf("Program will close in 5seconds\n");7 _. C* g0 Q- s/ y: i9 v
  19.                 Sleep(5000);: U* g4 d  u* L' s2 Z" g3 y
  20.         }
    8 l8 N0 i: n# s& Z5 m1 w
  21.         else
    1 G# R- `3 F% _8 r2 M
  22.         {1 O! v$ J' Q1 l" |: s, f
  23.                
    5 C/ R: u" B, r- t$ X
  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).aspx2 X' c9 x( {& K' K
  25.                 STARTUPINFO si;/ g9 D9 x1 F7 {( t8 w+ d# Z% M
  26. ; u3 B% }1 M/ D7 A4 I& H, x8 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
      s3 }: p8 n4 Y  ]* K4 g, F- N3 T
  28.                 PROCESS_INFORMATION pi;
    / K3 @' C' E9 |

  29. " O0 G* h( t* V- K8 r# c% f! e* x
  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
    , ?3 y/ V, Z' _2 k8 r
  31.                 DEBUG_EVENT dbge;; J! }( A. ]) c* t7 K

  32. 0 }( q5 X+ n1 Y. g9 c. `% w9 a+ B3 i* H
  33.                 //Commandline that will used at CreateProcess
    # {) d; @0 t, M4 I. r( f
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));- D* N8 |, D; @1 L, C/ Q7 Z, d/ Q/ {1 X

  35. . c' j+ C' \: g' D5 w; A; m7 |9 r
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)4 f/ l; Q2 J" W) V' ~
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)8 l; i+ E8 r) c
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    3 x4 _0 ~$ j& H# p+ [
  39. ; i- I& O0 e0 }

  40. + _8 L/ f9 F4 O: S: J$ P

  41. : B+ O* F. P7 g# K" \2 t
  42.                 //Start DekaronServer.exe
    ( \  C: T4 Z3 r# o! ]( v
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx- V! r* }% Y; a0 P
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)# E# ^2 k0 w; W" x) t
  45.                         szCmdline,        // Command line) \3 C. J/ Y' ]3 ?: X
  46.                         NULL,           // Process handle not inheritable$ S- q4 }) i$ m5 j6 Q" R1 |
  47.                         NULL,           // Thread handle not inheritable
    & h# _  I$ s# g2 G8 x6 w
  48.                         FALSE,          // Set handle inheritance to FALSE
    ) K3 U7 o" H5 a: W
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx2 E& s. Y! M$ D8 y9 I+ C
  50.                         NULL,           // Use parent's environment block! a2 `' T' G& g3 g* H; V- Y
  51.                         NULL,           // Use parent's starting directory 7 O4 Z) ~+ _8 {& n3 A$ m, R8 h9 b
  52.                         &si,            // Pointer to STARTUPINFO structure
    0 Q7 }$ M" Y% m$ M% l( Z! z, f
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure; i! V  f7 M% U( n/ v
  54.                 )
    2 c( E1 f+ U8 D4 }4 p6 v
  55.                 {
    $ V. V" Y. |  U4 j& A% u
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    + K/ f0 i; Y% f3 b! Z' [/ o
  57.                         return 0;5 ?- N. W( v% ]+ o4 K! Y
  58.                 }
    9 p5 X' s2 x$ k: a! v* D* {2 Q  k
  59.                 //Creating Process was sucessful
    & S4 A9 \1 O  N
  60.                 else
    ! k, g( b6 c) C) `
  61.                 {* z! y9 k% K+ s2 N) R; M* `
  62.                         printf("Sucessfully launched DekaronServer.exe\n");) s+ i% p# }! V4 t3 u% F7 V* x

  63. * `  q6 _1 \- w5 G* G
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    + E+ J% l6 C' b  R( Z
  65.                         dbge.dwProcessId = pi.dwProcessId;
      V+ Y+ `" Z. d  K$ v- L
  66.                         dbge.dwProcessId = pi.dwThreadId;
      Y& ~8 [8 t% h! F+ P  z0 o8 k

  67. 6 y2 D7 U1 e! B9 o
  68.                         while(true) //infinite loop ("Debugger")+ W4 t# d8 z+ f% G: P! n
  69.                         {
    " t& m8 S$ 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
    $ M: Q& d: E& }# g/ e; M* Q1 p

  71. 5 V6 C( d% y& Q7 N: Y) |( ]- K
  72.                                 /*5 [3 B7 t9 C) G2 V, Z' e
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

7 J8 g, d+ e0 M# t: _  j1 F/ ~. U$ Z# K" N' i/ n( f

) c9 q. f( Z' t4 h" e
商业服务端 登录器 网站 出售

15

主题

256

回帖

1271

积分

金牌会员

积分
1271
金钱
873
贡献
122
注册时间
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

回帖

1271

积分

金牌会员

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

3

主题

102

回帖

6561

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-16 16:17 , Processed in 0.065694 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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