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

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

[复制链接]

157

主题

367

回帖

7119

积分

管理员

积分
7119
金钱
2043
贡献
4552
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 4 j1 F" B! i9 E# i

" M6 i. e' f+ @# z5 F5 Y" j虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
- J, T  b4 h' t9 r7 q- O8 a" `2 m( N
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。+ F$ n& L" c' }4 G9 B+ ]' L- l
  2. //
    5 ~$ o" Q/ p( f7 ^2 m- m: f, e, O

  3. " G, V1 S# Q0 T$ e" t! ]( X; C
  4. #include "stdafx.h"; ^' m4 \2 z# i8 l. D0 r0 f
  5. #include <iostream>  A6 H2 A0 n2 h% O
  6. #include <Windows.h>
    $ u% v, `5 G; I
  7. #include <io.h>7 I" O9 x1 k  x% z% {" ^
  8. * @3 _* A6 D. ?5 I, a$ d, b

  9. % J' e- P2 p) {! X" \, J, a
  10. int _tmain(int argc, _TCHAR* argv[])
    # E6 n' M; d- h+ V; j
  11. {* ^/ J/ _2 k& K- z% ]  n4 \
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    - [  k' x) _4 b+ E

  13. ! Q: K; s, v7 M* Q; P: I" m8 Z2 A& e
  14.         //查看文件“DekaronServer.exe”是否存在, |; u# a* ^. ~. g
  15.         if(_access("DekaronServer.exe", 0) == -1)
    : z& r# y! `: U0 s
  16.         {
    9 Z+ {& t# l- e& V+ J( K: v) ^
  17.                 printf("DekaronServer.exe not found!\n");4 D6 r4 P. ~, Q% C& {
  18.                 printf("Program will close in 5seconds\n");
    3 V8 V& E6 M, N* I3 Y, a
  19.                 Sleep(5000);* X( d5 }1 m8 x! T4 Z
  20.         }
    6 Z: U. ?; ?0 m: L7 Z
  21.         else
    1 Z" `: ], S- Z8 G
  22.         {
    & q( H  R6 T& t& N
  23.                
    4 P8 u! O! d) s5 F' _: y
  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/ w6 w5 X9 `) K5 H( ^9 O. N6 v
  25.                 STARTUPINFO si;
      x% q6 w1 O: X; b( D* r; {+ P
  26. ; i- a1 T; `3 _/ ?. ^4 q# s, T% G" `" V
  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" [: x: K( ~# @) e6 O
  28.                 PROCESS_INFORMATION pi;
    0 g, D" u; i5 r) R; @' i1 o
  29. 8 v( u; C' m9 B; h6 I9 u% F4 a: {
  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
    * J$ I# U$ r# l$ e8 T& ^0 D
  31.                 DEBUG_EVENT dbge;
    7 h9 x& u3 L0 @, _0 I
  32. ; w6 ~" k( K* c5 _+ U
  33.                 //Commandline that will used at CreateProcess  g0 a) H6 [: b6 c! e4 j+ B
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    5 m% F+ d3 T! W% j- @8 p1 a

  35. - q9 M% L# i- j; P
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    2 |( v1 M4 B- X0 a$ e
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    2 ^4 A' O; i8 @( m+ {3 i
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)' M: j# I: S( X

  39. + q. s2 C* A$ c
  40. , u4 m% o, G! L9 f9 z0 I4 q- a

  41. & o( J( `; ~. J1 P! k
  42.                 //Start DekaronServer.exe - i. ~2 j6 `# n% E
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    # _, ^( q4 ], }7 X
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    $ A  o9 n, n; J; }: Y
  45.                         szCmdline,        // Command line- r7 O4 q6 x' m9 V# ^) `: T
  46.                         NULL,           // Process handle not inheritable
    3 t4 Z4 X7 c5 f* |' f" `' A
  47.                         NULL,           // Thread handle not inheritable6 R0 o# j  J- [2 t$ ]2 p3 U
  48.                         FALSE,          // Set handle inheritance to FALSE5 d  P0 q$ Z- }$ a' }$ C, _+ j
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx3 n, P* ^# m. w  q
  50.                         NULL,           // Use parent's environment block. s1 l6 ]8 o( y: z9 c
  51.                         NULL,           // Use parent's starting directory * T" n2 L8 k: h: F7 k5 j
  52.                         &si,            // Pointer to STARTUPINFO structure9 R' s' `+ p2 u8 D
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure; L% X' l) V# x3 Q
  54.                 )
    0 t  T; Z4 S7 h2 v+ v/ V( Q
  55.                 {9 K# u9 p# P8 N& k' q) e# ]% v0 U
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );6 L$ ]* `+ g" P% C- m, [) }
  57.                         return 0;4 ?! }7 W; Q. i2 {- n4 P
  58.                 }
    6 y  y# b+ e  A' _
  59.                 //Creating Process was sucessful
    ; _/ A5 J2 L9 H" ~( [
  60.                 else$ h" B' M. c0 }4 F3 X% }" q
  61.                 {) Z% X) e3 o9 P6 T/ L$ Y% n: G
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    0 ], u% d7 y; S& Q
  63. * j3 c  r) K/ o& }
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
      E; M! ?( s: ?; d
  65.                         dbge.dwProcessId = pi.dwProcessId;+ R9 D* `4 I! f5 r8 ?
  66.                         dbge.dwProcessId = pi.dwThreadId;$ o. G+ l' k% D
  67.   r$ I8 F( ~0 j% U, v" U
  68.                         while(true) //infinite loop ("Debugger")# [! P( S  F' t: C/ ~+ O2 N
  69.                         {; S, a/ p+ V7 m
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx( A# O, n+ n% v8 B+ I; |, D6 K

  71. 4 s6 A$ V: j! W# e
  72.                                 /*
    4 c2 q4 E: g& A( D+ {: ~% A6 N) _+ v
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
) t' \$ h" W$ a# l* ^6 Y2 [# @

  s9 U: \) d9 ^: r# k8 p* B' a7 m; p- o8 w6 [# B
商业服务端 登录器 网站 出售

15

主题

258

回帖

1245

积分

金牌会员

积分
1245
金钱
903
贡献
64
注册时间
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

主题

258

回帖

1245

积分

金牌会员

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

3

主题

102

回帖

7357

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-3 04:15 , Processed in 0.046963 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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