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

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

[复制链接]

151

主题

322

回帖

5559

积分

管理员

积分
5559
金钱
1760
贡献
3326
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
) }% @$ Q6 B  `  A
+ h/ L0 x) g3 E/ o3 _- x虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。5 @5 h& z/ F5 J+ w5 V6 B
1 o: m+ Z  M) C& [" E/ U
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    8 F7 y& K; n! p: B3 l; `+ g
  2. //
    " b' Q- l; F5 B+ F
  3. ! w8 S: Q* _5 n9 a( D  D0 k
  4. #include "stdafx.h"
    4 W1 ^+ G2 P! N/ d' ~' u, Q* h( C+ {
  5. #include <iostream>
    ' E7 M1 H' G; g1 G
  6. #include <Windows.h>) ?" g9 C. j* u. F. U' [
  7. #include <io.h>
    # ^, C2 L+ z  ?, ~4 J: B9 [, u

  8. ' F% s: g% x2 I  i7 o7 n5 G

  9. ! Q( g+ N# f6 \) Z6 Z$ R- _
  10. int _tmain(int argc, _TCHAR* argv[])3 J9 A  y% V+ w' e. n
  11. {
    3 y# Y+ O9 y% {% z9 @, G" a
  12.         printf("Dekaron-Server Launcher by Toasty\n");, {7 ]4 l3 I9 m% a% z/ s$ H; Q9 y
  13.   H9 s" {; ?" e4 j
  14.         //查看文件“DekaronServer.exe”是否存在! u4 n# L3 X0 M; p
  15.         if(_access("DekaronServer.exe", 0) == -1)
    , o: S4 g; C7 G' e! M; c- G% y
  16.         {
    ) h% ^# w4 ?7 f8 X0 {; N; y
  17.                 printf("DekaronServer.exe not found!\n");
    : y7 n) J' N( J- k' [
  18.                 printf("Program will close in 5seconds\n");/ [; O+ v" J( `/ g1 P& ~
  19.                 Sleep(5000);7 n, U2 u+ c7 u8 C8 g$ L$ F
  20.         }* d% Y6 P$ n) e! H) B
  21.         else
    7 K4 [1 S' k6 K& f; s- a
  22.         {
    $ d" R% s2 t5 k7 q0 H
  23.                
    9 ~. a+ L9 x7 T: s7 s0 O
  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).aspx6 `$ z3 k: \% F( w
  25.                 STARTUPINFO si;0 I$ b( Y. e! m

  26. . e. |$ P8 n3 |
  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
    7 ]4 l& @1 y) N- J
  28.                 PROCESS_INFORMATION pi;
    & z$ g' u+ f2 U, L4 m
  29. + j2 ~' N# `% w
  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
    2 k9 f( r9 q0 A+ A
  31.                 DEBUG_EVENT dbge;
    5 `2 H5 M* T6 O3 E' \

  32. - s" ]- m  b- v& Q1 x( R2 G
  33.                 //Commandline that will used at CreateProcess$ ~. L# o$ a5 {0 h& L
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    ( E8 t/ p& `; G9 R2 E; u% F% g
  35. / _4 w- {0 t: C( r2 B& v# R
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)" b/ a& [* a2 G$ L/ E& h
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)8 a: N: e, G5 ^) \( r+ A
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)8 h+ N/ Z+ o7 d$ ?1 ?: ~- B

  39. 1 D# ^" S3 ~- }7 k" @2 P! v; Y

  40. 9 W. K7 B- T0 i" E+ F
  41. 1 m) M% P) y& s3 d; f) l3 ~! v
  42.                 //Start DekaronServer.exe
    0 F% B: ]/ ^" c
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx& d5 ^. I2 D, T  W
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)' T  k4 ^6 ~6 G, x& u
  45.                         szCmdline,        // Command line
    % d* B+ @2 ^, w4 \! H! b4 f
  46.                         NULL,           // Process handle not inheritable
    / e; k' [+ z* b1 ]! R( ]6 h
  47.                         NULL,           // Thread handle not inheritable  S' R- Z5 D) K. x/ @5 w9 A
  48.                         FALSE,          // Set handle inheritance to FALSE; y- ]! ^5 T$ L
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx3 ?  S& r" X2 U- V7 k" |1 h
  50.                         NULL,           // Use parent's environment block1 A- ?4 b" b" e, P! E
  51.                         NULL,           // Use parent's starting directory ; ~' {) B4 g. g9 r% b) ]
  52.                         &si,            // Pointer to STARTUPINFO structure
    % f& u: q, V" z2 n4 H) ]. I
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure0 L6 ^+ n- P: r' G  @5 w$ p; \  c
  54.                 )
    , H9 s$ I9 K! f% V, G% q
  55.                 {
    6 U: y) V  t- i
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );. L1 U: P7 F& g6 M
  57.                         return 0;
    2 b" r/ l5 \  y: }
  58.                 }
    3 F  \  U8 A# ~8 Z. a# F
  59.                 //Creating Process was sucessful
    # e# d* q; E4 T6 c/ d5 H
  60.                 else8 j4 M( ]% K! F% r( G( z( z
  61.                 {- k# S+ F9 p, ], j3 h
  62.                         printf("Sucessfully launched DekaronServer.exe\n");, W8 R; g! e3 Q

  63. & S$ m2 I. d9 @( q5 D# k% i' e
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    % i- ^7 i7 D$ F! l
  65.                         dbge.dwProcessId = pi.dwProcessId;
      S: W3 g/ p2 t% H) t+ S$ t9 ], c
  66.                         dbge.dwProcessId = pi.dwThreadId;6 A# H8 P+ U/ o3 n/ i5 `, l

  67. & G6 ?) u5 |( g2 ?
  68.                         while(true) //infinite loop ("Debugger")
    # H; A) S: _% z  y# _
  69.                         {
    % r' t/ U5 b8 C0 D
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx9 V  c! v; ~$ a8 x2 a! W' j3 \
  71. * U* q5 T' K( _* \. Z' u% ?
  72.                                 /*  o. e- C/ K! D6 R" B
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
5 |( c6 c1 ]$ i9 D
7 |/ @% H2 W$ \
; O, S+ d9 c( ]) Q' I4 T# D" D) E) P
商业服务端 登录器 网站 出售

13

主题

250

回帖

1193

积分

高级会员

积分
1193
金钱
761
贡献
164
注册时间
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

主题

250

回帖

1193

积分

高级会员

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

3

主题

97

回帖

4631

积分

金牌会员

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-10-31 01:53 , Processed in 0.068428 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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