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

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

[复制链接]

160

主题

385

回帖

7427

积分

管理员

积分
7427
金钱
2133
贡献
4749
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) # b- z: B6 [& Y0 S6 d# U! Y9 E
% b( e, y  z  K. F( f3 J
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。, w/ l" h  m5 L3 T; ]& t

2 A) C) Q+ `" N* ^0 ~
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。  C3 ?% a) L1 W) q0 y) f
  2. //. l, }# L( x+ t# U" {

  3. 6 X7 w) B8 [6 B. a4 i+ o1 w' _
  4. #include "stdafx.h"
    8 u/ V7 h/ ]& [2 E& v( A; y6 g
  5. #include <iostream>6 |( @  D% D' S' ~# L0 o2 R+ @
  6. #include <Windows.h>4 D" {9 `& x/ V! g4 U% A) b- Z
  7. #include <io.h>
    8 S: w, k: i7 T5 N7 }8 g5 t" E; X

  8. 4 T4 l) ~8 c2 e2 S: l; {

  9. & \7 j% n9 I9 Q
  10. int _tmain(int argc, _TCHAR* argv[])+ T  l% \% m7 h4 K
  11. {, n. }% \& ^) m# O( z4 ~
  12.         printf("Dekaron-Server Launcher by Toasty\n");+ E/ a- p% O9 d7 W& V

  13. * B) O! \) j7 C/ o6 C3 J
  14.         //查看文件“DekaronServer.exe”是否存在
    ( I# k1 @8 B6 W  q
  15.         if(_access("DekaronServer.exe", 0) == -1)1 O7 {& C; e: _* @0 O5 W
  16.         {
    : |9 @/ b# C; Q8 b+ o( X
  17.                 printf("DekaronServer.exe not found!\n");" K; w7 U/ P+ E* J3 `! Q  M
  18.                 printf("Program will close in 5seconds\n");
    5 b& X' y, J4 r! n: t
  19.                 Sleep(5000);
    2 t# Z. K* m. A5 w
  20.         }' B& S) p8 w/ l) i# ]; i* i4 \9 Z
  21.         else% e5 T$ w# i# v
  22.         {
    ( y" d  t. ~  Y6 T$ I
  23.                 8 E1 Q6 ]$ F* F* x! K+ X& X. `
  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+ J! t& j: U; K2 x% I4 Z* ]
  25.                 STARTUPINFO si;
    7 l6 h  x4 h" z6 y4 T! J( U8 W

  26. , b- g7 F0 @7 @: o+ z3 r6 p4 `' 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).aspx
    ( Y2 }) u3 j$ ?0 P. |- ~
  28.                 PROCESS_INFORMATION pi;
    ' ^; {6 j7 w5 C- {  Q9 ]1 W. C

  29. : N0 y5 Z8 B- \( o4 d
  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 A# P! ]3 x9 v
  31.                 DEBUG_EVENT dbge;
    * j" Q3 m/ h) L& B8 x4 {9 m6 g
  32. 6 f+ w$ J% w9 A* B& m1 W# r* X
  33.                 //Commandline that will used at CreateProcess' _7 A# L' T) V4 F, `* h% E
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    ' n) E  [5 v0 y! z4 ^1 [( R

  35. . H0 V% Z5 L: U' z/ w
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    ' z3 W1 _1 }3 P* L* f0 F, d2 b
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)1 u. a+ E! m. u8 B0 _- K
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)( r  r7 ?0 `& F/ N7 B2 R

  39. & U& i! M3 p. S  W8 F4 I
  40. % X- o( v" E" B8 b: k( ^
  41. 8 E& E4 I7 v) v+ w& }; Q) G# p: A
  42.                 //Start DekaronServer.exe
    , @: h( M& l1 H! q* a/ A) T
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx" S" P1 m7 V7 |* V; M
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)$ v- b. g1 {% m  R6 t1 r" n$ K2 f
  45.                         szCmdline,        // Command line! F3 y0 E5 K' g- v$ N5 j
  46.                         NULL,           // Process handle not inheritable' \: }- o, p4 z" a+ e3 A5 M
  47.                         NULL,           // Thread handle not inheritable6 E7 f/ h2 G, |" r. P' s2 g" a
  48.                         FALSE,          // Set handle inheritance to FALSE
    9 A5 a1 Q& X* |: S1 Z  q- J# N" V
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx# f8 x: q% _( A' I! |' C2 F
  50.                         NULL,           // Use parent's environment block/ b, h0 v. h+ j: [8 G3 L
  51.                         NULL,           // Use parent's starting directory
      j& r! [' K" X1 g: ^# S" m2 H
  52.                         &si,            // Pointer to STARTUPINFO structure3 m# n7 t6 [  i; V4 v
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure7 d- h. @1 j7 t
  54.                 )
    # L9 N  S% g2 V# h" S( J
  55.                 {" s1 O; I/ }% x! x- C
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );- S' N' c2 q2 _& K# f
  57.                         return 0;- |$ o9 Y) c$ |6 U+ O( p
  58.                 }  D1 |9 n2 |  `, }: F( h
  59.                 //Creating Process was sucessful4 c( s1 V+ }+ F" X2 l: f" F' _9 g8 z
  60.                 else
    ) `9 P3 t' |+ U; O4 K  x4 U, ^
  61.                 {& {6 z" h0 Q8 j, Z: i$ l1 H2 M% v
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    3 x( F- A! _  @3 U* c% H) M! d
  63. . t4 l+ s" e" ^+ P! v
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    9 ], I) i3 P# \! V! ^
  65.                         dbge.dwProcessId = pi.dwProcessId;. }% z7 ^5 p. m5 X3 T
  66.                         dbge.dwProcessId = pi.dwThreadId;1 @7 K' [& H; {. Z/ p- {3 A* j

  67. 1 ^2 a) C2 O% D; N! J' n
  68.                         while(true) //infinite loop ("Debugger"). n1 {7 B1 F! Y4 A4 V  Q- k
  69.                         {
    8 _2 l8 I+ B/ ^! t" b3 _9 s
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    ) s5 h& g/ y2 j0 i# y1 q

  71. # x3 m7 Z3 J, G6 Y0 H. N
  72.                                 /*& ]2 _3 Q, {, B- d% g
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

) Z2 Y7 l* d: ~+ l' Q5 l
" M% O/ d* _6 z: C
5 L* y8 H& w+ H7 ?* |2 `0 I9 d
商业服务端 登录器 网站 出售

15

主题

260

回帖

1292

积分

金牌会员

积分
1292
金钱
931
贡献
81
注册时间
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

回帖

1292

积分

金牌会员

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

3

主题

102

回帖

7937

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-5-3 11:55 , Processed in 0.036251 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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