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

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

[复制链接]

157

主题

361

回帖

6695

积分

管理员

积分
6695
金钱
1935
贡献
4242
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
9 c4 i2 ^$ ?0 \# t6 l
9 O7 r# @! h2 Y" e虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
6 \4 Z5 F$ f* E3 ~/ d* u; k( C( k5 ~/ d5 G; @7 D1 M
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。3 d& j) o7 L; ~
  2. //) B/ o4 i. s- d8 R

  3. : |+ g# T; Y* R" l! u  U
  4. #include "stdafx.h"# O! m, T1 V1 D, C, E2 S9 M
  5. #include <iostream>+ N0 h! P/ h+ c" {& Y
  6. #include <Windows.h>; `" `5 r& e/ c7 J+ \
  7. #include <io.h>+ V% C9 N! ?- K. }* y

  8. * d. H$ E$ @7 B. f7 I; e) z

  9.   w) v9 `  O: x6 K8 g/ _
  10. int _tmain(int argc, _TCHAR* argv[])
    $ D1 m1 H4 n/ p1 `# h
  11. {! u* i0 A. {& D" p' K( z
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    ' R+ ~1 U& g5 R  H3 f; V: ^+ m
  13. 2 D+ N: o8 Z5 g
  14.         //查看文件“DekaronServer.exe”是否存在* \: r3 w; O9 I# `+ ^
  15.         if(_access("DekaronServer.exe", 0) == -1)! E; p" X7 K- b' I% ]# m7 [
  16.         {. g7 v: \& s( r+ K. ?8 }9 \
  17.                 printf("DekaronServer.exe not found!\n");0 @( B1 W$ ~! {0 S. D4 J; |5 N
  18.                 printf("Program will close in 5seconds\n");  w; L- x1 Z9 Q0 V
  19.                 Sleep(5000);
      ~9 X6 a  {% ]% V
  20.         }
    ! q7 Z+ o" o4 |$ t
  21.         else) }. E7 g, a3 R% Y7 l
  22.         {
    # N8 [( u$ a! D+ }$ a( s
  23.                
    4 s% U2 u. P% B! e4 L0 o" j5 |
  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
      z" U- s& U3 {# E5 ]! B, H
  25.                 STARTUPINFO si;
    # x7 c3 y1 b! X8 ^/ s6 [
  26. $ l; A4 M2 L! ]4 I
  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
    ( }% i) i7 S* \, y+ A/ ?4 E
  28.                 PROCESS_INFORMATION pi;/ K# `: G. J8 B1 d5 D  ]% J

  29. ( @/ I% t# F- x. 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
    2 p  j! h6 |" I7 j) Q
  31.                 DEBUG_EVENT dbge;+ @+ D- u% V% h) z
  32. ! M% t- i% t; T- ~9 f7 ^2 s8 C
  33.                 //Commandline that will used at CreateProcess+ R& p: {0 Q' S/ A8 `% W* s; s
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));7 C4 I0 ~3 G) m
  35. # ?5 O1 D2 R" [# q. S
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    0 C* h2 K* B5 Y0 ?
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)# b- h' K/ U0 \" k$ N7 _5 I. {
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)5 n! Q" w  b* x1 b# F" Z

  39. 1 b! I( w- y. l/ [9 O
  40. ) |' |3 L1 e# K$ Z% `# h1 c

  41. ) j; m$ v  C' C8 y
  42.                 //Start DekaronServer.exe ; {0 q6 g& p* f7 n- o8 z% l& }
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx0 e. p6 _& C: J" \+ T& R5 y
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    1 F6 d: C2 F% g7 U; q* e. G' W
  45.                         szCmdline,        // Command line
    8 T/ m. O5 N* H
  46.                         NULL,           // Process handle not inheritable
    ! i* [# o# g' s( ?: {
  47.                         NULL,           // Thread handle not inheritable8 d" C! b/ L3 L9 \* z6 @
  48.                         FALSE,          // Set handle inheritance to FALSE
    / U* x& `7 V' I" C# P8 e
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx$ U* K9 c5 s7 m4 z, i- i
  50.                         NULL,           // Use parent's environment block
    9 U9 a' s' }7 b) j* Y
  51.                         NULL,           // Use parent's starting directory
    1 J, l- V8 ]4 m
  52.                         &si,            // Pointer to STARTUPINFO structure
    * l9 \* v8 ]2 K) r4 U2 {9 Q
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    & a. h+ Y- w: C0 T' i: B3 @/ i- A7 q* k
  54.                 )
    ! J# z- x6 J; w3 `% F
  55.                 {
    / F4 g! H. i3 W
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    . T" \7 W7 F2 t) s: D! H
  57.                         return 0;
    ) T" l, b; A9 {4 M* ?1 K. V9 `' y
  58.                 }
    " H3 \: D6 J) G/ {8 w. X
  59.                 //Creating Process was sucessful
    1 t& t7 }7 f. Y9 N2 K; M
  60.                 else; q9 H7 L& F+ h* Q& ?
  61.                 {0 ~- S- O8 `1 M$ M7 Y) l2 G
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    # }6 u* o1 O: J4 z  c
  63. * D9 }* B8 L$ K7 K
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure! F7 I% G. @- M4 A* `; J9 ?( P
  65.                         dbge.dwProcessId = pi.dwProcessId;
    / b4 l# \: Z! |$ U5 m2 y4 T
  66.                         dbge.dwProcessId = pi.dwThreadId;
    % c7 R5 E8 L* D7 N" k* j
  67. / Q7 q/ x# _8 h# _) i
  68.                         while(true) //infinite loop ("Debugger")0 P! N; h( L: x: }1 p
  69.                         {
    9 A; W0 G0 ?6 z
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx& c' d/ x/ U. k  v3 k0 q
  71.   e, g( q( j- {
  72.                                 /*
    2 {6 c* U% C" c" _# e  e
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

/ t" h. f+ L% n& j4 i/ I2 L  M8 k% I3 J+ V

" @. H6 q) R* r! I0 k
商业服务端 登录器 网站 出售

15

主题

256

回帖

1259

积分

金牌会员

积分
1259
金钱
865
贡献
118
注册时间
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

回帖

1259

积分

金牌会员

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

3

主题

102

回帖

6381

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-8 18:15 , Processed in 0.078031 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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