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

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

[复制链接]

161

主题

385

回帖

7437

积分

管理员

积分
7437
金钱
2139
贡献
4748
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) # p+ V% J! n' w) t  B3 a

0 _9 b! b3 T: D9 I) f  i! z* d虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
( e; i  }, o. v. U8 K! i3 m* m6 g! R# `" ~8 D1 C
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    , m4 E# M. a! h1 D* r7 ?( Q
  2. //
    * I$ s4 s( y. Z4 @' x
  3. ) `. t& I9 }6 q: w& V  ^
  4. #include "stdafx.h"
    5 I4 r  d5 X: h) L2 X
  5. #include <iostream>: d' O5 g, h* ^6 T
  6. #include <Windows.h>
    : P; H( _+ L% T4 U9 G
  7. #include <io.h>0 f) X- y# p. ]0 H1 C

  8. # i) c/ w& n1 y
  9. 2 G6 e$ X( {/ s8 y5 b
  10. int _tmain(int argc, _TCHAR* argv[])
    ; e! ?- L0 t9 |. b1 n7 N3 \% s
  11. {
    & I1 ~0 Y9 p* P, I2 |
  12.         printf("Dekaron-Server Launcher by Toasty\n");  K% s% o2 V" S2 h) o+ H; |
  13. - n9 X" J- I; `! U
  14.         //查看文件“DekaronServer.exe”是否存在
    7 P4 E( V# A( J
  15.         if(_access("DekaronServer.exe", 0) == -1): B5 y( ]. g3 W( Z0 m
  16.         {
    * f7 `; {) |9 ~  n! f0 r
  17.                 printf("DekaronServer.exe not found!\n");
    8 q6 E" N. p9 V( @  M& W
  18.                 printf("Program will close in 5seconds\n");1 o7 a& X! L0 U  ~" g* m, }
  19.                 Sleep(5000);
    * r/ R% ~3 |/ k  s: K* ]# q" B
  20.         }/ J4 b+ N1 B0 X, n3 O( a4 y
  21.         else) r" l" j5 z8 I. ~: S
  22.         {
    $ {1 o6 C) ], \. l* G* f3 O( h5 R
  23.                 ! W/ F7 ?3 }1 M) {1 c9 O1 O
  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
    # y% P! S: K  U( v8 F" d0 L% d
  25.                 STARTUPINFO si;
    ' y2 ^. o' c  ^1 ^0 k% }
  26. , v; m/ m+ J4 a
  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).aspx3 Y( L$ i7 f: z+ K% t1 G
  28.                 PROCESS_INFORMATION pi;
    # M: V9 D3 S* z2 {9 f5 U6 L( Z

  29. ) p2 Z8 M: j% k6 C- u+ h9 m
  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% L/ v; p7 T) z7 e' p" J
  31.                 DEBUG_EVENT dbge;2 J" L0 u, [! h8 s2 y+ r8 A

  32.   O* b" W! v# B$ a) T
  33.                 //Commandline that will used at CreateProcess
    : ~8 g5 }/ _8 \4 u
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    4 ]- c& s# v) R0 r& ]- l- m
  35. 8 \7 g& Q* a% r9 q  ?8 m
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
      f/ l$ I$ ?) ^
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)/ d8 G% ^7 D0 a6 }
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)  T( i. s' j8 I1 m5 U- I
  39. ! H  k/ R3 ?) K1 a) X/ N) j* Y/ r

  40. ; [) d. A* w" ?5 I6 W9 j
  41. ; z  E) B4 O. X; u1 i
  42.                 //Start DekaronServer.exe
    ( W. |( \" y) O1 Q" _* W
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx! a$ Y+ G- ~7 W0 V4 u0 E3 {
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    , I% n* B8 ~3 W, _
  45.                         szCmdline,        // Command line) I3 I9 J" E# ~! x1 ^5 s8 y
  46.                         NULL,           // Process handle not inheritable
    . u; O* F6 u$ s( W# q
  47.                         NULL,           // Thread handle not inheritable
    - G/ J  k, j2 w
  48.                         FALSE,          // Set handle inheritance to FALSE
    & E3 j$ M8 n2 D0 h! {5 n3 R" b2 {
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    ! S: M8 u$ V6 L9 L" n2 S
  50.                         NULL,           // Use parent's environment block
      N/ X+ r' d5 X+ h
  51.                         NULL,           // Use parent's starting directory
      M& [  _) d! i8 n
  52.                         &si,            // Pointer to STARTUPINFO structure! M; W% {& H9 U0 \& J2 b2 Q, |( c
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure! C( G( B6 O) I
  54.                 ) : _! b3 N7 J; ~
  55.                 {: q1 D; w0 ~2 c* P; y  K
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );/ V6 R% ~5 I, Q1 L; f3 ^8 L
  57.                         return 0;
    * z) F% Q# b2 t% F" W& Q# {7 @
  58.                 }
    : q' R$ E3 A8 Y2 i
  59.                 //Creating Process was sucessful
    6 h$ T$ {) f( f
  60.                 else
    6 I" ?; `9 s% h: l$ i
  61.                 {
    ! t2 s" @) h  \! R" [4 l
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    , j6 b" d2 s2 }4 R8 s6 n

  63. . t2 |& o+ R+ G- P1 B6 r
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure$ f# m% z) g7 o8 c
  65.                         dbge.dwProcessId = pi.dwProcessId;
    + H% ~# I1 q/ j: O9 v
  66.                         dbge.dwProcessId = pi.dwThreadId;
    " M: k! `0 c: z) }3 Z3 a/ h0 `' }
  67. / L* ^! M2 ^) [% R! ]3 ^1 z  L/ Y
  68.                         while(true) //infinite loop ("Debugger")
    $ }/ ?& N; D1 u/ U# f& [
  69.                         {
    $ v, W  w/ T+ w& r. P) U- e
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx* E4 M7 @8 j2 B" t  g8 W4 ^- H

  71. " W) h, f8 C$ \5 s2 a4 O- x
  72.                                 /*
    : q! u# L4 `2 V$ ?2 C8 e
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
6 ?7 d: g9 R/ \. E

3 O4 q8 f% d  I$ ~7 X0 {& ~2 m$ [" ~$ Y8 \  Q; J( u4 Q
商业服务端 登录器 网站 出售

15

主题

260

回帖

1295

积分

金牌会员

积分
1295
金钱
933
贡献
82
注册时间
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

回帖

355

积分

中级会员

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

15

主题

260

回帖

1295

积分

金牌会员

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

3

主题

102

回帖

7997

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-5-5 04:50 , Processed in 0.043110 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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