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

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

[复制链接]

157

主题

364

回帖

6955

积分

管理员

积分
6955
金钱
1986
贡献
4448
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) & o5 @/ _$ ^0 ~1 k# e4 r7 s

) V( m9 o5 m+ ~" W% C1 n# n虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
% }( V* V4 ^1 n! M& y' F' l0 a: \# G6 C' Y2 S5 D; W
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    0 P# ?+ o5 b& ^* e  B) E. x. u
  2. //# R  B- g4 ?7 z) G& M& S* g0 {0 w

  3. " M, T0 p- m& g" r1 f# ^' e& {
  4. #include "stdafx.h"
    " L2 _4 F. d8 [
  5. #include <iostream>$ D$ O' B) |6 N3 E
  6. #include <Windows.h>
    ' W7 L9 O0 {0 \4 M$ f2 g5 Z: ~1 k* ]: }
  7. #include <io.h>
    9 @/ \, `* s. m5 X$ q+ d! l

  8. 2 j# W$ H3 c! }% N

  9. * N6 ^* m( D% K
  10. int _tmain(int argc, _TCHAR* argv[])
    " H' ]+ e  V" e1 j6 E  N
  11. {
    ) V7 P# M: N) A9 O, F. v$ K- R
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    ! N: v; `) z' l" E2 S

  13. " }) z! Z" a" i1 T3 ?
  14.         //查看文件“DekaronServer.exe”是否存在
    # n4 R" k) h, v% I7 \: @$ X- m  G
  15.         if(_access("DekaronServer.exe", 0) == -1)% l, K8 p+ K) X
  16.         {& ?( X- t: b5 H4 t% Z2 e# J! H
  17.                 printf("DekaronServer.exe not found!\n");
    . H! c: A  f$ w- [8 y
  18.                 printf("Program will close in 5seconds\n");& t# a7 U* b6 q% f
  19.                 Sleep(5000);
    # w7 i) R/ }5 v8 ^. v% e4 _
  20.         }
    & e- H8 V  i% ^# U+ n9 q3 Z
  21.         else  O6 C, D( ~7 {9 O4 ]; L' M
  22.         {. h$ @0 ?$ S& T, U/ t: C
  23.                
    # i! M2 R9 g. I# u4 s1 v: 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" a$ T  q2 l. k0 L8 G& e
  25.                 STARTUPINFO si;
    7 P# U' Z4 Y; J1 _
  26. : T2 X6 a/ ~& k" w  f- R
  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).aspx6 \3 B+ ^7 w# J
  28.                 PROCESS_INFORMATION pi;$ u# Q: F4 R/ S$ {
  29. . d& {! z# c7 A9 d
  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% d3 g( |9 m& I# S, Z
  31.                 DEBUG_EVENT dbge;
    & A& n: M5 z) q' P" e
  32. 1 B( M1 H; K. z  C, C7 q
  33.                 //Commandline that will used at CreateProcess/ _, g. P' P8 H
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));0 D2 T! r7 ^. x! s
  35.   x' U8 g) L' I: Q
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    / H/ z3 [4 L* E- k( K: D
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)3 u  X$ r8 `* c2 V; L
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    , z2 x, a1 C  X7 ~* V1 Y

  39. ' d8 |0 y+ m+ f- o  @/ k* I: R
  40. : C) T0 e9 K7 k3 B; ?

  41. & c4 U6 d  v6 m' k) c" ?* m* Y
  42.                 //Start DekaronServer.exe % Q1 Q* l5 Q/ c0 l4 J
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    " n2 U* m: r) y& s# q
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)' T8 b% Q8 d9 Z& U1 V- s8 V9 b6 u
  45.                         szCmdline,        // Command line
    / W' a- @+ a' w0 Y. B5 o
  46.                         NULL,           // Process handle not inheritable
    / o8 S  }$ \( J) |6 M
  47.                         NULL,           // Thread handle not inheritable
    & e6 p( B) J4 }$ M' Q: ]7 q
  48.                         FALSE,          // Set handle inheritance to FALSE
    ) L" K% s1 [0 ^3 F& ?' i+ m
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx- q# \. c: F, e) L2 [! h
  50.                         NULL,           // Use parent's environment block0 a# @3 @7 u* d( q& R
  51.                         NULL,           // Use parent's starting directory ! g3 m# F$ T& O, q
  52.                         &si,            // Pointer to STARTUPINFO structure4 ?. B& n6 G* W9 P$ t9 |& y
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    1 K8 ]) g) b; ~" L8 U, L
  54.                 )
    & D$ j' ]! a  _5 K$ d( I& Z. @
  55.                 {9 g/ i- T0 C& C! p+ i) ?" Y: E
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );& E; h( u) a; f) @
  57.                         return 0;
    & m  r& R% V- V
  58.                 }' A4 p+ `2 M0 Q" P
  59.                 //Creating Process was sucessful' t5 E7 @7 v% k* f
  60.                 else4 ^0 M3 q; W9 s0 C
  61.                 {8 {% C9 s0 c- P( O
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    ; _6 W, l3 ?8 s6 I
  63.   x# y3 Y# u2 \) R
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure& o: n* l( M- U5 ^1 U
  65.                         dbge.dwProcessId = pi.dwProcessId;7 S2 J1 _7 U+ V1 k9 D' O% i  @
  66.                         dbge.dwProcessId = pi.dwThreadId;
    1 W& r. g/ F9 t6 r1 D( t

  67. / a# z0 n4 i; Z9 \
  68.                         while(true) //infinite loop ("Debugger")- o2 l4 I/ s3 @1 z/ J6 L, m, `0 Y
  69.                         {
    - Z/ \8 v! s3 |
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx/ y" f+ L& Z2 K2 a" `

  71. " K7 X; L* B. r7 j% K$ e
  72.                                 /*
    & e; x& T/ {) _# l. X5 ]) j- `
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

. X. i: |8 e$ C" v& x. H7 h% \4 z' x) A8 A6 Y+ @! T

8 y" v! o/ _, j4 k3 o3 `& z( l
商业服务端 登录器 网站 出售

15

主题

257

回帖

1228

积分

金牌会员

积分
1228
金钱
892
贡献
59
注册时间
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

主题

257

回帖

1228

积分

金牌会员

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

3

主题

102

回帖

6917

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-3-13 09:58 , Processed in 0.029427 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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