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

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

[复制链接]

157

主题

361

回帖

6692

积分

管理员

积分
6692
金钱
1933
贡献
4241
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) : F' r) |0 _- O

8 ?7 r  e$ G" Q) S- F6 I8 }虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。6 {( ^7 N4 m7 c4 `- b2 a1 ^
) j) n+ S2 A2 I1 \
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。0 X5 G3 k5 D# v; L7 Z
  2. //
    . ~5 }% Z, s5 I' w) K
  3. # x5 ^- O9 E4 M4 C
  4. #include "stdafx.h": z0 n8 z3 y1 m+ H- C" a
  5. #include <iostream>
    ' H! A8 ?5 N% d- W7 q+ r2 @
  6. #include <Windows.h>7 m: l; t$ r" a- D6 O5 X
  7. #include <io.h>
    7 {) f* X$ Q/ |# V  v# e
  8. ( }0 i7 _1 I, M

  9. . W" R, a- \5 _" j( w
  10. int _tmain(int argc, _TCHAR* argv[])0 V6 e0 m! S" w4 t9 ~+ C- N
  11. {" w1 u8 `+ D0 x+ M' |/ t" V
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    9 G- [9 W7 G, p$ Y1 I+ b# V

  13. 6 [5 l; e* b, n4 e1 Z
  14.         //查看文件“DekaronServer.exe”是否存在) @% D8 }3 T# T  m
  15.         if(_access("DekaronServer.exe", 0) == -1)
    1 d- }. F/ S& N: Q4 U7 G1 X) C
  16.         {
    2 K* g+ K5 q+ J( D# k9 j
  17.                 printf("DekaronServer.exe not found!\n");
    5 U" `" l( d: w1 f9 v8 y
  18.                 printf("Program will close in 5seconds\n");
    , s2 i: Y, P* k5 P
  19.                 Sleep(5000);
    / w+ j- M8 z% n) M, N% d' p7 }
  20.         }
    ' @: ^2 H8 b9 z. S9 {2 }
  21.         else
    # V; |- u" F; }  x
  22.         {
    / i  b) c3 M( M
  23.                
    9 u, j% h% a, ^, h" f$ k
  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
    ( M) j% |; A) g' d9 |
  25.                 STARTUPINFO si;5 [; ]0 j+ x2 A+ D

  26.   F! G/ L4 V& O% w% P2 q1 X. M* N
  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
    ; p) f+ Y# V0 _- d
  28.                 PROCESS_INFORMATION pi;8 Y& E3 x9 x+ t6 K
  29. 1 ^; e6 z9 m8 A4 Q2 g
  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( Q4 h' m* l. W  U; c
  31.                 DEBUG_EVENT dbge;- u( G( ?/ e3 ~. \1 J/ _; M

  32. 8 z" [" O$ d* Q& I
  33.                 //Commandline that will used at CreateProcess! ]" o6 R3 w" O) p
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));6 k5 ^" a. q7 B( `$ D1 u3 `
  35. $ b; p7 J; L7 F* n# t  m3 U
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    ) D1 f- T" |5 \
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    ; @  i' L6 @7 R0 H: M# F
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made): r4 E' `: Q6 p0 X  Z

  39. # [3 _1 z2 C. p6 l1 k, J; I1 t
  40. " c+ d4 `9 s* t& z0 G: g! \

  41. 3 O) p6 I+ l- f' C' n" ^2 e* r
  42.                 //Start DekaronServer.exe # q7 r- p. F4 p; t9 B0 Z  u
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx* v) T1 q0 z! I- S# M
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)7 j. z6 I2 T- g4 {0 N
  45.                         szCmdline,        // Command line
    & J( a2 r9 F& X! v/ v* z" t. m# i
  46.                         NULL,           // Process handle not inheritable
    6 _' w5 `9 j; B* A/ u0 L+ \% K
  47.                         NULL,           // Thread handle not inheritable
    6 E1 n0 q6 a! n2 h( c' I) \
  48.                         FALSE,          // Set handle inheritance to FALSE; t0 T$ e1 ^. x7 v# z. O; ~
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    4 y1 S0 s/ ?& ?: t& E! ]
  50.                         NULL,           // Use parent's environment block4 @0 A/ i1 L: Z
  51.                         NULL,           // Use parent's starting directory
    6 }7 t2 z# J+ S6 M& Y2 n! S4 }
  52.                         &si,            // Pointer to STARTUPINFO structure
    $ p2 z/ h. s( e4 M; Y+ f
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure/ H; i1 F7 R1 J( f2 U2 S
  54.                 ) . `6 @% B0 y6 T
  55.                 {
    # j7 A2 v5 i, L
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );2 C8 ]! C5 j" f) I7 h
  57.                         return 0;" P5 q* @, M8 J: [+ u5 X
  58.                 }
    - w* E1 Q" o) r9 s& A* @
  59.                 //Creating Process was sucessful
    ) s; ]. Y) Z+ P8 q. {/ ?
  60.                 else
    : C. U$ H2 R+ J  Y& a
  61.                 {
    1 D7 L9 l8 v8 Y5 e( C6 `' M
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
      J+ x8 w" U7 T, C% n0 I4 z
  63. " K8 u1 I4 D; {+ G( |
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    $ e5 @7 z2 t% Q; M: V: F% \- {) S
  65.                         dbge.dwProcessId = pi.dwProcessId;
    3 b, F, Z+ h, m1 w  a
  66.                         dbge.dwProcessId = pi.dwThreadId;3 u$ X% Z9 ^/ J& e
  67. $ k. L& V0 [) u$ _. C& g( D3 ]4 X2 H
  68.                         while(true) //infinite loop ("Debugger"). A8 X2 O$ L& @0 l
  69.                         {9 b# `2 c' ?2 i* E: O9 B$ G
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx! l$ ^& u- _+ [' y$ _

  71. ( p$ ]' Q" r; q4 N) ]
  72.                                 /*- a2 M' {# b) i$ R$ E, P9 |
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

5 J* z% [9 s4 u! h0 N& I% h+ `
) Z* n( E- O- F
1 R. T4 z: O) }/ k6 K* U
商业服务端 登录器 网站 出售

15

主题

256

回帖

1259

积分

金牌会员

积分
1259
金钱
865
贡献
118
注册时间
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

主题

256

回帖

1259

积分

金牌会员

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

3

主题

102

回帖

6361

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-7 00:00 , Processed in 0.065731 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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