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

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

[复制链接]

156

主题

354

回帖

6531

积分

管理员

积分
6531
金钱
1908
贡献
4113
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) : U7 U- n# K  D: o1 K/ N
" F+ n4 `8 _5 r( G
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。" }5 Z0 v+ R& p! `+ M6 M) n+ g4 Y
' S% ?6 E% Y5 a% B; T! y
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。! Y' K; f6 I. A# U
  2. //
    # r. V" ]+ k% W/ K, j% P
  3. : ^1 t! s7 W4 ]5 J- {$ \
  4. #include "stdafx.h"
    ) q1 e. ^. P8 e+ o" }8 Y
  5. #include <iostream>
    4 A/ }! J7 x5 d2 D6 B( ?4 \
  6. #include <Windows.h>3 k3 S2 A9 S9 a; F: i+ i
  7. #include <io.h>
    # C! t; z4 x1 q$ s6 k
  8. 4 C( i8 ^# b$ S9 _! S, _

  9. 2 H9 D( x: R2 E( k) h5 M! E
  10. int _tmain(int argc, _TCHAR* argv[])
    $ O5 g+ F" N3 i' p% L
  11. {+ w# e9 X6 W  B" e- s
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    ( q, j& D8 J6 O9 M, ?) x# y
  13. # X( J. Z  H- m. R  C
  14.         //查看文件“DekaronServer.exe”是否存在* p  R' y3 q/ K  m! R
  15.         if(_access("DekaronServer.exe", 0) == -1)
    & n6 C. Q* g9 ~  @
  16.         {
    $ D1 @" U4 Q: m5 Z& y) e0 ?
  17.                 printf("DekaronServer.exe not found!\n");. V1 q$ j, H, M, \; _. q$ U, Q5 o: E" Y
  18.                 printf("Program will close in 5seconds\n");/ V" o6 D6 U9 {% k: S) n" W" J' m8 A
  19.                 Sleep(5000);1 m  f. ^& k; G
  20.         }4 g, t1 W! |3 {9 m
  21.         else* {) ]: D0 K$ V  M# @
  22.         {
    * F& o/ L3 {# R
  23.                 $ V4 P* H  Z6 K4 H! a; t5 ^* t& L
  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
    : A6 z, N- n6 S. }# R# u2 B+ ~
  25.                 STARTUPINFO si;8 ^! Z0 U4 y0 P/ T  X# _. [  J8 g$ E3 q

  26. 8 V! v5 c" x' e) _# W) f$ L
  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
    ) N2 A- Y# Q  F0 a1 `* N0 @9 J
  28.                 PROCESS_INFORMATION pi;
    9 J4 j. k1 Z$ P* S0 a
  29. 8 U1 ]" P$ Q1 J, C! k
  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/ u/ e& p, K$ {4 E# L! c: m$ `5 x  H( n
  31.                 DEBUG_EVENT dbge;
    0 H- V: a+ `. x! \

  32. - l$ s4 ~' J: G& I
  33.                 //Commandline that will used at CreateProcess
    . G# J' R1 J7 i& h
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));6 [0 j$ t: g: b' p

  35. / x2 f4 r; C3 ?, X
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    ; G8 h0 L" U; T, U
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    ( {3 |$ ~. u: g3 h( \4 z
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)* ~; v4 c6 R6 F' s+ a

  39. 6 E) b8 }4 O  h3 N: P) m/ T& B
  40. " |7 u. w7 h5 [7 {& l
  41. 8 D* _) ]" r. I
  42.                 //Start DekaronServer.exe
    , C" Z0 F8 W1 n7 m8 B( C* H/ A
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx6 f/ H$ L: n# ~; s5 F, H) x
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    3 a* v$ J& u; o$ _& p! A( Y9 r" W) S
  45.                         szCmdline,        // Command line7 ^$ D) b8 _: _- h& N/ j; [3 {
  46.                         NULL,           // Process handle not inheritable
    ' q) j3 _$ f  \' K: g2 K$ h
  47.                         NULL,           // Thread handle not inheritable. l; F5 C6 z% ^# i4 n! d. [8 _$ G" g
  48.                         FALSE,          // Set handle inheritance to FALSE
    + d3 ]; ^) u' E, \
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    ; t  s6 m: L4 H. d  {% r- z* c& j$ R
  50.                         NULL,           // Use parent's environment block% m) e1 }$ \4 m+ X2 T- y
  51.                         NULL,           // Use parent's starting directory 0 h8 R/ B# Z1 q  i5 [
  52.                         &si,            // Pointer to STARTUPINFO structure
    4 n& W' @, S, s" @$ q
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure8 i  d- c+ b9 v9 `
  54.                 )
    7 ]- F8 Z6 k9 _3 A
  55.                 {
    8 y- |- j& i( ~( y4 E- x
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );8 v$ \8 ~' y0 r! [7 u, {
  57.                         return 0;
    8 t1 O  {0 N8 L
  58.                 }1 P* }4 d# _( a  S" z. _* X2 i9 d6 n
  59.                 //Creating Process was sucessful
    4 W4 M: Q6 b' C9 `8 M
  60.                 else2 h+ F2 A. C/ Q% G
  61.                 {
    4 A& f" R1 t3 a3 t+ I  G* i3 e' Y
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    ! _4 k  W0 y8 I  b  }  k& k3 D+ {

  63. 0 F# K* o  S  Q: a
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure* z' U1 o  L! X3 s$ G8 s
  65.                         dbge.dwProcessId = pi.dwProcessId;
    , Z" a: u& T) i- j
  66.                         dbge.dwProcessId = pi.dwThreadId;
    2 ^/ n$ P0 \6 x9 M
  67. 0 R! S/ A, `# @. f
  68.                         while(true) //infinite loop ("Debugger")
    7 L6 `( y( Q, k& T* }0 m
  69.                         {. B, S9 y$ g' _$ J
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    " T+ e- ^( ^: C/ N

  71. / l8 A  u; N9 j7 }
  72.                                 /*6 R2 @6 K9 |2 }
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
- Z( s& O- Y4 F
$ Z" k) m* k& t8 Q7 v$ }

6 M2 G+ \! Z/ L" \" l) g' v! I
商业服务端 登录器 网站 出售

15

主题

256

回帖

1241

积分

金牌会员

积分
1241
金钱
853
贡献
112
注册时间
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

回帖

1241

积分

金牌会员

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

3

主题

102

回帖

6101

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-25 10:02 , Processed in 0.080313 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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