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

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

[复制链接]

155

主题

348

回帖

5986

积分

管理员

积分
5986
金钱
1862
贡献
3621
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
( @$ b5 _2 v, e- {
% ^6 M  w& Y. }, s( W# u4 x虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
5 `. i  G$ i6 I) @
' A% W0 A: v/ l" L& z  @
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    ( g' O" c8 {* {  i
  2. //
    7 E* m- N3 C( \3 p  o% b, O

  3. / Z0 Z4 y7 {" [$ b+ X( _, w
  4. #include "stdafx.h"3 P% l! r$ t" w' ^0 [$ V  u
  5. #include <iostream>
    ) f& c7 G1 a! v
  6. #include <Windows.h>
    7 h! @: K, s, \6 V; S5 ?
  7. #include <io.h>8 {. a; q6 m5 q6 b2 ^1 K
  8. 2 U) z" E- k1 ~+ F
  9. - ~" Q7 Q9 Q5 S
  10. int _tmain(int argc, _TCHAR* argv[])0 ^; ~$ p, Z2 t3 p
  11. {
    , c; B9 w: k$ e+ P5 f( t
  12.         printf("Dekaron-Server Launcher by Toasty\n");: V* E4 B# o7 Z) p8 U  l

  13. , F& N- V# X2 s1 b
  14.         //查看文件“DekaronServer.exe”是否存在
    $ J& o- ?" x) e0 x! Y" t
  15.         if(_access("DekaronServer.exe", 0) == -1)
    ' F7 X6 j5 P+ b+ d8 w% A
  16.         {
    1 c! p& Z3 O; Y
  17.                 printf("DekaronServer.exe not found!\n");
    : s4 M  ?% Y% `' I/ W7 o9 h4 ?7 z" u
  18.                 printf("Program will close in 5seconds\n");3 w% x1 ]: ]) T( O+ G
  19.                 Sleep(5000);
    7 t4 p9 y" {: m  j+ w9 h+ A8 Z
  20.         }
    ! H0 ^  W7 A* }. r" X6 N  C
  21.         else) v  i  R; l# t% R+ v9 S
  22.         {! A$ h2 B9 j7 |8 r9 `6 }# b
  23.                 % e! r* p: ^+ c" |) W; b$ u  Q) b
  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
    7 i; m! F1 p- J- ^1 P) A
  25.                 STARTUPINFO si;
    : F2 x$ a; d/ n9 T# m$ D

  26. 9 @; S* V) r3 v% I; g
  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
    5 ]1 n! `, v, ~! q7 G" o+ m. s: T
  28.                 PROCESS_INFORMATION pi;
    2 K5 K0 a1 J1 A& r5 a
  29. $ ?$ N2 V! v! B$ n7 G2 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).aspx  |: j8 N  O1 c, s' ~6 `/ S1 S7 Q
  31.                 DEBUG_EVENT dbge;
    ; m8 J. a/ E4 V+ G; g

  32. 2 z6 v( P% w; U3 F: ^+ a
  33.                 //Commandline that will used at CreateProcess
    1 O% H, S0 a2 A0 D$ C
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    ; f% d1 _9 T% @5 Z

  35. 2 L6 j2 d4 {6 \7 {
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    8 D5 t1 V% f! H+ t$ j" w4 P0 s
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    2 H8 y2 l  x' F; Q: s9 ?
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made), x' G( [- o( b! @

  39. 7 ?- a# Z' `. t9 a* E. F$ N2 Q. }

  40. : E5 {5 Q5 ^5 q# a; {2 `5 M) X5 ?
  41. 7 u2 E" T0 f7 \% ?
  42.                 //Start DekaronServer.exe / q3 a# }9 F9 Z7 H5 L6 e
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    9 F0 \4 ~$ ^  C' Z
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)6 I& S1 S8 F6 @$ I( R
  45.                         szCmdline,        // Command line% f3 h0 ]0 V, ]$ @" M8 a" H
  46.                         NULL,           // Process handle not inheritable
    # [: O9 w5 E2 Q# }) n
  47.                         NULL,           // Thread handle not inheritable
    5 v  W2 I3 Y: o/ K
  48.                         FALSE,          // Set handle inheritance to FALSE1 B8 {9 h' \7 b4 S( l! z
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx% Y. N9 G2 {0 ]9 I: I
  50.                         NULL,           // Use parent's environment block& w  E; [: y/ t
  51.                         NULL,           // Use parent's starting directory 5 f" p7 v# |& b+ H
  52.                         &si,            // Pointer to STARTUPINFO structure
    ' J& [. f1 k3 r5 O& A
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure: Y4 ?0 c  S/ q2 M/ e: [
  54.                 )
    9 \1 N- ]! T1 e  k- {
  55.                 {
    5 ?4 z, |6 t% [: S8 L2 @
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    . x7 f4 C8 M0 A- r
  57.                         return 0;1 e% |- y% ^4 B% {  @6 n$ n2 V
  58.                 }
    8 J8 R; f' x3 O7 j3 e- V
  59.                 //Creating Process was sucessful/ `9 c* q4 Z; B+ P  p1 J
  60.                 else! Z: h; G  I8 d$ m3 ^
  61.                 {; C+ K; ]- P6 f1 y
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    " v5 p. N  h! \# @) S+ ]3 @

  63. 1 a" w+ A' S$ T7 `; O; v9 W8 n. R
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    9 `# j8 I- R( C4 R
  65.                         dbge.dwProcessId = pi.dwProcessId;
    ( r4 s- [6 w; g( q
  66.                         dbge.dwProcessId = pi.dwThreadId;! r" m8 i7 [, D: S+ C
  67. : H0 F; x9 ^& O
  68.                         while(true) //infinite loop ("Debugger")
    - Z/ B3 }/ T7 {5 F9 g
  69.                         {- W9 @1 U& e+ B7 ~7 @
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx8 l1 n$ U4 }8 M
  71. 1 H7 F0 x. K- `. L) J5 ~2 j( s7 [- c
  72.                                 /*8 n  [; g0 j3 I# P; [
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
, t7 T2 h5 }5 i; X! h
; Z$ @  K9 t- m8 v

# h5 T: D0 n. ]8 ~- L6 ?' M
商业服务端 登录器 网站 出售

13

主题

251

回帖

1242

积分

金牌会员

积分
1242
金钱
814
贡献
159
注册时间
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

回帖

1242

积分

金牌会员

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

3

主题

100

回帖

5693

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-29 15:17 , Processed in 0.098490 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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