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

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

[复制链接]

147

主题

281

回帖

5125

积分

管理员

积分
5125
金钱
1637
贡献
3060
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) ) ]+ a* t4 s2 b3 Z5 O8 p3 Z

# }* t8 e; \) N% C1 S0 C. c$ K虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。1 ?( W, a! Q; U; o2 F9 H! r5 Y6 T

( a5 d9 P0 L* d/ `4 }4 Q* q
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    4 d! X, [. A+ W2 J" l
  2. //; l# _2 ^" G+ W( L- W/ o: d% b
  3. # i5 A+ b' E  ]
  4. #include "stdafx.h") a' m8 i) Y, B7 [; P1 d7 M
  5. #include <iostream>1 F& C. D- x( b7 y' I/ S
  6. #include <Windows.h>
    % _; J7 P% [7 `# ?' Y& o
  7. #include <io.h>
    ) S, _, o% y- |* d8 ^2 l

  8.   W& h, S% d0 ~6 E3 u  E- ?8 G. i9 P

  9. 4 y" c& L: P# F
  10. int _tmain(int argc, _TCHAR* argv[])2 ^! q3 F- \) l  ~& W  B
  11. {
      e5 d& P: N$ c. P
  12.         printf("Dekaron-Server Launcher by Toasty\n");7 U8 q2 y5 t; R- p- U) `! e% ^9 N! ]

  13.   i, v7 E. L8 a" ]
  14.         //查看文件“DekaronServer.exe”是否存在
    0 W/ P( v! q) e% D$ a1 c
  15.         if(_access("DekaronServer.exe", 0) == -1)' ?& l& f" i( m' o+ ?
  16.         {' T' a: T/ N9 u% D. A# m& ~
  17.                 printf("DekaronServer.exe not found!\n");
    # C: S2 f9 m' v# R5 [
  18.                 printf("Program will close in 5seconds\n");
    5 s2 @' V7 n3 h2 d; ?* i# {" q
  19.                 Sleep(5000);* z; y' |# }; @8 e* o. ?" }
  20.         }
    8 J* s3 k& ~& w8 M; T' y: M
  21.         else
    ' b! ~& v% X( A8 _. V6 k
  22.         {1 G7 D  I( G- R
  23.                
    ; _" A2 n1 Y0 B, t/ d& V. |
  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
    " h- ]' X) H  K. \' l
  25.                 STARTUPINFO si;6 g( r; S; s% }- N' V
  26. 0 P; _( l7 G8 d$ N* n
  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).aspx9 r) g6 z1 l4 s4 y2 d1 t  A3 w
  28.                 PROCESS_INFORMATION pi;
    4 y3 K/ v3 Y, @- ^2 W0 w

  29. 6 j, ^+ x2 d" E# `% p
  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).aspx3 H/ P0 X5 e5 e. u
  31.                 DEBUG_EVENT dbge;
    # R* ^! C5 t& L: T# b4 G

  32. * f( M6 p. v( a
  33.                 //Commandline that will used at CreateProcess# r$ c: `! S3 t/ R. w1 c. i. y" b
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    . C; m( F2 ^$ h2 o

  35. - S, f6 N$ g: Y! J7 H
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)6 }8 B( _* @8 C4 d0 Y6 |( N" H1 T
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    ( }) M9 ~* J; ?! ?, f, X# A: O
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    / F- A, w* X( z& X+ U% R$ t4 Q
  39. % }4 {1 O# |5 ]% `% |# M( d8 ?4 z

  40. 3 ?$ ?! b4 e, _% s3 G
  41. + I6 N9 B0 W5 t' {; w
  42.                 //Start DekaronServer.exe
    0 Q6 H6 b/ I1 {% `8 J/ n
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
      P% C0 G- `6 E4 O5 v; H  u5 h8 z( \  j
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)# I! P- v" P4 j' |& L& G
  45.                         szCmdline,        // Command line" D! O( }# [! M1 V. b& }
  46.                         NULL,           // Process handle not inheritable
    1 D* e! p. @% L) Q  q" w1 m1 [
  47.                         NULL,           // Thread handle not inheritable1 c- C9 p. X# H' z
  48.                         FALSE,          // Set handle inheritance to FALSE
    + q) V4 G  \4 H" G9 A
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx# Q! e0 Q: v6 L  H4 w& f+ Z
  50.                         NULL,           // Use parent's environment block, t+ E2 @! v4 y- C
  51.                         NULL,           // Use parent's starting directory   b* |# \5 n# S) ]  A4 H0 H
  52.                         &si,            // Pointer to STARTUPINFO structure: e, Z. s1 F% z$ ~
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure+ ]( x: T8 t/ U: a3 N7 r/ n
  54.                 ) 3 q. t2 P% J* I4 j9 b
  55.                 {7 N# }8 G/ I; _3 D8 a
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );+ F" s6 S& H& g( @, Y, q% c
  57.                         return 0;" `% h/ D( q$ C1 r% {; f
  58.                 }- Y2 P; `* D/ O# I) J3 a
  59.                 //Creating Process was sucessful
    / G: |$ d0 O* E( z3 z6 p, W, ?
  60.                 else/ H9 z) ]; N$ a; f7 y2 g2 S6 V
  61.                 {
    $ b# T2 z0 }. d5 H- Y, T3 X
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    ; P( T' i9 c6 x

  63. : F: ]; g# e- ]/ a$ M+ o8 Y
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    - T8 [4 a; a% _( }6 o
  65.                         dbge.dwProcessId = pi.dwProcessId;9 b6 @8 v- Q; ~) }7 y
  66.                         dbge.dwProcessId = pi.dwThreadId;
    ( R2 R+ s7 u# x$ J% H* _9 j
  67. ) U; \4 J7 x. ]2 ~' J( U
  68.                         while(true) //infinite loop ("Debugger")
    % T8 T, Q1 F9 |! s. Z
  69.                         {
    " v5 f) n3 C% }, [
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    2 P6 ?+ |8 F' }$ E  Q2 q# _( D

  71. ( |( r5 u: S) f$ V/ z) ], m
  72.                                 /*6 s3 L* C) @' O  K! P! Y
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

+ W) ]0 i( {, C' Y  p" C
+ T  w5 x0 _2 V8 x
9 ~. |% L  c  O5 q! u9 j7 I
商业服务端 登录器 网站 出售

10

主题

243

回帖

1106

积分

高级会员

积分
1106
金钱
700
贡献
148
注册时间
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

主题

204

回帖

340

积分

中级会员

积分
340
金钱
133
贡献
3
注册时间
2024-5-14
发表于 2024-5-14 15:56:57 | 显示全部楼层
学习学习赞赞赞

10

主题

243

回帖

1106

积分

高级会员

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

3

主题

97

回帖

3759

积分

金牌会员

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

本版积分规则


Archiver|手机版|小黑屋|EGameol

GMT+8, 2025-9-11 22:01 , Processed in 0.047062 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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