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

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

[复制链接]

164

主题

416

回帖

7820

积分

管理员

积分
7820
金钱
2282
贡献
4958
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) ' l9 t& P7 H5 _+ Q" A, d# q2 N+ p
4 A9 E$ t* T+ r- B( E
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
1 j& i7 _1 a- A9 X5 K- X
, Y- g* ~# G! K/ e# r
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。! V# r2 h& Z' \: Y+ ], `
  2. //
      z% M. b3 i, [; N# `. i
  3. * a. y0 Y6 F4 r; `0 M2 x* |: o
  4. #include "stdafx.h"3 J7 f6 I0 @7 a' w0 A! X+ i
  5. #include <iostream>
    # |5 f# J  ~0 F( W1 U+ b' u! u
  6. #include <Windows.h>
    . n" r- E# u" c1 U2 i( X3 {# K, I
  7. #include <io.h>
    ( O7 F+ @2 l; s3 v4 k, p
  8. 1 }( I. }7 e: U2 j! `- S  I

  9. 4 g% [; @# G) u
  10. int _tmain(int argc, _TCHAR* argv[])1 z$ k( @! t3 J0 V2 f- H
  11. {8 O/ b4 n* h/ X( S
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    , g5 h, `' \' S  R

  13. / X; h) i! x8 T6 S; L7 J
  14.         //查看文件“DekaronServer.exe”是否存在
    1 t9 ]1 O6 S5 ~3 ^' f$ v9 ]
  15.         if(_access("DekaronServer.exe", 0) == -1)
    " L$ D3 H4 X6 p8 g% U5 G! y! P: D
  16.         {
    , R5 O3 [  a8 E: A; m! Y3 v
  17.                 printf("DekaronServer.exe not found!\n");( @! i$ a& u. v2 |) Z+ h: L
  18.                 printf("Program will close in 5seconds\n");
    * W' a- A6 W! }
  19.                 Sleep(5000);
    ) D( t6 V# U/ J" u0 y, j
  20.         }
    7 k- @* f: M3 w/ ~& u4 [7 P
  21.         else
    - k: p1 W+ s+ E$ ^
  22.         {! y! ^. {: `6 L
  23.                
    1 Z( g9 j! h5 }& J, c4 \
  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
    # m2 q# x5 a) @3 c1 p
  25.                 STARTUPINFO si;9 ?' `& {$ G  I9 j
  26. & }1 J# m! O$ R) Z) D0 h
  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 S7 w! F& e) h/ T6 t$ K1 q" n0 a
  28.                 PROCESS_INFORMATION pi;' {( ~2 s. S9 T  |; T! B+ h* w( D
  29. 7 q4 C5 \: Z8 c" t! W: K
  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( x3 J8 @( y/ a3 \0 o  J
  31.                 DEBUG_EVENT dbge;3 M+ o0 g  y) ]( U5 d/ o  r$ W
  32. ; m( l$ q0 v7 K  K, ?0 j
  33.                 //Commandline that will used at CreateProcess) |+ H5 B) q1 X$ [, N8 A
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));* o) F! y) D+ F2 V7 q

  35. 6 S8 }1 t; Q, U7 M9 F4 H3 Q
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)0 G* b  d% U5 O9 W0 j! P
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)5 r2 H3 t1 O6 C' R  o) T
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    1 M. n8 W) ?: d, k( f; C8 l

  39. 9 B0 e. G8 S0 ~0 _/ z9 ]" S  ?  L
  40. 4 H3 w7 `/ o# U1 @

  41. $ ?- U2 j& G# H! }4 o1 d
  42.                 //Start DekaronServer.exe , T" J' Y1 F5 n' o0 ]
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx. ~) v  @) w( e( k6 ^
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    ) Q! C# Y, z: d' H) l* ?% b/ ^
  45.                         szCmdline,        // Command line
    - _( k4 b# r5 g' e
  46.                         NULL,           // Process handle not inheritable/ [4 {" l  ~+ Q' g
  47.                         NULL,           // Thread handle not inheritable3 J4 R, z! j" y$ \
  48.                         FALSE,          // Set handle inheritance to FALSE; Q) V/ o, K& i2 [
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx9 K# A% P1 B2 P# S- Y0 p
  50.                         NULL,           // Use parent's environment block& |# R7 K8 J3 x
  51.                         NULL,           // Use parent's starting directory . o1 Z9 h+ m' G- _+ b
  52.                         &si,            // Pointer to STARTUPINFO structure
    " `: d( {* p' |: r  v  g7 M6 q  G
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    ' X! ~$ U! ]% y# [+ f
  54.                 ) * J9 W; l- N' M& F
  55.                 {* D5 E" G$ A6 H  c; b
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );8 m5 r& C2 V" r
  57.                         return 0;$ T" Y" a- v( t) ?) L" ?, a
  58.                 }
    5 G5 s3 Y0 f, U$ q% l/ P
  59.                 //Creating Process was sucessful( U; H3 M; z  K! R3 i$ ^  ~- B
  60.                 else! G5 Z1 y  y0 a& H# V
  61.                 {7 J! [/ P9 V& I, a
  62.                         printf("Sucessfully launched DekaronServer.exe\n");& F, L6 B1 |( V9 i
  63. - h5 C7 i. Z! g- x% l
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure4 E- t3 |+ M+ I6 y  z
  65.                         dbge.dwProcessId = pi.dwProcessId;; u" C1 z7 j6 l6 z* P0 F3 V
  66.                         dbge.dwProcessId = pi.dwThreadId;. v2 X' |' T3 M: {+ A3 g1 E( }
  67. % w- G* C: }7 ~# o' ^2 `& g
  68.                         while(true) //infinite loop ("Debugger")* z, ^, h4 W: X
  69.                         {1 I, H  c( V- Y' e' m* l2 W
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx3 ^4 L2 `$ S  I* z3 u: e. A1 [
  71. : T" O# {9 h2 ~) @8 Y( ~
  72.                                 /*7 E- ]0 S! T3 i! G* ~3 u" O4 [
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

- S* A% p# m9 E, _1 ~
) H/ k& G6 w  [! A' C. X7 v' e+ O# G# l$ U6 g6 h
商业服务端 登录器 网站 出售

16

主题

262

回帖

1370

积分

金牌会员

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

16

主题

262

回帖

1370

积分

金牌会员

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

3

主题

102

回帖

9057

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-7-3 07:41 , Processed in 0.060299 second(s), 30 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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