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

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

[复制链接]

156

主题

352

回帖

6247

积分

管理员

积分
6247
金钱
1884
贡献
3855
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) * ?7 H: _0 F4 A1 c# t7 W
1 Y1 z4 B9 a1 }3 y* F; |
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
& ]6 v" D8 M% S1 _) M" b" A9 h6 m1 G) ]( d) ^+ x
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。5 M7 A; W* o6 }
  2. /// |# o# s% y( `, D; d# {2 L! n
  3. & e! `9 a7 l! u& D$ a! U+ h0 K2 P; i
  4. #include "stdafx.h"
    * |: B! V7 U7 n! `- Z. ?
  5. #include <iostream>
    4 z0 i" {# |4 I( N# e2 w
  6. #include <Windows.h>) \5 w$ ~) v; D) Y* i( N& k( t5 V
  7. #include <io.h>' `) U4 Z( t; P
  8. 3 T; s' n4 g% j# A! h4 y

  9. / B2 \, z9 H& Z/ F% ~! e
  10. int _tmain(int argc, _TCHAR* argv[])
    5 }- ~9 z7 _, k7 \7 M4 l
  11. {6 Q6 L7 n' ~1 c
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    ) {# e4 t! K' A, ~) O' f- z& |' [
  13. , S7 D2 H6 L, g: {1 ]' f
  14.         //查看文件“DekaronServer.exe”是否存在
    3 t. r% Y" B% I7 u9 u0 ?
  15.         if(_access("DekaronServer.exe", 0) == -1); h4 T( m  B! n" a9 a) N
  16.         {% F/ k9 y( @( \* M+ l+ H
  17.                 printf("DekaronServer.exe not found!\n");, L1 f( P9 j8 A* `5 J- c( z: e
  18.                 printf("Program will close in 5seconds\n");: J2 b' J& N' P9 q9 k, a- p
  19.                 Sleep(5000);6 m) B! w4 _* y' \3 {
  20.         }1 ~, U1 M1 J" L1 h3 @
  21.         else
    : ]9 ~* D" @% F  S: U& n
  22.         {
    ! p/ r# B9 \. a3 p$ n9 ?, S
  23.                 6 ]5 W  w( u( d2 {1 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).aspx9 K' [" r+ w. Z- B
  25.                 STARTUPINFO si;. `* @# H0 A% m
  26. 4 k; A* s1 a. {6 _, R$ T8 ^- E
  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
    8 y" n* k. M9 R- M: N
  28.                 PROCESS_INFORMATION pi;; q+ h" r3 X  C# X

  29. 8 N, {. x! [- L. t9 J) [8 ?/ V
  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$ G$ F. [; G6 D/ R/ a- P
  31.                 DEBUG_EVENT dbge;
    ; m( H  H/ R1 A
  32. " K0 Y& g$ C+ l& @, H/ [3 l* b0 O$ }
  33.                 //Commandline that will used at CreateProcess' }/ h- X+ e" \9 q
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));6 f. ~! T4 K  `: F/ V: u" C
  35. : V% S8 X1 i8 h# a/ ~9 J
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    7 u) A& l; ]  K6 k
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    + C3 M7 e: w' A  y, \; z4 \7 Q: n
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    6 M% I3 g( [# d5 a" q- T0 s
  39. ! X5 n# ~/ j) r. T# n* Q' c. ^) y5 `
  40. 4 M9 g2 s+ N- g8 V) C; Y4 R& o
  41. * I( g  ?8 D; H, ^) x" n
  42.                 //Start DekaronServer.exe
    9 |+ I' s" C3 D5 A$ S) Y
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx. e( c* h6 d. D; S
  44.                 if( !CreateProcess( NULL,   // No module name (use command line); W. O/ f( e8 J$ e# r5 D( r) v- e
  45.                         szCmdline,        // Command line$ P7 {3 [; R% X# }( ^
  46.                         NULL,           // Process handle not inheritable
    & Z% I* v0 O+ _. D4 _
  47.                         NULL,           // Thread handle not inheritable
    + H( b+ ]  S- Y) J- h
  48.                         FALSE,          // Set handle inheritance to FALSE2 B, ]4 ^1 ]$ I* n( \
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    - Q3 i! B$ C( Y, o  T1 J
  50.                         NULL,           // Use parent's environment block
    ( F2 v" `. V% g# g/ z" u2 y% x' r  E
  51.                         NULL,           // Use parent's starting directory + }; ~3 r# w* e& C. }% f
  52.                         &si,            // Pointer to STARTUPINFO structure
    ' X# @' p4 u  r7 H$ a! }- l, J
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure5 _* V0 }$ s* h8 d6 b
  54.                 )
    4 U) V. I2 J6 I2 w0 Y$ _: z1 ]
  55.                 {3 h  S3 x: Y$ T4 G" R2 t2 c  U
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
      p* t2 x# }( u
  57.                         return 0;
    6 a3 l: @( m* b/ }4 c2 ?% n
  58.                 }! W! o- {3 ~: u4 W
  59.                 //Creating Process was sucessful5 |: K& E# {5 s! m( c1 O2 n
  60.                 else2 O8 @; G2 ~; L7 N8 @+ J8 R% |' G2 ^
  61.                 {% `) Y0 ?: }% S) i5 F, s
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    ! ?2 w0 c8 t  ]- L4 s

  63. 7 F3 |) n2 Z; e9 O
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    * Y2 x, F* q* l4 D% h0 {) S2 N
  65.                         dbge.dwProcessId = pi.dwProcessId;
    ' M2 F' D5 t( E6 C6 f8 w
  66.                         dbge.dwProcessId = pi.dwThreadId;
    # }+ ?7 q  t4 h2 z* n: ^
  67. % m3 C" e. T) X+ K& Y* K
  68.                         while(true) //infinite loop ("Debugger")( p$ g4 Y! h8 |' O/ k. Z
  69.                         {
    " t' {! x5 x: x1 ]2 ?
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    ! ~& S+ b  J  }0 U

  71. 0 R: T6 U/ v. [9 s3 L
  72.                                 /*( o5 X% ?. O$ E2 i5 _0 B5 h
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
/ j- J: U  M" e* \2 s% f

- T: V7 O/ o( l, a3 P" }( g) V3 ~4 o0 O+ ]+ T& o* `
商业服务端 登录器 网站 出售

13

主题

252

回帖

1258

积分

金牌会员

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

13

主题

252

回帖

1258

积分

金牌会员

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

3

主题

102

回帖

5943

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-14 14:06 , Processed in 0.087730 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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