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

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

[复制链接]

157

主题

370

回帖

7161

积分

管理员

积分
7161
金钱
2054
贡献
4580
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
5 ]( H" }( D' T- T& l; O. E
2 R+ |( G  p" n- j0 H虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。8 {3 k5 E* P( k: X# W. V+ j
( i: f1 K, `" t! ]8 }, ~9 \9 m, O
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    6 z. u1 ?, ~* y6 }  l; x
  2. //3 l% y% @/ }3 y4 q) N4 h# W. Z8 o0 k

  3. ! k$ t. b, \) |, |
  4. #include "stdafx.h"1 c" }4 {  q8 _2 g0 R
  5. #include <iostream>. A# e# `9 |% |& i* t2 O; [$ [! r
  6. #include <Windows.h>1 A# i: `. }. R" s; F
  7. #include <io.h>
    1 f" D- p& S+ |$ k6 R. B

  8. 1 R7 v) b/ }8 M. Q5 E0 N
  9. , z$ N. j# J! e; b
  10. int _tmain(int argc, _TCHAR* argv[])
    ( V" _. ]" F2 o! u
  11. {
    4 O. q1 e1 p) g
  12.         printf("Dekaron-Server Launcher by Toasty\n");9 Y* W+ ]. ]0 ^- w
  13. & J: d: w4 ]2 b  Z, u+ z& y; F
  14.         //查看文件“DekaronServer.exe”是否存在7 b: e/ N$ v2 q# i" g
  15.         if(_access("DekaronServer.exe", 0) == -1)
    " v: L4 Q/ @/ c* \/ }0 u) b' b: r
  16.         {
    2 s! K  W/ L0 X" E% c
  17.                 printf("DekaronServer.exe not found!\n");# T) K" d- m0 y7 H, Q9 J: z
  18.                 printf("Program will close in 5seconds\n");4 |( s$ x" m* h- s! z. S- b) S
  19.                 Sleep(5000);$ A0 w; F! Z3 y' n) u
  20.         }
    9 O3 `% o5 w0 \: d
  21.         else
    - Q( k. ~: D: w% y0 [" d3 G
  22.         {* X- o% `0 t2 s" m
  23.                 # |5 R4 i0 Q8 ?+ i: U/ y
  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).aspx6 a- K! O) g0 J
  25.                 STARTUPINFO si;/ `3 R7 |1 Y3 D# t% h; C, ?
  26. " h/ ^8 L4 a, d/ H" ?& Y: H; C
  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 `& y# m, D7 @. I3 F2 o: C
  28.                 PROCESS_INFORMATION pi;" D. v7 D" a& k- l( m2 }. d- H, Z

  29. ) k, W1 `( s, p2 t( `9 {! f
  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).aspx5 ]) |& C& h9 [3 \8 I* H( p
  31.                 DEBUG_EVENT dbge;$ O" q- e9 O! t6 ?6 ]3 X4 ~" K7 s
  32. 5 T4 w) K2 S: V+ u8 c
  33.                 //Commandline that will used at CreateProcess: O- I6 }  S/ D
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    ) x, Z' c, ]& b& W& z% M

  35. ( u( t# a2 {" c: [5 W; u) u* j
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)3 W6 W  i- B5 C0 ^( W
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)* q4 m6 {, x, M0 z$ H
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    8 A6 Z3 r5 J! T5 V+ q* `; b

  39. 4 J) Y' F' w; y  [$ R: W

  40. & n" D# g" Y! O7 H+ z: ]

  41. * c4 E, x1 C; X3 T
  42.                 //Start DekaronServer.exe
    ) V& m7 e- \2 V+ w9 E3 h  o% ]
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx; I, c: a8 v; }
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    , t- \8 P. W$ Z+ p! R; _
  45.                         szCmdline,        // Command line
    $ W- d) r+ d! m
  46.                         NULL,           // Process handle not inheritable
    & [, `2 U' Y! i8 g: R
  47.                         NULL,           // Thread handle not inheritable0 g7 W3 t( j6 H! E$ w+ F
  48.                         FALSE,          // Set handle inheritance to FALSE
    : B$ K1 m* ~" Z6 {
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    ! b5 m- n6 X0 E% I! v
  50.                         NULL,           // Use parent's environment block
    % }. l9 d1 ^1 a$ X) _
  51.                         NULL,           // Use parent's starting directory
    * e8 {5 ?' s+ L
  52.                         &si,            // Pointer to STARTUPINFO structure2 r0 Y5 }9 t8 ^
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    2 h2 n& S& K) K. @( Z
  54.                 )
    - _. n' u2 r. ~
  55.                 {
    5 j. K- ^% M" j7 m3 R& P% H
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    " X0 ]+ n$ G7 J  F1 B+ k% J
  57.                         return 0;. }8 a% k; U- ^6 `0 G$ B
  58.                 }& f7 E2 x( {; W3 i% `6 P0 {
  59.                 //Creating Process was sucessful3 a" ~% N2 Y2 Z
  60.                 else
    & l* W2 ]( ^" G" D
  61.                 {, N$ `4 Q0 g! u2 o' g  E. m- p
  62.                         printf("Sucessfully launched DekaronServer.exe\n");7 ~& v9 s- f- R
  63. 1 t- a0 ^4 J  [
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure* m, \% g4 y! r3 f2 V# A  u$ A
  65.                         dbge.dwProcessId = pi.dwProcessId;+ i3 R4 {: F/ N2 n# G
  66.                         dbge.dwProcessId = pi.dwThreadId;: c% j% t0 \3 Z

  67. 7 }( b. j- L3 f1 {+ e
  68.                         while(true) //infinite loop ("Debugger")
    ! L' C8 f  \- e- Q$ C7 {0 j
  69.                         {
    ! v2 e0 W+ l, q" Z
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx2 u6 l6 H! n% F. {, [
  71. 1 v% W' w# h9 p1 Q( J( h
  72.                                 /*
    7 Q& T) K+ w, h6 S, E
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

) D4 a% d$ {+ h; q( d4 R3 X4 H7 V: i0 I# @0 ^' I4 `/ Q

1 x/ ^9 y& X3 U4 M
商业服务端 登录器 网站 出售

15

主题

258

回帖

1245

积分

金牌会员

积分
1245
金钱
903
贡献
64
注册时间
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

主题

258

回帖

1245

积分

金牌会员

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

3

主题

102

回帖

7460

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-9 09:08 , Processed in 0.039716 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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