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

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

[复制链接]

161

主题

385

回帖

7437

积分

管理员

积分
7437
金钱
2139
贡献
4748
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
# S3 }. J5 ]" e. x2 c/ |+ ^6 G5 k1 g, l/ H5 q% c- T
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
6 U- h& S' ^# a9 t( q" v% z" X$ M
- J& v0 v, U9 S; h. E
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    % r: F9 u4 A. S3 _5 a& |
  2. //
    " C$ w6 s, S# k( g
  3. $ N6 y) g, U5 p) n+ Z! y$ Y5 v& D) z
  4. #include "stdafx.h"& W. z, b, Y# o) b3 |0 Y
  5. #include <iostream>& _+ J7 g( U% `7 R" q( r
  6. #include <Windows.h>  J+ \3 |7 F! W' ~3 S. I8 r
  7. #include <io.h>. e4 T7 Z+ s2 b& l6 W
  8.   `# @- {3 W3 x" Y

  9. 6 b. H: C2 @& C) U, j" O6 V
  10. int _tmain(int argc, _TCHAR* argv[])) G* i+ b) O+ V. }( V( ?- r
  11. {- u7 u* b+ C5 I
  12.         printf("Dekaron-Server Launcher by Toasty\n");$ v% J# J% Y) ?5 _; [
  13. 2 O* t& y$ y% f7 b5 O
  14.         //查看文件“DekaronServer.exe”是否存在, B" ?7 i4 h, D& B/ y
  15.         if(_access("DekaronServer.exe", 0) == -1)
    ; O, q9 B/ r# i7 G; M. R
  16.         {6 P4 B! X# _! W2 j3 Y2 G; R
  17.                 printf("DekaronServer.exe not found!\n");* ]$ Q. w$ l2 I5 ]$ d0 H+ \
  18.                 printf("Program will close in 5seconds\n");) r6 d- `4 t6 [9 n
  19.                 Sleep(5000);
    " k% \+ b- K. a, L/ N$ y
  20.         }* I+ {6 W, y& D7 p# s7 d# @
  21.         else8 P* t+ Y' n0 B
  22.         {* ?4 Z' R! f: x- V3 l4 }5 c$ f% c: @
  23.                
    2 m2 C' ?' X/ y8 h& l9 @: V% @
  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. ^# R! S# D  S( J6 i3 F0 ]# Q
  25.                 STARTUPINFO si;
    $ O2 `5 [$ J# p  d* B- [5 {7 r
  26. 4 w  Q! o0 }* S! h$ i* g7 U. D
  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
    * w5 q& v6 l( ]+ b6 f; D  n
  28.                 PROCESS_INFORMATION pi;+ {8 w5 g  E6 X2 k, i, H
  29. 7 h2 w) ?  Z) m4 |0 L
  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
    ' g" i. r! y$ i2 a3 h1 ?# `
  31.                 DEBUG_EVENT dbge;6 f8 f) A( _% y4 F; r$ c1 w

  32. ( p5 S0 S8 u. h# o1 H% t4 R3 v, K& P
  33.                 //Commandline that will used at CreateProcess0 x! ?5 _$ b8 }; `
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    ! n8 v( a9 z! R: _

  35. 8 V9 y! Q. Y, O( S7 M% R
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)6 e8 `8 I7 N; g, p. O/ S) p0 L
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)( ^# b! n) U; a0 U0 r5 N7 I
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    " o- R) D7 E7 L  q7 f- Q

  39.   ]& f, B3 n8 K& o+ N, g
  40. 8 @! G8 t" `8 M+ Z3 P: {8 ]6 K

  41. - A3 R& M( G; z4 d
  42.                 //Start DekaronServer.exe 4 R7 [+ a' V0 A% u; L' F
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    1 e- Y; J! e+ r
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)- r& n* i, ^; m
  45.                         szCmdline,        // Command line
    / ~7 W  J4 s4 @: ~+ S
  46.                         NULL,           // Process handle not inheritable
    % N4 s% \* {) k5 w5 E
  47.                         NULL,           // Thread handle not inheritable2 h5 K  _5 o- q
  48.                         FALSE,          // Set handle inheritance to FALSE# x; u  z+ t& t
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    1 B) Z0 Q4 Y! [1 u0 w
  50.                         NULL,           // Use parent's environment block
    ) w3 ]/ A. _! q5 Y$ m8 Q
  51.                         NULL,           // Use parent's starting directory
    % K8 [  a$ u9 J; T  j+ x( |
  52.                         &si,            // Pointer to STARTUPINFO structure
    & `& F! x( j8 d3 G* w5 c
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    6 d  o3 ]0 u% e3 C7 D1 q% @& |
  54.                 ) # J9 y' x" j( {9 ?2 b( M! [8 z
  55.                 {: @! S1 \3 V! t# n% C
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    3 s: S% w' ?  g7 w
  57.                         return 0;* A2 Q3 L6 I+ P$ d4 R
  58.                 }
    ' ]/ h# O, v* Z0 \! i' W/ ~
  59.                 //Creating Process was sucessful
    ' r$ |! l6 k/ N( [! @+ M
  60.                 else
    ( f$ D$ M% T! @- K8 x; }5 M% z
  61.                 {
    " }2 ]" a* E. h# O9 i
  62.                         printf("Sucessfully launched DekaronServer.exe\n");; {. K/ i% S5 E$ f+ F+ F7 p2 u" q
  63. + f0 N6 Z8 @/ P
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure- ?8 y, ^7 N( r! \
  65.                         dbge.dwProcessId = pi.dwProcessId;% Z* L8 H; f# P9 G, @# D
  66.                         dbge.dwProcessId = pi.dwThreadId;6 x* u. F, t% x: i# f
  67. 2 L- _7 }) A8 _+ e) f' P" @, `
  68.                         while(true) //infinite loop ("Debugger"); F1 h8 ]9 K4 u0 _  i; F
  69.                         {
    ) h& }% U. g1 r! m6 @
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx  h5 I+ G. K+ w7 R8 T

  71. 0 n' Q0 D8 M' g
  72.                                 /*( X' R& L; X( P% _( u4 t, b
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

8 \, C) T/ K; n3 M" s0 s% |5 M. K+ ]2 N$ K* q, j

$ o9 F; t& T+ l* X
商业服务端 登录器 网站 出售

15

主题

260

回帖

1295

积分

金牌会员

积分
1295
金钱
933
贡献
82
注册时间
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

回帖

355

积分

中级会员

积分
355
金钱
142
贡献
6
注册时间
2024-5-14
发表于 2024-5-14 15:56:57 | 显示全部楼层
学习学习赞赞赞

15

主题

260

回帖

1295

积分

金牌会员

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

3

主题

102

回帖

7977

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-5-4 19:47 , Processed in 0.046492 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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