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

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

[复制链接]

153

主题

333

回帖

5692

积分

管理员

积分
5692
金钱
1793
贡献
3413
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
' K/ t4 M& C% U0 v* S
8 G7 k# g7 U& n% M* c9 b虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
: z  H. T: C7 C8 j  s! O5 {! [# ]/ Z
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    / v3 M; U+ p$ x$ ?* i7 ^4 g, x* ]+ z
  2. //
    3 _5 T% z, c; h5 G7 R+ L$ w
  3. ; g* [2 _- q% Z' A! G( G# l
  4. #include "stdafx.h"9 L! R" e7 k' a
  5. #include <iostream>
    9 @! u  o; V$ w) R4 k  T
  6. #include <Windows.h>
    & Z; B+ R, U$ Q
  7. #include <io.h>
    * ]1 m3 w: g  {7 Z/ _  u& b' B
  8. ) L0 o* I" E- q
  9. & r6 B7 o: ^- I; S
  10. int _tmain(int argc, _TCHAR* argv[])
    ) }- _1 B0 [" q% g
  11. {
    6 {) @- b7 C3 ~! r: z
  12.         printf("Dekaron-Server Launcher by Toasty\n");( |/ R, }& y# K+ ^0 o

  13. ; ~+ I1 {% S$ G& o( S" J: @8 J4 Q& b
  14.         //查看文件“DekaronServer.exe”是否存在$ ?- R0 T$ i5 D  i' x0 d- d
  15.         if(_access("DekaronServer.exe", 0) == -1)
    ) F. q* p2 @, p  w: T
  16.         {' Q) k, }% c* n6 Q4 w
  17.                 printf("DekaronServer.exe not found!\n");
    * \+ Y( d$ v. h& C* K, p8 J$ d
  18.                 printf("Program will close in 5seconds\n");
    8 F+ g+ a" p4 [! H# n* a& ?
  19.                 Sleep(5000);' i4 D' w6 e: L( q1 o
  20.         }6 G* t% X- g; f: @% |8 b2 Y
  21.         else7 M1 ?/ W" [/ \$ \6 P
  22.         {
    # t8 \, q  n9 k' _: [" p/ i8 A
  23.                 : S: q& J, a# `+ S1 T! j' ?
  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$ x2 M$ D2 [, k" y7 e) j
  25.                 STARTUPINFO si;
    - O2 ]& G+ ?; S, c6 \! P- o. I  v

  26. 7 W: |: {) |1 r  U3 S, P. s( ?$ f
  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).aspx5 \7 d8 Q. w7 T* j. z( I4 M
  28.                 PROCESS_INFORMATION pi;+ ~% _3 o- i. i1 f0 d

  29. $ g' i6 |: _6 D, ~# A' U
  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
    6 [, x8 k/ }8 U/ U  _& `" T$ B6 e
  31.                 DEBUG_EVENT dbge;
    ; Q" y8 |, n+ h
  32. 5 t, u8 Q" ]& F' H' J
  33.                 //Commandline that will used at CreateProcess
    ( q% o$ p& P0 w5 b$ _- ~& y+ G9 s7 s
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
      W/ I. q& `* Z' _" ^
  35. ' n8 u! z3 O8 d: [
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made); w! U' ^! [/ F2 C: e
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    + z7 W* q, W4 G5 D9 m3 w
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)7 C0 C$ z) T% S0 q' t: J' |
  39. 4 i4 v+ r: E* j$ u: c! j. K' W

  40. * b! s3 H- h) V' H5 Z* e

  41. 7 t# z  D' l- V4 u3 b5 j2 a
  42.                 //Start DekaronServer.exe 1 a* ^; S7 g7 u' ]% a  J
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    2 `4 D2 q/ c+ R8 w4 H- l, d! @# `
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    5 s5 D. J8 M8 `
  45.                         szCmdline,        // Command line8 g5 I- m3 X7 U1 k
  46.                         NULL,           // Process handle not inheritable
    2 Z% K. Z& T* e" L  j' k9 I
  47.                         NULL,           // Thread handle not inheritable
    : D0 z6 N8 {$ `6 z+ P
  48.                         FALSE,          // Set handle inheritance to FALSE4 H$ B$ q, e) Y  d$ D: F) P
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    4 X! d+ U2 P+ ~( B/ f% N
  50.                         NULL,           // Use parent's environment block. j5 u9 I6 y- ^& j2 d; B
  51.                         NULL,           // Use parent's starting directory
    5 F, _" u/ M; X$ M
  52.                         &si,            // Pointer to STARTUPINFO structure9 H  |! A. l' ?) u! j4 Z! n
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    ) n9 m. S( b' q
  54.                 )
    7 m8 C" V7 W3 T/ K8 B% P* K
  55.                 {
    " c# N' a0 a9 I9 Z; q. V" |
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );7 v* E$ m+ u! N1 f1 D% ~+ T
  57.                         return 0;, T0 }6 r# f  w5 G+ }
  58.                 }! L9 h) ?3 ], x) K& |' K
  59.                 //Creating Process was sucessful$ P) y4 T  t  d% p$ R0 X
  60.                 else1 f3 \7 ^& k: c2 l) \
  61.                 {
    5 n# h& j6 Y/ R" p
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    . R4 \9 z. U. y" I$ n$ ?
  63. 7 p# E, c/ I1 @! ^3 E. N. A
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    0 e( L# x& z# k5 D2 z
  65.                         dbge.dwProcessId = pi.dwProcessId;) E% L1 o5 l6 t" {, ^+ J
  66.                         dbge.dwProcessId = pi.dwThreadId;3 [/ d+ w+ \0 l2 G9 G2 _: n

  67. : L% _3 Z; [! x' ^, n
  68.                         while(true) //infinite loop ("Debugger")
    # D% _! Y8 R! f7 M
  69.                         {
    ! v1 \( d+ ]( J8 h
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx4 f8 G0 T0 m; h. B
  71. 1 b5 F$ a9 {8 L# K: @& P9 |
  72.                                 /*
    8 `4 I8 R( u' }8 ?
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
; ?$ Y1 b. l9 z8 e% `1 u0 e

' j+ K( o8 p; R- T+ p- n
4 O  v/ y& U' k* y
商业服务端 登录器 网站 出售

13

主题

250

回帖

1214

积分

金牌会员

积分
1214
金钱
775
贡献
171
注册时间
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

主题

250

回帖

1214

积分

金牌会员

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

3

主题

98

回帖

4945

积分

金牌会员

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-11-17 14:12 , Processed in 0.272769 second(s), 26 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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