找回密码
 立即注册
查看: 4864|回复: 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 贡献) # b, M- u9 h! E% G
( q+ `1 s3 d( {
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。* p5 t* V7 v) L3 X
1 N! o1 e8 l# T4 h& `2 M
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    " ~# {7 f  w+ W4 {  d4 r, \# t! Q. w
  2. //
    ) X7 Y- w' q4 t, l% S

  3. $ O; E- X; Y5 N# ]0 m
  4. #include "stdafx.h"* m2 r; M% B1 R6 J4 i
  5. #include <iostream>
    * o0 ~& V3 p5 Q( t
  6. #include <Windows.h>; p3 B: b  O* l0 T, R% S9 t7 E( y
  7. #include <io.h>
      {# ?5 I2 d( \- h& O
  8. * B( l' \/ g4 R0 D& f8 G: s, Q! [
  9. 1 T& A( u$ V& K# ]
  10. int _tmain(int argc, _TCHAR* argv[])
    2 r% P9 e% b: i
  11. {
    ( |2 b7 G" r0 F* W8 Q
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    ) |2 w# ]8 B0 u

  13. 1 M5 r4 M. @4 P0 U8 P' [9 a
  14.         //查看文件“DekaronServer.exe”是否存在) T, }" s  A8 {2 e0 h; B% }- m1 w
  15.         if(_access("DekaronServer.exe", 0) == -1)
    # ~  p) N: w: }3 p, @/ s
  16.         {, c+ h/ u: b" G. X
  17.                 printf("DekaronServer.exe not found!\n");
    & U. @) L  x) ~
  18.                 printf("Program will close in 5seconds\n");
    / ~% f+ j6 e: y6 Z
  19.                 Sleep(5000);+ o# d" }. s. g
  20.         }
    & z3 G' T7 u. b# t1 ^) G; ?
  21.         else$ ^3 _1 w4 s% `. E5 w
  22.         {5 a* ]3 K5 @1 `
  23.                
    # v! @  U5 x! ^1 s! }# Z
  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, x* h; v% y: x! F/ `
  25.                 STARTUPINFO si;) o7 c2 |0 r4 j  Z7 H

  26.   n; n2 ^' e4 a7 ]7 [; o% P1 s
  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
    " R0 P8 S2 j& @; |7 @: i4 A
  28.                 PROCESS_INFORMATION pi;
    7 O5 u3 c& a0 C, y3 \

  29. & e# t6 {  F6 ~! |8 z4 i
  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- r) T3 K, n# q! F8 j  S
  31.                 DEBUG_EVENT dbge;
    1 Z# I, G" n# k$ F& @
  32. 7 H# m  M' A% N& A
  33.                 //Commandline that will used at CreateProcess
    0 ^8 a# m: B! a8 p
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));/ ?3 q6 @( p, D- m/ A8 B( }2 \9 M
  35. ( z9 O4 F# W5 M; y# e# ?7 I
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)0 A+ J2 Q9 [- p: H& `9 d' V
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    3 \; D' j0 E( m
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)% V6 ]( v; t! e' h- Z: [! k+ y
  39. 3 ?- t& E/ o1 B1 D3 @0 s2 P3 N

  40. # b+ M& `4 q3 d. z% l% ~  L2 b
  41. % {9 Z# q, A& t9 n" p9 ^
  42.                 //Start DekaronServer.exe ( h- k" C& v: f
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx) E2 t3 H. H! H0 O+ J
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    9 e8 }: N; q2 u8 [* \2 a$ q  |
  45.                         szCmdline,        // Command line) H6 v- V  [0 R* d2 H% F# G
  46.                         NULL,           // Process handle not inheritable
    " z4 @  N2 J) B. I& l- S3 N
  47.                         NULL,           // Thread handle not inheritable( t* q8 ?3 x& t; \7 y
  48.                         FALSE,          // Set handle inheritance to FALSE
    " |( y$ T# Q' \6 ?6 k
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx/ h( O0 S3 }  W6 I2 a
  50.                         NULL,           // Use parent's environment block
    , i4 t$ J( d. c. ]* W( o* a# \
  51.                         NULL,           // Use parent's starting directory
    8 r: n) z, m5 Q% G0 a
  52.                         &si,            // Pointer to STARTUPINFO structure
    6 l; q' f  w( ~6 G
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure1 L  ~; Q. Q" }3 W  K: ~( x( F) f$ Y7 ^
  54.                 ) . s  W, K5 [8 }8 J& w% I. K* F
  55.                 {
    , I$ m8 g/ P0 |
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    9 |+ ]1 h3 Q7 `8 Q) P5 C: f2 `
  57.                         return 0;# e, L* q. z3 l" o/ f* S
  58.                 }
    + Z$ U. }$ L6 k4 a& S: N
  59.                 //Creating Process was sucessful# W: g, D1 i$ M  m! i! U( h5 c
  60.                 else8 ^  l- K7 p% n3 x- @1 g9 r
  61.                 {
    ! O+ d8 f3 P% d. U
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    # m7 d/ X* o' N# Q

  63. * U4 o5 K/ ?, z# @( l8 K
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure6 N- h  `2 J. R
  65.                         dbge.dwProcessId = pi.dwProcessId;
    5 t- W( r2 O8 j2 `. e6 n
  66.                         dbge.dwProcessId = pi.dwThreadId;9 D  \3 y( e7 s; i# C) x; ^
  67. # S8 h" r* l, @
  68.                         while(true) //infinite loop ("Debugger")4 z2 X5 }/ s/ ?% A: I8 G/ Q
  69.                         {% n% r; w- a; G. u- J( W
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    : m3 U9 D6 r# e  T5 N, p& N1 J

  71. 8 v5 x; n+ A( ?" s4 v4 s
  72.                                 /*/ \( {5 r, [4 y0 q8 b
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
3 ~' U1 y2 M, A7 s0 @% b# K+ T
: l$ X, {0 `& x. y% U
9 @8 y$ D. w/ _3 f+ k/ k2 H8 z
商业服务端 登录器 网站 出售

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:20 , Processed in 0.078128 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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