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

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

[复制链接]

155

主题

352

回帖

6236

积分

管理员

积分
6236
金钱
1880
贡献
3849
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 7 d$ T  s* ]' O' R% b
/ c/ t8 F1 F( r, [( Z
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
  o# x% H9 }$ T! G5 h& r. Z( @: q. V8 v3 x3 l
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    - z; v3 V1 ^0 ^: k
  2. //
      _* r' N* p; \( y

  3. ! J" H( _' V7 J1 H8 p) P
  4. #include "stdafx.h"
    0 L$ x0 P' h! n5 C) S' \. @6 Q
  5. #include <iostream># P7 n# S+ y9 c- m
  6. #include <Windows.h>' \# k$ J$ ?5 H# f) ]$ @$ d
  7. #include <io.h>
    ' x7 ?7 A( J. E4 y# [# C
  8.   W0 _) H2 p/ C8 v9 U
  9. 2 D1 R% p- u% @  C- i
  10. int _tmain(int argc, _TCHAR* argv[])
    * K& D" h4 u% s, K
  11. {
    ' }0 K; b/ b; D4 E; \
  12.         printf("Dekaron-Server Launcher by Toasty\n");/ p6 {: J+ p/ C+ S
  13. $ Q, W1 [7 X2 m1 O( x
  14.         //查看文件“DekaronServer.exe”是否存在  ^8 M2 a" G+ j# [
  15.         if(_access("DekaronServer.exe", 0) == -1)" K8 d7 n% M) W4 H) o" t
  16.         {
    & K/ j0 J% B; l3 w3 \2 }
  17.                 printf("DekaronServer.exe not found!\n");
    - @3 o, {, x$ v7 a% C# g. U1 M4 r  g+ r
  18.                 printf("Program will close in 5seconds\n");: `" W! S4 j- t! q$ a
  19.                 Sleep(5000);! S/ [% U# i' O- w: \: [
  20.         }
    $ D# ?2 `9 n: |0 I- A
  21.         else
    * m8 ~$ u* }9 b! k/ n
  22.         {
    + |- H" u" ?6 R* C: x
  23.                
    ' U! P8 G" X! U8 N$ D
  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).aspx9 G+ P* \) Y- o/ S0 a
  25.                 STARTUPINFO si;2 ]" z! `  X0 m+ M* q
  26. 6 r! M, |) }% i8 f
  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
    7 p6 r6 M, K( p) }: m7 ]  }
  28.                 PROCESS_INFORMATION pi;+ l3 `' e: ~8 l* Y- p

  29. # g( b  u: ]3 t
  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
    1 K+ U3 X& ?+ N9 E
  31.                 DEBUG_EVENT dbge;- [( u. K' \/ B% k

  32. 7 \7 r7 ?# E; V/ d3 b1 b
  33.                 //Commandline that will used at CreateProcess- H% w. R, t$ P, m  H+ ?
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    2 l* x2 N' c: j
  35. * @7 o- p5 r; O2 |: H1 L4 p' O
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)2 o7 O3 `( F% W* h5 c) W
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    5 r0 m- k, E, {; k
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)$ e' e7 H) j* b! e5 g1 P
  39. 3 \% ]8 V2 c) l2 z1 b1 s

  40. - s- Y4 ?- u# `9 B
  41. ! ?/ ?( c" j( Z. E0 ]" U
  42.                 //Start DekaronServer.exe # @8 ?2 t3 L& s) A0 m) l. n! }
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx/ E/ e# O/ W! h& Z+ J
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    9 `0 _7 @, W! m" `
  45.                         szCmdline,        // Command line
    6 G) O( L7 \, x' [/ q, o1 p6 d  h
  46.                         NULL,           // Process handle not inheritable
    # M. ^7 K! o. Q8 G) p: X0 ~
  47.                         NULL,           // Thread handle not inheritable$ G. R7 z% C( ~8 y
  48.                         FALSE,          // Set handle inheritance to FALSE# E3 G0 {% x; B* ^1 {
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx: ^% y4 h3 C6 S+ k7 U+ {$ `" W0 Z
  50.                         NULL,           // Use parent's environment block
    , d% j6 l# R7 {/ |
  51.                         NULL,           // Use parent's starting directory
    0 q" o/ `: f% O0 C
  52.                         &si,            // Pointer to STARTUPINFO structure2 E' L! p3 E' G/ D2 m
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure* V9 T6 D( S( ]9 v1 w9 B  t
  54.                 )
    ' I1 M4 O2 B. W& [6 A
  55.                 {
    5 |, L: v0 v* i" H/ e# }
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );- W6 i3 h% x4 j5 }' O4 F- X7 @
  57.                         return 0;5 U' i8 _( O" z6 g6 |
  58.                 }- L) N$ U: V7 `
  59.                 //Creating Process was sucessful# c/ b7 K& g( ]+ ^
  60.                 else
    , I+ Y7 x" q+ H" |$ P, X7 U3 H; O
  61.                 {8 s3 j+ |) o% e3 }* G
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    % M/ W6 q. v7 w* o

  63. # H# }% \% @& T
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    * ^8 L) F! p2 H! S, b
  65.                         dbge.dwProcessId = pi.dwProcessId;
    * V+ G7 i8 v% C% ^' m" w8 m2 i
  66.                         dbge.dwProcessId = pi.dwThreadId;
    ) J$ l. k) |# @2 x3 O6 r3 U1 E7 n
  67. " R/ H1 A$ n6 J7 H
  68.                         while(true) //infinite loop ("Debugger"); e/ i- l# O7 T  \
  69.                         {
    , I% {& e. Z2 s! u3 E5 Q
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx. O' [: ]  A% r

  71. : J3 c9 f9 W5 n2 w  W* q4 B
  72.                                 /*
    ! `! s0 l' W+ I
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
+ c0 a. \3 r! A" p4 V* F* f

; y2 o+ l& b) {, f0 i7 D; @2 A
* Y& X8 w/ ]5 s' y( ~
商业服务端 登录器 网站 出售

13

主题

251

回帖

1253

积分

金牌会员

积分
1253
金钱
828
贡献
156
注册时间
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

主题

205

回帖

345

积分

中级会员

积分
345
金钱
136
贡献
4
注册时间
2024-5-14
发表于 2024-5-14 15:56:57 | 显示全部楼层
学习学习赞赞赞

13

主题

251

回帖

1253

积分

金牌会员

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

3

主题

102

回帖

5923

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-13 00:24 , Processed in 0.080194 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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