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

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

[复制链接]

155

主题

348

回帖

5986

积分

管理员

积分
5986
金钱
1862
贡献
3621
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
, i& g; u  B" _+ b4 m1 t
. o3 J3 q6 u6 v" {' C# V虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。& y, [! _0 m/ g+ Z0 c% d

( I% F" J4 h9 q7 I2 I  }
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    4 F! X6 n. ~; G0 B- i
  2. //+ R4 F) t2 y" g8 S5 S5 V
  3. . E7 d, U7 B3 }$ A1 t7 t6 x1 m
  4. #include "stdafx.h"2 j* k6 M0 p( a0 ?( J" D& J
  5. #include <iostream>
    $ ~2 a9 o' q# v( _/ r: }! h
  6. #include <Windows.h>* o. s; D( J, m$ e5 o1 p, N
  7. #include <io.h>
    2 m: \0 y" k- e; r$ C( C
  8. , J& ^4 I- i- q/ X. M5 R1 Z, i
  9. ; E) G- O8 D" J
  10. int _tmain(int argc, _TCHAR* argv[])
    " |, n% |/ D% C5 y& x
  11. {
    % G/ s: V6 M/ m6 Z8 N
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    # c3 p1 a4 O1 K: k% A0 d
  13. 1 |+ f+ {: ?, n+ a+ G
  14.         //查看文件“DekaronServer.exe”是否存在
    # m! o/ J4 o* k$ m# R
  15.         if(_access("DekaronServer.exe", 0) == -1)- K4 Z) @- d* b. v1 I
  16.         {1 f  @7 E' o% F1 @
  17.                 printf("DekaronServer.exe not found!\n");. p/ V' k/ A& K7 |& \% G& B4 Z- K' z
  18.                 printf("Program will close in 5seconds\n");
    3 @# F/ e: `. m0 Q  Q; f
  19.                 Sleep(5000);! ~8 T' q- h+ R2 \# e4 ?
  20.         }9 O# J* [+ c4 w- G; Z) \2 p3 H
  21.         else3 B# x4 k* Q% U0 [7 t! _
  22.         {
    # A. W" c+ T7 m: Q- z3 V7 K9 c
  23.                
    6 w. l. j  t) e/ T4 n
  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  ~9 u, m' k! M! V7 R0 r
  25.                 STARTUPINFO si;
    2 f4 r1 i; s6 ~+ ]0 ~: U) T' H
  26. # S* w! z( M+ W% \- m. D
  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
    2 R8 V$ A; Q) u- m% E
  28.                 PROCESS_INFORMATION pi;
    ; b+ L8 {5 @. y6 _9 ^+ S

  29. 0 D. m: G2 A/ m* E
  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
    2 [$ T0 p/ I5 `# P# S; h
  31.                 DEBUG_EVENT dbge;0 O8 _! g& f2 q
  32.   I( g* s" l5 }7 L( ]1 V
  33.                 //Commandline that will used at CreateProcess7 @5 s8 m: k0 @4 J$ @$ P% S
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));, O% I! C. g6 W0 u
  35. 9 j3 r3 f4 ?1 V
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)6 U1 v( Y- ]& R+ l" F$ z& v
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn), T" o' j1 {; q  V0 M
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)) ?# q4 s$ g/ p& C% j& c2 W
  39. 0 O! H6 N: w( g
  40. : g  g/ _" N% R$ r

  41.   ~8 T$ w% ^* h; I: y$ ]
  42.                 //Start DekaronServer.exe
    ) |0 E$ d0 ^! p
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx3 _! @5 T7 n. x% r( D4 @4 Q  w/ ~
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)- s! {) {5 U/ }$ b! k* P  g0 r: t$ R
  45.                         szCmdline,        // Command line
    1 q% z: a3 G9 m( ^  ]* R. T
  46.                         NULL,           // Process handle not inheritable7 {, L& m4 d- k) W' g) \
  47.                         NULL,           // Thread handle not inheritable
    * F5 ~6 \3 k, U! C5 [
  48.                         FALSE,          // Set handle inheritance to FALSE
    2 e5 ]  e. k+ u# ^! f# h" s
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    / S0 j4 l5 Q7 z& p
  50.                         NULL,           // Use parent's environment block
    - w: {: a/ g' Y: ^
  51.                         NULL,           // Use parent's starting directory
    9 _: P: m* q8 l( T* @( N5 g6 |3 O
  52.                         &si,            // Pointer to STARTUPINFO structure
    ! l; `+ q' M& D& t" k) b; {
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    ( p# U8 a8 i' _' A
  54.                 ) : o! p9 T9 Q7 I& E% z0 v% I  U
  55.                 {# V; F- g% Z( H% {
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );6 C2 x5 h* [! I; X
  57.                         return 0;* ~) D3 S4 h1 T8 Y0 l8 y
  58.                 }
    $ a5 q; H! s" U4 j( k2 @
  59.                 //Creating Process was sucessful
    # q( k; b0 L) J8 X5 l
  60.                 else
    ( X; b7 }' X! E3 K6 _
  61.                 {
    & n. y5 y8 U9 @3 ~) T
  62.                         printf("Sucessfully launched DekaronServer.exe\n");# I7 l1 `( Y2 r( g! R: ~" Z
  63. 1 n, J/ d2 W2 c+ k9 I
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    / U- X1 O( @0 b+ \; N3 s. n
  65.                         dbge.dwProcessId = pi.dwProcessId;# [2 c4 M, M. o2 F5 U8 G
  66.                         dbge.dwProcessId = pi.dwThreadId;
    3 U& b2 c# T  q0 B1 c! z
  67. 4 Y5 W% `! \! H
  68.                         while(true) //infinite loop ("Debugger")' D4 J3 N7 V+ K7 O
  69.                         {
    " U* l2 `$ m! \
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx. L8 G* z, h0 @' _6 X; C+ V: q

  71. 5 k% }  X0 h' s. ~2 S6 V* Y, R$ V
  72.                                 /*
    9 y8 ?- i6 M$ }3 L; b: h* p
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
2 ~* o6 V/ j2 \( R% |2 c$ Z+ f4 v

6 L6 j7 p5 S/ @" z! p( h* V- O
% K9 D, \2 @; z+ z
商业服务端 登录器 网站 出售

13

主题

251

回帖

1242

积分

金牌会员

积分
1242
金钱
814
贡献
159
注册时间
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

回帖

1242

积分

金牌会员

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

3

主题

100

回帖

5693

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-30 03:33 , Processed in 0.093361 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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