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

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

[复制链接]

155

主题

348

回帖

6179

积分

管理员

积分
6179
金钱
1868
贡献
3808
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) " N* C  P. E$ W& l
* L3 z9 U# c" @6 n
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
# I  X# U# l6 h% `; X
1 c* m- Q# ]; ]) O
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    " v- n( ^: V4 ^/ ?5 ]
  2. //& @( ?; u+ l7 D' l6 {) N
  3. / f0 o- \, }- L" @  v" H! B
  4. #include "stdafx.h"" f# c0 {8 e6 `9 M! ~0 u
  5. #include <iostream>
    3 a/ S9 ~0 x7 h3 t2 N- R1 i& K
  6. #include <Windows.h>, b8 S% k- R9 y% f4 f
  7. #include <io.h>+ Z( G! Z1 h/ _- W
  8.   @* U5 c5 O& G" s4 {

  9. 9 e" X; f$ c' H
  10. int _tmain(int argc, _TCHAR* argv[])
    ! K3 l$ ]* @) R+ [3 o3 d8 A
  11. {* _% ?- \$ _. i$ {9 m  ^" v$ r- l7 j
  12.         printf("Dekaron-Server Launcher by Toasty\n");: s) T/ P. O0 |& T" F) k! R& W
  13. - k3 e, \' W* u, |) e
  14.         //查看文件“DekaronServer.exe”是否存在
    - U$ n9 n# L/ g+ u* D7 O
  15.         if(_access("DekaronServer.exe", 0) == -1)
    4 l: b+ h4 l1 E0 t0 Z
  16.         {
    - ]# d; U. x' z/ W3 a( @* @9 t
  17.                 printf("DekaronServer.exe not found!\n");
    ; O( P% W' z; r  `  R
  18.                 printf("Program will close in 5seconds\n");
    5 {% g4 h/ o4 Z+ o6 L
  19.                 Sleep(5000);
    1 e. O/ k" Y2 j) }: d0 s
  20.         }
    % r" Q+ h( t0 Q
  21.         else4 K1 c" v0 ^9 @0 i* a
  22.         {
    3 t( `+ Y( {& [" r8 j' }, g5 v
  23.                 % D4 m9 \* ?7 O' d4 U
  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/ u0 k5 v, }( O- v8 b
  25.                 STARTUPINFO si;  r+ L4 p1 x% y/ Z$ E  D

  26. # R3 n+ r* e" p3 S- 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).aspx3 V7 x6 w) H# Z
  28.                 PROCESS_INFORMATION pi;$ R4 \2 f9 w/ o

  29. 2 W% g3 m8 K2 D" i2 V4 Y
  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).aspx5 ]7 M1 t2 `( u: u, B# t
  31.                 DEBUG_EVENT dbge;
    ' C) |$ L5 V9 f& E
  32. 1 E; B: i; }& Q9 G
  33.                 //Commandline that will used at CreateProcess6 D  a+ ?4 m) D, _; J; g0 U' r6 h
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));$ B: L( M9 d2 T" I# k+ F

  35. / x% E& @0 a3 j' A; U
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)$ ~" ?; T* c7 \. p
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    # Y& D* E( w4 Z# {
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)+ Q' a& w$ }  P3 J

  39. ( u( _. |4 N8 v7 \7 l% _1 W/ c! `# u* P
  40. " H5 ]: b! m5 b& _, n

  41. * _! h* s# n+ \' }0 Q0 Q  l, z
  42.                 //Start DekaronServer.exe
    " X9 g% s: G# G' ^9 c
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx& _& O, y9 y( [1 e& V* l3 ~
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    0 n. b( ?6 v6 j/ ]/ W9 ^
  45.                         szCmdline,        // Command line) X4 Z0 \) o1 l( P, [
  46.                         NULL,           // Process handle not inheritable2 M: S6 }- y# R2 K
  47.                         NULL,           // Thread handle not inheritable
    % q9 L# A8 m% y& ]* k
  48.                         FALSE,          // Set handle inheritance to FALSE
    % G5 N% p$ b3 J# v5 ?$ a
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx/ f$ E6 A: T# z" l
  50.                         NULL,           // Use parent's environment block. }' R" N( Z% o) P% ~
  51.                         NULL,           // Use parent's starting directory ; J/ Q" x, Z: o" r
  52.                         &si,            // Pointer to STARTUPINFO structure
    * L, c4 F, K$ q$ O. o
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure" F( x) @9 z- v$ F# o
  54.                 )
    ) i) y) z: q6 w' y( o
  55.                 {
    & e0 K( ~# _* D6 Y. n
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );5 v- V! M6 \" I
  57.                         return 0;0 f( d( @7 N0 [) n0 A, ]
  58.                 }3 N/ t0 g8 ^0 W7 b
  59.                 //Creating Process was sucessful4 A5 c3 Z$ A! E( F  u+ z
  60.                 else3 X+ J- h$ n; `% t$ U  I" @
  61.                 {! f2 s% e2 h0 f, L! \# O
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    ' g, k6 x, n% S) N4 W1 z. ]
  63. 9 t* g4 ^; w9 M8 M5 c5 w
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure" w8 ?2 A( u5 s/ n. K+ L' g& G
  65.                         dbge.dwProcessId = pi.dwProcessId;
    " T5 h( @( c9 ~7 g; r+ E
  66.                         dbge.dwProcessId = pi.dwThreadId;, O5 r7 u" \" }/ X7 N

  67. & A" U% ^+ V( q6 o0 U( H
  68.                         while(true) //infinite loop ("Debugger")
    ( e6 f2 m5 X! x0 o. L* y
  69.                         {# y) E3 D1 p1 p; [1 k( A% M& |, X
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    $ i6 a- J0 ]/ G' G- ]! H8 L7 r
  71. & u+ c4 P& L7 w
  72.                                 /*$ i* U1 K2 |, {0 b% b1 _, B& [
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
8 T: S: g5 Q6 D) \! I
$ ]5 `" E: a$ o' k8 ]; a1 {3 E

3 m& T& G' }: }1 i
商业服务端 登录器 网站 出售

13

主题

251

回帖

1245

积分

金牌会员

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

回帖

1245

积分

金牌会员

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

3

主题

100

回帖

5721

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-2 00:23 , Processed in 0.083495 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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