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

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

[复制链接]

156

主题

353

回帖

6350

积分

管理员

积分
6350
金钱
1891
贡献
3950
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)   e, F) c. X% v7 k4 Y

: [) G/ c* G$ B' b$ j虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。0 m% G2 [/ Q9 w" o# Q

3 M# n2 p; K! F# o% E
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。0 E/ H/ ~. i( D2 O; l
  2. //  d+ n, e9 o3 T3 y: P9 c; ^. X
  3. ( q; _. y- L1 I
  4. #include "stdafx.h"2 z& V% C% }  u/ p( l
  5. #include <iostream>2 r1 {2 G; p3 P! X1 z7 Z6 f) \2 y! B* `( _
  6. #include <Windows.h>
    - I0 b" Y  B, C" W+ D. J( @
  7. #include <io.h>
    ' K- R2 {8 I% z0 q

  8. 4 y/ ?) S8 Z& ]- }8 l7 X- l% ?
  9. : F$ z) [4 z. m' J9 y$ D- e
  10. int _tmain(int argc, _TCHAR* argv[])
    * R9 ~: u- Y- t+ G4 i, X+ h- w6 c
  11. {
    ) O4 b+ b' ?8 Y3 I
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    ( E# n2 p% r/ G% B5 n
  13. 5 h! e2 ], Q8 U4 ~8 K( V$ R
  14.         //查看文件“DekaronServer.exe”是否存在2 U7 |# h/ W. {4 l0 u& I7 D* q
  15.         if(_access("DekaronServer.exe", 0) == -1)! j+ N* `" f7 u
  16.         {" _: E; w( \7 Y0 R1 m# P
  17.                 printf("DekaronServer.exe not found!\n");
    . `+ @0 S3 p0 m, z) g. Y
  18.                 printf("Program will close in 5seconds\n");- g  {0 X* \0 |: g6 J+ Y
  19.                 Sleep(5000);
    , k, V/ g1 I/ Y3 L
  20.         }
    3 @4 G. K+ }/ X: \( v' H2 T  W
  21.         else
    ' D7 @! e: L: R; J" Z
  22.         {5 z2 O  w, j, P
  23.                
    - M- b) t8 S* N0 |0 ?. Y: c
  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) c# `* N8 \4 E. }, z- |/ P
  25.                 STARTUPINFO si;$ ~6 E0 g( v% L: q, u- q  Q! U

  26. % t- ]: Q* |3 s, \0 O, 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
    3 n& f- u2 o8 w0 J
  28.                 PROCESS_INFORMATION pi;
    ( ^+ {6 r3 V6 b2 l5 X' {3 m

  29. ! \# X6 z4 q) c3 R& V7 W, ^8 p
  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
    ) ]$ Y/ {  w7 Z& L
  31.                 DEBUG_EVENT dbge;5 k) V1 g# r  j1 n0 [( |
  32. " R; v3 ]* N1 ^" f
  33.                 //Commandline that will used at CreateProcess) X$ D# O. e! t- W; |* K7 Y
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));4 N# I3 m2 o; {

  35. ; A' F( \0 n! y, q; o, m
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)1 [" _1 g/ _, M. B
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    # s4 g* `/ @! j+ R6 H# l# D
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    1 w& q  A3 M# g; [

  39. 6 }/ B3 v+ {0 V/ V* Y1 H; H

  40. ' ?: ^5 o' w3 }4 A& t

  41. 3 m, V: w$ N) n* |$ C  ]
  42.                 //Start DekaronServer.exe
    $ l4 R* `) H$ s* n- Y
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    ' ~  ]2 Y) g" N( |, o* h
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)7 c, r3 u& s1 `. U6 M! C  b
  45.                         szCmdline,        // Command line
    ' @8 Q1 q5 t- V$ Z: X
  46.                         NULL,           // Process handle not inheritable
    7 W! ~8 c8 u  f/ C
  47.                         NULL,           // Thread handle not inheritable# N2 v, L9 V( m- e( r, Z" i% O) P
  48.                         FALSE,          // Set handle inheritance to FALSE3 q8 E' k: Z: W2 o: }+ a! m; F
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx3 M' x5 |/ C# `$ Y
  50.                         NULL,           // Use parent's environment block
    ) r' p; q' d0 p
  51.                         NULL,           // Use parent's starting directory 3 ?: f8 H# l3 B' S
  52.                         &si,            // Pointer to STARTUPINFO structure8 w* B5 `4 L5 {+ f4 }  c% }
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    ( a9 K2 [5 `8 M( q/ }( S0 |
  54.                 )
    ) {: t  m4 `: ^+ ]) |$ @6 p. ^4 R( j
  55.                 {
    ) T9 r, g. @6 D
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );- L0 C  l3 y& ]+ @8 E6 B
  57.                         return 0;
    ) t, Y$ Z2 {/ h) a
  58.                 }, K- ?& o/ S0 C% z8 G
  59.                 //Creating Process was sucessful
    ; t+ L* t3 _& j  w* L
  60.                 else% Z- ^- c6 n( l; t
  61.                 {
    + p; i, e3 Q: c& r/ H# I9 j
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    % k% `/ P  f% l, a0 X! W5 x

  63. & S1 ~0 k* u- d" {
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure4 G, z( @/ P- p8 ?3 T
  65.                         dbge.dwProcessId = pi.dwProcessId;! S# T) h2 c! N6 B1 G  o/ A
  66.                         dbge.dwProcessId = pi.dwThreadId;
    5 A8 S5 M" `6 a1 E2 Q: _
  67. 3 Y5 P, c4 j! W. r4 S2 P0 E
  68.                         while(true) //infinite loop ("Debugger")9 D) S% x% x" E9 T& d( W" m9 S% I
  69.                         {
    % a3 f- \; D; h% @: o% j' Q0 i3 t
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    7 |8 O+ ^, q* c: a

  71. " |4 b* ^$ X) o" _
  72.                                 /*7 Z, n- c0 M7 z$ O5 B
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
* q2 d6 e  ]2 A' d( q

; B* H0 o4 K6 U+ S5 c! D: H# G- l/ ^  A& B
商业服务端 登录器 网站 出售

15

主题

256

回帖

1234

积分

金牌会员

积分
1234
金钱
851
贡献
107
注册时间
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 | 显示全部楼层
学习学习赞赞赞

15

主题

256

回帖

1234

积分

金牌会员

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

3

主题

102

回帖

6042

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-20 20:54 , Processed in 0.096607 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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