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

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

[复制链接]

156

主题

353

回帖

6350

积分

管理员

积分
6350
金钱
1891
贡献
3950
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) / y9 v! W) S: D: m
0 @" u8 y8 d7 i/ j1 f$ c/ b
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。& S1 X. q3 Q# X" I/ _8 G
' Z0 W1 f( F  j- q. w" H1 V
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    ( T0 Q5 G* T5 {) G* s& I! Q$ {
  2. //
    ' E" [0 T' r4 _& R
  3. 3 S8 U' f0 g- l- ^
  4. #include "stdafx.h"
    . J4 S# X9 v7 c% U( k
  5. #include <iostream>* w9 e- T8 P6 b. V/ r
  6. #include <Windows.h>
    5 ?& L! R. e. V( s) l: J/ m
  7. #include <io.h>
    3 p5 D% k5 ~& ?0 ?2 y! Y

  8. * y  @* P( d9 b7 f; D* M

  9. 7 u; F* j. O! Q0 w3 M* P* P/ k
  10. int _tmain(int argc, _TCHAR* argv[])& Z0 A# E0 ^1 z4 x5 Z
  11. {/ `* o8 z) \) z# B6 D& h
  12.         printf("Dekaron-Server Launcher by Toasty\n");4 d7 |, n4 V1 v, l* Y+ d9 _
  13. 8 E3 }2 X' k& W0 T5 J* H( \: x
  14.         //查看文件“DekaronServer.exe”是否存在) Q5 o& q, U. h6 Z9 w2 e
  15.         if(_access("DekaronServer.exe", 0) == -1)2 t9 f# e/ S* c6 f6 F- V  r
  16.         {
    * L: [+ N6 E2 t/ c+ J+ Q
  17.                 printf("DekaronServer.exe not found!\n");' i- J  @/ j/ r% j$ L4 B9 B
  18.                 printf("Program will close in 5seconds\n");
    2 i) ?4 E/ L9 c
  19.                 Sleep(5000);. K& x1 G- @  [3 w! E( f( @
  20.         }) o7 D) ~* T/ A! @6 B2 b
  21.         else
    9 \% E/ b2 {1 ^$ R& `
  22.         {' P5 m. e; C' V0 K7 O) h9 P$ p+ Y
  23.                
    # b4 `3 a2 R: a7 M/ B6 I2 z+ i
  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
    ( n2 R, y6 m; r* K, H* P
  25.                 STARTUPINFO si;
    0 O# |  z7 W& H6 ~
  26. 1 O7 D% n& g- d9 h3 X
  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
    , [; k  X; I4 H; s! X
  28.                 PROCESS_INFORMATION pi;
    " k: t6 r0 S, V; I
  29. . n, `6 n3 t- [0 B
  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).aspx6 b% Z- |/ ~3 S1 @4 y* I! @: w! i
  31.                 DEBUG_EVENT dbge;9 {0 d8 z4 Q. i% Z3 q7 W

  32.   p7 s$ j' V! X6 A) ]& E9 z' j3 V$ ^
  33.                 //Commandline that will used at CreateProcess- N8 k6 u0 _) [2 H3 B# {
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));& y& q4 u) `( ]" F' R

  35.   Y% O* H  k/ H- P
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    ( {4 p! B9 z, U. G$ S' P+ `; A
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    ; a7 ~! `, N! z( R- {2 V
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made), P' P% {7 y* t6 P( k
  39. . S3 P, n+ i' R4 M5 b% g8 V$ t

  40. 7 J, y( u: P# x2 p

  41. 7 {5 j! N2 Q6 ?( B6 t
  42.                 //Start DekaronServer.exe / T: B* A& w% F* ]
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    ! n2 B0 N! W2 N4 y  W5 m$ @
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)' O5 C3 i' v4 Q7 M
  45.                         szCmdline,        // Command line
    . Z: \% o4 b% Z6 ?; ]5 H
  46.                         NULL,           // Process handle not inheritable
    " [& ~: b5 g8 i# s7 y, L% R4 N$ ]6 C
  47.                         NULL,           // Thread handle not inheritable
    " l/ G- k/ m2 L% d, J2 ]
  48.                         FALSE,          // Set handle inheritance to FALSE2 n) D8 Q  A5 ^- X
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    ; f9 E0 v% X. ~+ t
  50.                         NULL,           // Use parent's environment block6 C) f0 t( R3 y9 e
  51.                         NULL,           // Use parent's starting directory
    2 D. M% g( c6 h# i
  52.                         &si,            // Pointer to STARTUPINFO structure' x' z0 n! p5 c
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    - j& s/ B+ `% L. c3 d
  54.                 ) 1 s! \! |' d+ I- J  F2 @
  55.                 {( @4 l# g' V# }: K
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    8 {7 T5 ]9 a9 g/ o2 I
  57.                         return 0;' s) @7 O' i: t1 {: S$ J
  58.                 }! ~7 E! [+ ?2 }2 o6 e
  59.                 //Creating Process was sucessful
    , A5 ]0 t( ]/ L4 X* M! d& h
  60.                 else
    5 T6 Z/ s) H5 h' X; ~  _
  61.                 {
    4 [6 a( e# M, g
  62.                         printf("Sucessfully launched DekaronServer.exe\n");' \8 ?! z2 F5 `! Y
  63. $ g, r7 [9 D; z) B* R) u7 p' S. f
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    ) t/ L0 \; C% r% E& y2 b# R
  65.                         dbge.dwProcessId = pi.dwProcessId;
    . A4 B* l0 w  b1 R& s2 u
  66.                         dbge.dwProcessId = pi.dwThreadId;4 |) |5 o7 w3 U1 F

  67. 5 ]. ]" Q3 p) q8 n' C
  68.                         while(true) //infinite loop ("Debugger")9 M( n( J! N/ ^8 a' @
  69.                         {1 X# P, }2 n  c% x4 \
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx% z& ?+ A3 y/ x
  71. $ r( f1 h/ f1 ^) k
  72.                                 /*
    8 @! o' ^5 Z& X0 p+ W' G
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

# f- W% G8 ~. z0 q' k3 j  z: `* r3 j( x2 [; M8 G

3 ?" {7 S2 ]0 f
商业服务端 登录器 网站 出售

15

主题

256

回帖

1231

积分

金牌会员

积分
1231
金钱
849
贡献
106
注册时间
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 | 显示全部楼层
学习学习赞赞赞

15

主题

256

回帖

1231

积分

金牌会员

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

3

主题

102

回帖

6029

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-20 00:32 , Processed in 0.081138 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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