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

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

[复制链接]

136

主题

190

回帖

3887

积分

管理员

积分
3887
金钱
1362
贡献
2199
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)   p# R7 ~- u% r' T5 Z
, X9 Y9 L2 C8 M4 N( }, F
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
- \$ k3 E$ J; K! S" C
/ a5 E) h+ g% W
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。/ u) ?5 A* F- H' V. o$ v
  2. //
    & Q: p7 f( S2 Z4 t3 N. U7 e1 L7 l) l

  3. . J  f0 v$ s+ T5 b/ D6 V
  4. #include "stdafx.h"  P% f1 K8 x, ?7 n
  5. #include <iostream>+ ?! n. O  e# C3 L' u' T
  6. #include <Windows.h>, ]: }" z7 C+ M  p, ?, X
  7. #include <io.h>
    * {, A2 S: L) o
  8. ! l  q: w8 m  g% i+ i: i7 o
  9. ' D' D1 @, S; {1 M0 z- E+ g  q
  10. int _tmain(int argc, _TCHAR* argv[])
    + L* u  }6 G1 I8 Z
  11. {
      J9 _' [1 o  N* m  h7 b2 u
  12.         printf("Dekaron-Server Launcher by Toasty\n");
      n$ s6 V0 V* e# k4 t- g
  13. 4 {- h0 i2 H, g3 B5 l5 ?$ V* }0 h- A
  14.         //查看文件“DekaronServer.exe”是否存在1 b  i/ d$ {9 W, `& _+ Z8 ^$ ^
  15.         if(_access("DekaronServer.exe", 0) == -1)
    # S$ a: k  j; T2 {" g6 t5 }
  16.         {: u+ W. t' j, Z; H
  17.                 printf("DekaronServer.exe not found!\n");
    - M% u3 f2 p5 ?( i: J" @/ Z3 n
  18.                 printf("Program will close in 5seconds\n");3 C# O( A2 `! P0 `7 R$ V' W8 _
  19.                 Sleep(5000);
      T, P- E/ {8 h7 U! o7 W
  20.         }
    % v$ B6 r2 h  C
  21.         else4 c; R4 {' E6 P. V, \
  22.         {
    $ L6 t3 T- Z  B6 F6 `, f) ?% n
  23.                
    % b* Z% H* X2 P' A
  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
    / W7 r% {4 S4 `0 [0 k
  25.                 STARTUPINFO si;3 c8 T  h! O6 M6 i' ]/ U: [2 @
  26. 9 h, [9 O5 N  T) B3 c$ K" j
  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).aspx2 C" P" z3 L  R; |7 G- K
  28.                 PROCESS_INFORMATION pi;8 c# E6 f3 ]) I! t

  29. % v0 n/ n& _2 |0 b7 N9 Y7 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  m' H# w1 J( ]& Y- Y/ L" k, y
  31.                 DEBUG_EVENT dbge;
    4 u  `% D% V/ X9 g' w" ]" B
  32. : Y7 E0 k- ~% ?% c) r, _
  33.                 //Commandline that will used at CreateProcess
    . w/ ?* N5 U' @
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    ' W2 |  @9 `( t
  35. 0 o' i; Q8 C9 b/ H3 }
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    / U$ b; w: I# s3 R" y" h% t/ o! b
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    8 ?) a1 [+ ]! S/ q" j
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)  b& \$ M2 \- g" R/ A7 N6 [
  39. ) s- \; T. U1 T! p7 S4 K1 M0 k
  40. & E; V4 `9 z& Q7 W% a; T7 ]
  41. 9 a, K: b8 k9 Q" P3 U; p# z
  42.                 //Start DekaronServer.exe . ?9 @1 L6 I( I% q( p) Q# Q4 A) ~
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx; n8 H% d% R9 F* C9 l
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)5 C/ `3 V( p1 k. M
  45.                         szCmdline,        // Command line
    % S1 G! ~; b# M% w3 F* m& ^
  46.                         NULL,           // Process handle not inheritable4 p  B' z5 z' n, W  W  R* {- P* ~
  47.                         NULL,           // Thread handle not inheritable8 S$ T' i& @! _. `; w8 s
  48.                         FALSE,          // Set handle inheritance to FALSE/ [. w) ]; V- M2 h
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    ' s* B" n0 t, k* @- r" n
  50.                         NULL,           // Use parent's environment block
      @3 j9 _7 R! l  a3 ^. o; W
  51.                         NULL,           // Use parent's starting directory 5 X* g& r0 R  a
  52.                         &si,            // Pointer to STARTUPINFO structure
    * b+ x) M7 l% N
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure5 L! H: {. X$ K) h! {' ?5 q6 B
  54.                 ) 9 u0 P6 r6 c( |  ], r8 u* z. c
  55.                 {- h0 q& h) A! n0 f/ L+ g6 q
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );1 O" x! D4 V$ a' \1 A% ^
  57.                         return 0;0 O' t0 f' ?. k( {! V! {
  58.                 }
    + |% a6 T9 u/ f6 G* {/ [" ?
  59.                 //Creating Process was sucessful3 P  J5 A+ u/ }4 Z+ V5 t8 l
  60.                 else6 w$ G* X! y9 q4 H' q
  61.                 {& _, N# a' w" b) F# \2 [/ C
  62.                         printf("Sucessfully launched DekaronServer.exe\n");6 S6 D. L7 J( H0 g
  63. 0 k- P2 I0 X% j0 n- I. K" N
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure; a4 F( U; z4 X5 F+ P: k0 o" }8 t
  65.                         dbge.dwProcessId = pi.dwProcessId;1 l; ?; V9 ~( U7 }; u( c" f4 h, t; e, Y
  66.                         dbge.dwProcessId = pi.dwThreadId;4 @  s$ J( K! J. p) ]  |

  67. 4 `: ~* X. ~0 ~, N! U2 j
  68.                         while(true) //infinite loop ("Debugger")( N+ {! J' ?) U  H0 v- X2 y
  69.                         {0 U" X1 z9 W# c3 Z
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx9 l8 Q0 j. A5 }7 f  F5 Q' a

  71. 6 ~2 y9 E( G! m0 Q5 v4 d4 q4 I
  72.                                 /** V4 b; u+ z2 ~
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
- {( W. H2 t# n1 ?6 G% N

9 ?% g9 s4 Z: h$ T/ e) @; [/ S8 b3 F0 R$ s- S. @
商业服务端 登录器 网站 出售

9

主题

232

回帖

911

积分

高级会员

积分
911
金钱
543
贡献
122
注册时间
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

主题

189

回帖

298

积分

注册会员

积分
298
金钱
106
贡献
3
注册时间
2024-5-14
发表于 2024-5-14 15:56:57 | 显示全部楼层
学习学习赞赞赞

9

主题

232

回帖

911

积分

高级会员

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

3

主题

86

回帖

1258

积分

金牌会员

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

本版积分规则

Archiver|手机版|小黑屋|EGameol

GMT+8, 2025-4-19 23:50 , Processed in 0.044243 second(s), 26 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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