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

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

[复制链接]

157

主题

365

回帖

6968

积分

管理员

积分
6968
金钱
1989
贡献
4457
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) & F: N+ s) D! A) ?, u  e2 N1 X2 L

: U" K3 W% n! ]6 Q. C虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
* Y! D/ z) z; p* v. H% o8 b0 V% d6 ?  Z* [" f
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    ( K& J8 ~9 d8 y) T2 b
  2. //
    ) q+ p$ A3 t. {# c# `& v
  3. $ n1 |, M7 A5 R
  4. #include "stdafx.h"
    ; {2 n! D) g; @! h! o
  5. #include <iostream>
    2 u9 j4 ]0 @3 Z( J* U# Y  F
  6. #include <Windows.h>
    8 S$ h# B5 v. I& x
  7. #include <io.h>
    - E( D+ @# N/ x2 r2 s3 p

  8. + ]" k( q% \) l, U5 q

  9. * N4 h# q/ o4 X' {5 J( N
  10. int _tmain(int argc, _TCHAR* argv[])0 W+ {9 C* q( w3 _$ w
  11. {/ Z: G+ a& j& ^
  12.         printf("Dekaron-Server Launcher by Toasty\n");0 N/ P0 k' R- ?% s/ E

  13. 0 Q* H8 ^9 a2 a& {5 A' ?
  14.         //查看文件“DekaronServer.exe”是否存在
    5 ]" H8 k# l/ u3 y! I8 l' A3 p' M
  15.         if(_access("DekaronServer.exe", 0) == -1)7 Y/ W4 q( N" R% W4 S
  16.         {$ X: g& ^* k& R; F
  17.                 printf("DekaronServer.exe not found!\n");
    , U* Y7 [0 H% t# J) F3 b0 z! k
  18.                 printf("Program will close in 5seconds\n");8 a4 `! n1 l( a! G
  19.                 Sleep(5000);
    - Q$ E3 w8 Q4 G) g5 N, T& }
  20.         }
    # Z. ~2 Y) @3 U- w0 S, E
  21.         else) s- T" y1 \8 U' S
  22.         {
    . i( s* e0 f8 B! `3 j4 x7 N
  23.                 ' I* Q+ V  r, b/ w$ Y/ m7 @
  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. q" x* {+ ^! a/ m% s
  25.                 STARTUPINFO si;
    1 P, h. ]! A: Y/ U

  26. * K% e; \0 U# {+ x0 l( O
  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# f# L" e0 ^+ w
  28.                 PROCESS_INFORMATION pi;
    4 F+ C( a1 P1 H8 ]+ t, }2 J7 X
  29. : G1 `6 E! k  }& I
  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
    ; r5 e7 J- ^1 A5 a5 d
  31.                 DEBUG_EVENT dbge;
    # A. S" Z/ W0 {+ {+ T
  32. % r" X' ^( X1 g' F- O7 C
  33.                 //Commandline that will used at CreateProcess) T! s7 t5 N3 J' F6 l3 G3 R
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    : G' f% b- @6 {; I
  35. 3 ~) _# \- u& o- _5 y: M: Y" B" ?
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    " u* Z; X3 T6 d/ l5 o) N
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    8 ?" }) n0 R- }, i) I& I+ [
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)6 c; c6 C7 U# l1 z! |
  39. $ n$ u/ p) @* e, u4 o/ Z% P( `" e

  40.   P1 H2 l# i+ j
  41. 1 X+ J3 B0 V% A7 K/ q* p, N
  42.                 //Start DekaronServer.exe
    % F) X% R/ D! e) Q( }* ?
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
      M; o/ p+ p9 B" n
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    ( j% q5 ]0 ?# O; h  ?0 V' R
  45.                         szCmdline,        // Command line
    ' U$ M7 Y+ Y' R3 y; r0 r: h$ Y
  46.                         NULL,           // Process handle not inheritable
    8 @: m9 a; t" P, b$ C- J" c+ \, ~) g
  47.                         NULL,           // Thread handle not inheritable& p9 `% U7 E4 {" ~; @% O
  48.                         FALSE,          // Set handle inheritance to FALSE6 Q! s# B9 A5 d# u5 n% q
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    + ]* Y4 q- v+ X, z3 y3 `
  50.                         NULL,           // Use parent's environment block1 I/ T* n; U6 r0 w: d& f
  51.                         NULL,           // Use parent's starting directory % M5 j+ |) w6 C2 f
  52.                         &si,            // Pointer to STARTUPINFO structure
    & C! R. j! q, X2 [
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    $ x+ a$ U0 W" |# c) h
  54.                 ) ) V% m1 S8 A3 A. K  Z* y0 C0 Y; N
  55.                 {" v* L& }' p* |4 [* j5 J
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    " h  `/ Z( `/ A2 s
  57.                         return 0;
    % `9 K, h) W' C' l* Z. H
  58.                 }/ @; L0 j3 m* R, D7 V9 s$ V( g6 Q
  59.                 //Creating Process was sucessful2 h" d8 B4 E; A( d
  60.                 else: z' B+ p4 V& q  Q- P! t! `
  61.                 {, X6 r, J9 E8 c* K3 G" X
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    ) ^% y; ^8 p" z* Y! c, o

  63. ; ~7 Z0 S& c7 }
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure- Y, x& L& [* J* w
  65.                         dbge.dwProcessId = pi.dwProcessId;% \8 Q, B3 u% l; Q+ o, D$ @) ~
  66.                         dbge.dwProcessId = pi.dwThreadId;
    ' U% ~6 `/ v/ I

  67. ( D9 p; T+ h0 L8 v" G
  68.                         while(true) //infinite loop ("Debugger")% Z4 A: K$ p0 X% u5 @
  69.                         {
    : a# Q7 D' A  P% Z0 j- N3 |' c9 r
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    ' Y9 s3 R( j4 p0 r; Q9 ]! L

  71. 9 o; E8 ^6 Y! O, W' e; E5 W/ e
  72.                                 /*
    0 p4 [7 d9 e. O- m/ u3 [  w! l5 z
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
; L( X) P# Q9 J
  S! }: o& U( ~6 O# K* A

& R* P; x# ~3 j% w; @
商业服务端 登录器 网站 出售

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

回帖

6957

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-3-15 07:53 , Processed in 0.032734 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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