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

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

[复制链接]

160

主题

385

回帖

7408

积分

管理员

积分
7408
金钱
2123
贡献
4740
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
  B7 ~) S' Y# j& N% @5 U7 K0 N) o+ s& o$ n6 H1 U
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
" @, f. h5 M/ ?8 ]$ _
9 Q7 s5 o8 ?' O! _' r4 A: `
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    ) ?% Y. ~  t3 q5 P) m* r& V+ N+ p
  2. //4 a$ t, T- G/ K9 f% u
  3. - H( W: S; U0 n, m- m
  4. #include "stdafx.h"  g) T8 Z0 P% l* L8 G0 M( ~
  5. #include <iostream>
    $ S. L! K- s% s% Y# a
  6. #include <Windows.h>
      F* w5 Q& g' B  z# |  d
  7. #include <io.h>9 F2 j' P; b5 |# X; k- w

  8. 3 P! t& h( Q% I9 H4 ~! j$ V

  9. - s! Z$ G; D5 r% P7 R7 ~
  10. int _tmain(int argc, _TCHAR* argv[])! E3 v0 p  e3 b! n4 l
  11. {6 A( q" v1 P7 k) e' l
  12.         printf("Dekaron-Server Launcher by Toasty\n");/ ~' x* w! Y% h* h- I# M/ @, f5 I
  13. 0 \6 ~+ D" C) s4 p4 A0 f
  14.         //查看文件“DekaronServer.exe”是否存在. }. T" Y2 c4 N+ }5 ~; i# W3 [0 I' a
  15.         if(_access("DekaronServer.exe", 0) == -1)+ [7 f* i2 H, o. ?6 U; W* \
  16.         {
    . ~# ^( ^+ s4 s( B
  17.                 printf("DekaronServer.exe not found!\n");
    4 V6 D: F; M/ A4 ~: ~% w
  18.                 printf("Program will close in 5seconds\n");
    % k2 x# }7 D1 `6 y
  19.                 Sleep(5000);& `/ {0 e; m7 _
  20.         }
    0 @% r% j/ C0 q* W9 d
  21.         else6 H1 _" S  W2 c' T( }( H. N% ^1 T
  22.         {; X( e( k- O4 I: H1 ?6 v
  23.                 4 i8 R3 O* w1 E: Q
  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
    8 _1 `9 J7 W. l* v8 Z
  25.                 STARTUPINFO si;# T& |) K" X! O: I, I( z

  26. 9 H, K& o( z0 ]( l( G( t% g* x6 T
  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 ~$ L# F7 }9 y2 ^" _" {
  28.                 PROCESS_INFORMATION pi;
    8 S9 }$ N& _1 `* @% Q

  29. % }: n# R: \0 `6 J# O
  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).aspx1 Y, `. `, ^& x2 n
  31.                 DEBUG_EVENT dbge;
    4 A& E0 `8 u9 o

  32. . D& K  B6 _* A1 I! V2 t6 H
  33.                 //Commandline that will used at CreateProcess! p6 L/ r" }+ ?* a7 ]8 l, r
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    % a! D0 N0 Y$ m4 n1 r, e6 ~
  35. 3 M' D) w4 n8 X: o
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)! Z* T0 |- J- n1 I
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    3 n2 `: p! M! |" M/ q
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
      o: _" F7 G1 y$ i
  39. * c8 z7 @- \3 c  j% e  }! D1 l  X
  40. ; S% s  ^4 ~8 C( E0 r) v2 X
  41. . J1 A+ o/ D" D" b% a
  42.                 //Start DekaronServer.exe % G% f- w% b; ]# \- x3 C
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx, Y! e7 O# N7 V" b1 ?: c  W+ d
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    ) [& _9 m9 a/ }: F( y' ^! C
  45.                         szCmdline,        // Command line
    . s$ I+ D5 j( g/ S1 S
  46.                         NULL,           // Process handle not inheritable$ j; g8 c. r! e! N' m
  47.                         NULL,           // Thread handle not inheritable
      ~/ `/ L; P0 C2 K& |
  48.                         FALSE,          // Set handle inheritance to FALSE" R5 s, D3 H9 X# S6 B* k5 k
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    : S1 [; b6 U! }" M+ a( `
  50.                         NULL,           // Use parent's environment block
    1 [  Y  K) L8 L# r
  51.                         NULL,           // Use parent's starting directory 5 h/ m1 T1 L/ I
  52.                         &si,            // Pointer to STARTUPINFO structure
    9 ?# ^# t' d% w. u9 Q+ X3 f
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    5 O0 Q' L2 S7 n3 O% `; J
  54.                 )
    $ e2 k% E# |8 A$ k# ?5 h/ N# s0 q9 b& @6 z
  55.                 {
    + F3 u+ y; T1 K
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    4 u( U  @7 `0 M+ i% g; T
  57.                         return 0;
    # `: N" J, q  B& l9 m# t9 a
  58.                 }6 p% V, F  t( k$ e# m7 W, k$ B, s! S3 @
  59.                 //Creating Process was sucessful
    3 c+ j- q2 [1 {( c
  60.                 else
    ; k4 `1 {% @! A' U) v, S* e% L
  61.                 {
    " I5 N  L! @8 C7 Q! x
  62.                         printf("Sucessfully launched DekaronServer.exe\n");2 ]$ h: v, w! T5 i0 ~4 I& c
  63. 5 n; T- s2 K6 N9 X0 Q
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    . A. ]3 d9 m- W
  65.                         dbge.dwProcessId = pi.dwProcessId;  L3 C) p5 ~7 w8 _/ L
  66.                         dbge.dwProcessId = pi.dwThreadId;' F) `/ G$ F) Z" G6 ^  Z
  67. 6 H" ^5 d! ]4 x- v, h
  68.                         while(true) //infinite loop ("Debugger")
    0 l  o" D" i3 w8 I. p
  69.                         {
    4 c& A# y) _- c) s! T' z2 a
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    7 _3 f4 B& a% ?
  71. " E; A( g3 W2 A0 i' |. [; V
  72.                                 /*6 |, [/ m9 }1 W
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

0 n" Q8 P+ ^" Z. v  n( d
1 C0 n& Y3 ]% N5 c7 T" }) s. c3 M( x; P! ~5 v
商业服务端 登录器 网站 出售

15

主题

259

回帖

1275

积分

金牌会员

积分
1275
金钱
920
贡献
76
注册时间
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

主题

259

回帖

1275

积分

金牌会员

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

3

主题

102

回帖

7817

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-27 11:31 , Processed in 0.036226 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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