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

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

[复制链接]

157

主题

364

回帖

6952

积分

管理员

积分
6952
金钱
1984
贡献
4447
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
, \3 z2 O( m4 |6 U6 ]
  t8 R6 S5 Q. d) v; E5 G- C虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。$ a' p! ~9 [: T
, N0 `  ]* s2 Y: K
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    - b2 i7 R; i' n3 U5 B1 o
  2. //7 Q, g, k' m7 S5 a7 i9 f
  3. 0 l8 u2 V4 n$ m
  4. #include "stdafx.h"
    0 V2 y" a4 t$ `" D' c
  5. #include <iostream>' j0 G  X8 E- C
  6. #include <Windows.h>2 E% H6 A$ b8 O' l% ~
  7. #include <io.h>
    & K- H8 [  v# c. n5 p

  8. " j* c, p6 S- ^# a1 x0 r: a; P; \+ z$ X

  9. & H9 ]5 s5 v: ~! }* p
  10. int _tmain(int argc, _TCHAR* argv[])
    0 H0 o  y! _# N# y: ^, Y
  11. {; }# O, M7 @: s6 {- P/ _
  12.         printf("Dekaron-Server Launcher by Toasty\n");; @' J; r7 W# M$ ]/ e  N+ @: d

  13. : a' S9 s! ^4 L
  14.         //查看文件“DekaronServer.exe”是否存在2 X$ i$ Z4 `  A* X1 ~) t" S
  15.         if(_access("DekaronServer.exe", 0) == -1)# S9 H; w3 H: y& L- C3 O
  16.         {6 J6 W/ j! s, X' A0 \' Z! w
  17.                 printf("DekaronServer.exe not found!\n");" F  g' B, `1 a, u3 s" o* J5 I# m
  18.                 printf("Program will close in 5seconds\n");9 I+ Z/ P6 j' g" }/ B  @% `
  19.                 Sleep(5000);
    & i' c" n  c# N1 J$ f
  20.         }& N- P& G5 Z6 @% a# d4 h0 _
  21.         else
    9 h8 N: y; [3 l- Z  s  O) m: i
  22.         {9 f: h5 [% I- H6 F7 g& D1 c/ r
  23.                
    $ _- X0 y2 x, o0 U0 B
  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& y: H; u8 j& ?+ [( C
  25.                 STARTUPINFO si;
    0 W. o7 `$ j) E  D5 B9 n6 ?/ c

  26. 1 I, b( t" d4 s# P
  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* e/ h# g0 h  Q  `
  28.                 PROCESS_INFORMATION pi;2 K# _8 w# U) `+ M" _% T8 ]
  29. 0 e: P( I7 U# _) o9 N5 R5 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).aspx) u! ^9 q: `: D1 a  ]; Z
  31.                 DEBUG_EVENT dbge;: W$ N/ ^9 z0 l& C
  32. ! q$ d) z  K- e" ~$ j- h
  33.                 //Commandline that will used at CreateProcess
    2 J: Y6 s! q% N2 P) I2 q+ A
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    ! i# s  x/ d8 B9 R- U- ^

  35. 7 p1 z" [0 q! G3 u6 Q4 M9 b. U
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    , |8 q. m9 [3 M6 v0 j- }
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    2 D& H! Q- U. N. ?! v' M4 S1 d
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    " C  W5 r8 p2 c7 `

  39. 0 p4 d- e4 B5 K8 ^4 U2 _

  40. 1 {7 ?! i: J# A+ f( y$ t
  41. 1 q8 V8 M) t; t% S& x( K
  42.                 //Start DekaronServer.exe
    ' e; s& D: V. N2 D3 Z( K, @5 {
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx5 @$ G* _: W1 N" G0 ^4 t
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    * w* v1 W9 h" T8 n" e
  45.                         szCmdline,        // Command line
    6 d( K" q3 c4 d1 p- M( k1 [  p7 D
  46.                         NULL,           // Process handle not inheritable; R7 O* F. j& f4 i  u
  47.                         NULL,           // Thread handle not inheritable  i5 a( e) i' t, u( J$ H8 Y) l, z
  48.                         FALSE,          // Set handle inheritance to FALSE
    ; l2 p( g6 g' B
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx/ d9 o7 O; h% l3 t. @& G
  50.                         NULL,           // Use parent's environment block
    + N9 R9 D8 p# B9 F* y/ i" y6 X& x
  51.                         NULL,           // Use parent's starting directory ' s$ @: b% V2 |8 j  ^5 d; [- s- ?1 U1 A
  52.                         &si,            // Pointer to STARTUPINFO structure/ ~- s2 y) i2 b% O; J0 p
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    1 X4 d1 M' E) e, |# S
  54.                 ) ' v9 l! R+ N: Q# z: c; c, ^: U; K
  55.                 {; W6 t/ c. r# |+ r
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );: ?# Q/ I5 c  X5 Q, P3 M: t
  57.                         return 0;
    # E8 e: g# ?2 {3 u
  58.                 }
    7 U& ~/ C' d  A
  59.                 //Creating Process was sucessful% ~1 [/ ]5 D1 {) B, J5 `3 S/ d
  60.                 else: X7 k# ^3 _3 H3 Q. U
  61.                 {$ X9 |$ A2 P- [
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    8 x! U& t! B- x7 s" z9 M

  63. * O) v7 C6 u( k$ Q) e, R
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    / ~2 w! k: x+ P" X: b
  65.                         dbge.dwProcessId = pi.dwProcessId;
    + q  {  F" f, F* B
  66.                         dbge.dwProcessId = pi.dwThreadId;- R0 g9 e4 K; R+ `0 ~; p: @

  67. - X/ X9 h$ w% J
  68.                         while(true) //infinite loop ("Debugger")  c( f2 m: Q6 I* ?* F2 Z! s: n
  69.                         {
    $ H/ {: a  g  @7 J  o$ r' D
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    : `5 {6 T" c) L* r

  71. # C5 b3 I6 \$ }; \. R3 m; y5 P; ~
  72.                                 /*
    + E) B3 A8 E. T. _3 d/ Q& Y
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

- y' i+ `9 C( n# u7 r8 a1 P0 h7 o  l* N; s( S1 v# b( G; M

3 C& Q& O' x8 F5 Q
商业服务端 登录器 网站 出售

15

主题

257

回帖

1228

积分

金牌会员

积分
1228
金钱
892
贡献
59
注册时间
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

主题

257

回帖

1228

积分

金牌会员

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

3

主题

102

回帖

6917

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-3-12 20:24 , Processed in 0.025584 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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