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

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

[复制链接]

159

主题

378

回帖

7303

积分

管理员

积分
7303
金钱
2100
贡献
4666
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) " g4 i0 w  S% ]; t' U" L
1 w% h& |' H4 ]9 U( X( @
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
- u, y5 x4 u3 O4 }: J5 P: ]/ x' y: G& \7 `) O
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。7 g3 G& E6 ~9 Y
  2. //
    4 M( u. D1 L/ ~; _* a1 e

  3. ( u* V+ y2 ?7 v9 F) \+ z
  4. #include "stdafx.h"
    ! E1 X) F( A" C5 G* _) x" k4 }
  5. #include <iostream>
    ) |, _" n$ N6 d4 L4 _
  6. #include <Windows.h>
    7 N1 A1 z6 Z% b# g
  7. #include <io.h>2 ]2 R+ p  K) ^: D" g3 A, e: C

  8. 3 B* R. B3 Y3 R4 n' Z3 L
  9. 9 z+ J0 o% n) A# z7 Q3 m
  10. int _tmain(int argc, _TCHAR* argv[])8 j4 k7 G- l  i, T
  11. {2 y% t9 z4 K' i  o
  12.         printf("Dekaron-Server Launcher by Toasty\n");1 ^$ z/ N' C7 K5 W; u% O8 d
  13.   o% c* |  p+ N" X+ o, Y' R* o1 U
  14.         //查看文件“DekaronServer.exe”是否存在
    . D- r/ [& P" F. D$ l8 v
  15.         if(_access("DekaronServer.exe", 0) == -1)! @; J+ ?( {! r9 s' C, d2 \, A' }
  16.         {' A/ X8 |9 L8 m) _7 u  l2 c
  17.                 printf("DekaronServer.exe not found!\n");
    3 [9 @: L/ D0 t9 U2 Y! O( z
  18.                 printf("Program will close in 5seconds\n");
    0 s) p$ F8 o/ R8 [3 v- j
  19.                 Sleep(5000);# f& r0 d" X& j/ S
  20.         }
    6 F7 \! u- K' F
  21.         else; r3 Y# X' ~0 ~" @
  22.         {
    ' I2 M4 ?/ Q/ L* Q6 q
  23.                 5 F3 t2 C- V2 }3 k
  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
    , X8 `, [. V+ u& T' J
  25.                 STARTUPINFO si;
    , @$ d/ ?5 Z; Z& Q1 s: S

  26. 7 X" r4 @! H# ~. j
  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. d2 m" ~+ q3 X1 T* t4 w
  28.                 PROCESS_INFORMATION pi;
    1 m' ]  ]0 a9 A' P$ b
  29. 1 ]! Y4 L9 W7 k7 K' S4 s
  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).aspx2 A) `# P$ c' O5 t
  31.                 DEBUG_EVENT dbge;
    6 m) r& f# ^$ y6 F

  32. ' B: t2 v$ D; ~% Z
  33.                 //Commandline that will used at CreateProcess% t- w- z) j- k5 t" s
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));3 ?$ ^1 ^$ u7 S& [+ y
  35. 7 c' c( z. F8 Q5 U4 H3 k
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)  G# i, b/ t/ X& K: y+ [
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    . Z" ]0 d3 g; c7 _( ?! A
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)0 {8 f% L3 _' S8 \' @; }6 _

  39. & l$ H0 `2 K' i0 y

  40. , _0 {& g& N2 |$ _/ |+ q
  41. : e* \6 l+ K& K' S/ F
  42.                 //Start DekaronServer.exe # D( n# {. A3 m
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx- L) ~$ J8 g% n! O! \' l
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)$ }. U: G5 y1 Y& |# c
  45.                         szCmdline,        // Command line! B. c1 s) E) }7 A2 @& _# L0 z
  46.                         NULL,           // Process handle not inheritable/ [! J2 x! _1 i, r3 e
  47.                         NULL,           // Thread handle not inheritable& f- b( E- j2 l  O1 E/ j' |2 i
  48.                         FALSE,          // Set handle inheritance to FALSE
    ) l) K. \8 K8 E6 X4 _7 F
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    5 i  U( a: U( D5 h
  50.                         NULL,           // Use parent's environment block$ j( J& R7 _2 ?- H
  51.                         NULL,           // Use parent's starting directory
    8 t$ [$ U0 [/ a1 \
  52.                         &si,            // Pointer to STARTUPINFO structure$ }" m7 q) R% U$ Z& d0 k7 d
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure2 @& r+ H6 v5 ~& D( a& {) l
  54.                 ) 1 z  e' K. x  [- s, E; q8 Z  q4 f9 s
  55.                 {
    9 G9 P+ W9 ~  b7 ~% A
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );( B# m$ F  z, G; J: ?
  57.                         return 0;
    / N  a1 d5 B1 T' ^. \( X$ M- J
  58.                 }  k7 U# i) M! j( R
  59.                 //Creating Process was sucessful
    3 p5 F9 t+ i% S4 E
  60.                 else, |1 R+ K# S5 u. S
  61.                 {
    ) U& h7 a7 N& V* G& T' c8 N3 ]
  62.                         printf("Sucessfully launched DekaronServer.exe\n");. L! ^1 Y0 V# H# }. t
  63. # I- K0 O" o# I, J  _1 ]2 n
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    7 U: }+ }) w# {0 m- {' k
  65.                         dbge.dwProcessId = pi.dwProcessId;# X! j4 c: M) Y& M3 x  O
  66.                         dbge.dwProcessId = pi.dwThreadId;* c/ y* |8 }7 g3 E7 p4 W! w( N" ]6 S
  67. 5 G6 N. ]3 l( k' L! F) {/ N8 a
  68.                         while(true) //infinite loop ("Debugger")6 f/ J( J- Z3 p& J6 s
  69.                         {' a/ ~% X; p" m+ S  D/ p; I8 G& s
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx. @8 t$ D# ^  A" K' L  Z9 K
  71. " O/ k2 b3 N0 V
  72.                                 /*1 q$ f: h* x; o6 Q/ R* g1 R) g
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

$ H& U# z* i. E% L5 U% z( ]
8 M8 L3 [- t" O+ k! r0 E+ W) ~( m) j2 F$ M4 ?
商业服务端 登录器 网站 出售

15

主题

258

回帖

1267

积分

金牌会员

积分
1267
金钱
915
贡献
74
注册时间
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

主题

258

回帖

1267

积分

金牌会员

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

3

主题

102

回帖

7637

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-18 03:35 , Processed in 0.034964 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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