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

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

[复制链接]

157

主题

364

回帖

6949

积分

管理员

积分
6949
金钱
1982
贡献
4446
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) ' _* e9 q/ |1 |
" i8 u- H4 D8 L4 Q
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
) K# I* m( ^  l; [/ j/ ^
" }5 y8 i5 o1 b8 o
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    7 c% u+ _: f* m7 d" Y& ^
  2. //0 h2 m' q2 d, P& [( D
  3. , d+ _1 a7 A+ N- H' W% r( ~4 f
  4. #include "stdafx.h"4 p9 a/ Z, }/ D  ]' l  k
  5. #include <iostream>
    ) S) K0 ?+ e, S3 {% f0 r* @
  6. #include <Windows.h>2 D; ^0 N) |2 ~$ h
  7. #include <io.h>4 a2 C- L/ j3 f

  8. ; t7 f1 k- G9 N1 r. b# Q
  9. 0 N2 a9 e6 C+ \' s5 W  F8 W
  10. int _tmain(int argc, _TCHAR* argv[])
    $ P& J& N5 U+ \$ T9 X, R& I
  11. {" L8 X  g! ~4 ~$ c+ z3 ^, t
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    4 L7 q# i) d1 a8 L# \/ U9 Z

  13. , `& A+ }9 n" {: t
  14.         //查看文件“DekaronServer.exe”是否存在; ^6 i9 z9 c5 y  \% j% \5 X
  15.         if(_access("DekaronServer.exe", 0) == -1)
    : F, I. d# S* P
  16.         {
    9 G, B" m3 I6 {; C9 s% [- w0 z/ ?
  17.                 printf("DekaronServer.exe not found!\n");& K2 w" B' g: w
  18.                 printf("Program will close in 5seconds\n");. y% {: ~' n4 w( [
  19.                 Sleep(5000);
    ! a' V; L8 D& p* H
  20.         }. S" y- `6 n8 P. C* s
  21.         else
    0 z1 v" z. m8 k2 U6 W$ s
  22.         {$ [5 U/ A2 w& p+ n5 O6 s$ \
  23.                 ' S8 S  u9 G8 p( 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/ o3 g2 h% ^: i  j+ ~
  25.                 STARTUPINFO si;
    2 O+ V: @0 B' {. K9 @/ e/ f0 x* G
  26. 0 \5 r5 e% R2 d: x  ~
  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
    " ^7 T; C3 m9 N$ k# o: F
  28.                 PROCESS_INFORMATION pi;) J, y  N- T- c3 t

  29. ' j6 ^. P; H6 ~
  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. Y1 |8 ^; u7 _2 m  a
  31.                 DEBUG_EVENT dbge;
    # W9 {( L1 d5 L5 e5 z& ^) Q8 W
  32. 0 g- G2 T: }/ R
  33.                 //Commandline that will used at CreateProcess
    1 o# i3 `+ j  k3 i0 i5 q
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    . z' G' X: a7 V1 c

  35. % Y4 v5 {8 Z( E5 J
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)9 o2 H$ W$ ^5 p: N; Y
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    8 X8 ~: [' J+ ~* M! }- J% Y+ N
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)9 C6 }, Y+ M$ o1 J6 G+ u3 Y  A
  39.   A- @9 e) z  Y9 h/ U) ~
  40. # p, H, x" }9 h; @0 S' }' B, m

  41. 6 P8 |( S1 |5 F$ f2 K
  42.                 //Start DekaronServer.exe
    ; t/ O! d; K: ]8 L4 @4 S% t  I& d- w
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx" o/ g* R3 R$ P# V8 b3 k
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    4 _# X7 t( E: d0 r( `: n. [
  45.                         szCmdline,        // Command line( T- X+ q% f+ V% A2 T9 \
  46.                         NULL,           // Process handle not inheritable
    - ?+ y, o8 r" W% n& s
  47.                         NULL,           // Thread handle not inheritable4 R7 P8 u3 [- w; m2 v1 l
  48.                         FALSE,          // Set handle inheritance to FALSE9 H  q$ M/ K0 [' G: f
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx6 b: V% n/ |9 P. r
  50.                         NULL,           // Use parent's environment block; F' |; p: G3 e
  51.                         NULL,           // Use parent's starting directory
    # ~& m+ ~& L9 _: e
  52.                         &si,            // Pointer to STARTUPINFO structure
    - ^+ T1 n2 z: i( Z4 n. b
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    , ]+ P+ p3 D6 Z  k, V
  54.                 ) 8 d" o/ _6 t/ m) Q& F, N+ E& D
  55.                 {! M) y8 J4 B- F
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    - v6 V8 C& N) O: o
  57.                         return 0;
    $ [5 H, K6 X  ~2 C) J
  58.                 }. q/ H' Q  {8 _1 {4 M, d
  59.                 //Creating Process was sucessful% Z1 J  @, p4 h2 o4 D4 w
  60.                 else
    6 B9 n$ L  P7 Z5 X( D0 b9 \
  61.                 {
    3 n4 `3 B* p  a& V. f( y1 S6 ]
  62.                         printf("Sucessfully launched DekaronServer.exe\n");& x+ J/ R, T' k+ a2 y

  63. , E  c4 f9 y9 j3 |
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    . p+ r9 R* @4 ?% ~0 X1 H9 Z
  65.                         dbge.dwProcessId = pi.dwProcessId;+ v" M+ G, l9 g- d) F; V% s9 ]
  66.                         dbge.dwProcessId = pi.dwThreadId;
    ; }- z0 d+ M8 j4 m1 H4 X+ q, H

  67. / @) L* h6 S# p3 c
  68.                         while(true) //infinite loop ("Debugger"), S( A, @5 z+ m6 M/ [; ~
  69.                         {
    8 g( |# @+ ^+ S7 ~+ l# w3 U
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx8 V& f6 c$ P- s' \2 \+ y
  71. ! G9 Y2 F3 N+ o3 a
  72.                                 /*" [' O; m; d/ A/ w! f  i
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
0 f; I, U9 m5 p. [. E

  k0 g; i$ X, t8 a0 |$ O( x2 z- l2 o4 v4 e0 I6 W! A, i8 O
商业服务端 登录器 网站 出售

15

主题

257

回帖

1230

积分

金牌会员

积分
1230
金钱
890
贡献
63
注册时间
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

主题

257

回帖

1230

积分

金牌会员

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

3

主题

102

回帖

6877

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-3-11 00:59 , Processed in 0.033077 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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