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

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

[复制链接]

152

主题

325

回帖

5593

积分

管理员

积分
5593
金钱
1773
贡献
3343
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) ' [7 I) E+ M1 p" d- T: o& ~

9 h* u* X, t% w/ O( j5 b2 c, s8 {- J虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
; P$ w* [% `9 {! ]
2 n6 x2 X/ s2 x& K
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。7 ~% j+ n6 w- ?3 V( z9 A9 Z
  2. //
    ' ?& F3 J6 }3 K! w# U  Q
  3. 0 b# }7 p3 n, U
  4. #include "stdafx.h"
    % s% r) E" W6 A$ ]/ k+ }- u
  5. #include <iostream>
    7 {' H% E; s# d$ J# i8 P7 j
  6. #include <Windows.h>
    " k: l) {) ~; I7 n# S. j: J" t
  7. #include <io.h>$ G6 T" l. ~2 g3 h6 p, P% S: l

  8. 8 n+ e+ o* C' ?, r8 |( y
  9.   g; F# H/ E0 E1 ^! x
  10. int _tmain(int argc, _TCHAR* argv[])3 `% d9 }/ S& c  y# r1 c- X6 _
  11. {
    + m7 v# C! {0 I! @4 q# |
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    ' L+ {6 t* A3 G$ O5 \

  13. 1 h' O9 y) j2 K6 J* N: Q! U/ P! B
  14.         //查看文件“DekaronServer.exe”是否存在
    * m9 P- w# K  N) Z, Q$ Q9 z
  15.         if(_access("DekaronServer.exe", 0) == -1)
    " B  E+ y+ ~+ h: M; l) t
  16.         {
    , G2 ?- y% N6 L. ~" p: g3 J) F
  17.                 printf("DekaronServer.exe not found!\n");  L( K8 [) _4 [% f- _2 l% h7 `
  18.                 printf("Program will close in 5seconds\n");
    ! z1 g9 j7 q0 C) e' t8 k* _" G
  19.                 Sleep(5000);
    0 ~) ]9 V- b0 ^& M) u: ~7 N. I
  20.         }
    ; ^5 y- a' V8 G, F  B
  21.         else3 r2 z) B& u3 [7 M: y- t  c  v4 ~: P
  22.         {( w: {2 d3 R6 ~
  23.                 ' |# N  a, }$ U+ Y$ N( F
  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
    . O8 @4 N/ f" d1 Y9 J
  25.                 STARTUPINFO si;
    5 `* u% O1 j6 U% Q0 `8 i6 u, m
  26. 5 w* J0 V; `6 ?' g( w* m2 N" p6 @
  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).aspx5 _' O5 G' e9 i; m/ S0 {6 M
  28.                 PROCESS_INFORMATION pi;; Y- E; ~! r, n5 Q  r4 Q0 F4 p
  29. * Q' Z6 {  M; `- Z: c
  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
    $ u2 X/ s3 W* B5 [2 i
  31.                 DEBUG_EVENT dbge;
    " h/ I1 c4 p3 |

  32. $ d4 V9 A) `, v7 J, e
  33.                 //Commandline that will used at CreateProcess$ X3 r7 }! z3 {' ^5 o
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));- z5 ]2 n( k- Y4 b

  35. : D1 W; T' n2 w1 @
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)8 ^3 N/ b  f( f4 t3 w% h
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    $ ~1 `, u9 R- Y7 m
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)- G0 L: {  A, T+ d
  39. 9 l% r8 d0 S' Y4 _7 m" t9 M
  40. - y' }/ ?! F9 ]- O+ g
  41. % j) B+ t% X/ J/ [
  42.                 //Start DekaronServer.exe
    0 e" Y9 I- k* @* z/ T
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx( A) X$ P, F" z5 h, [- Y
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    ( p9 D% I1 S) C9 \& h2 s/ v+ h
  45.                         szCmdline,        // Command line
    6 A7 }8 z8 |- Q& I0 ^% x# D  D
  46.                         NULL,           // Process handle not inheritable" H8 S5 L+ w# m  E
  47.                         NULL,           // Thread handle not inheritable
    . Z% e" u5 U' }: D  k& U
  48.                         FALSE,          // Set handle inheritance to FALSE
    0 g6 M. r: r% a9 ^" `& [
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    / R- R( ]6 N' I$ b
  50.                         NULL,           // Use parent's environment block
    " e8 j. C% Z/ o  k' L" w
  51.                         NULL,           // Use parent's starting directory ' a- `, n$ s6 D) m
  52.                         &si,            // Pointer to STARTUPINFO structure1 U. c# G- t) g2 t) E0 _/ e0 q  u$ a
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    4 A- X0 m9 r, g# P5 t8 `
  54.                 ) ! l7 S" d, E% I# D7 k- N
  55.                 {
    * L( F3 Q+ F( `- i4 j5 _1 C& ?
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    2 l2 R7 G+ c7 y% c$ e% T6 |5 E
  57.                         return 0;
    7 U. ^( r9 p0 K! s+ C  T7 W) t0 F
  58.                 }
    / g: s: \& B" {) ^
  59.                 //Creating Process was sucessful0 J( b0 S) I$ O4 S3 Y
  60.                 else* g) J$ g' `0 i" G/ @
  61.                 {; m1 e% e' s0 p- E
  62.                         printf("Sucessfully launched DekaronServer.exe\n");- G; z/ V, J4 _. M
  63. * I8 E, D; N' I( @3 K6 y
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    / q0 f8 }( e$ @* F2 g
  65.                         dbge.dwProcessId = pi.dwProcessId;9 S2 p% \5 [9 l1 `! @' v
  66.                         dbge.dwProcessId = pi.dwThreadId;% F, _: Y7 P0 z- k+ j

  67. $ J6 S7 [. Y$ C: S2 i% d# J9 u4 ?
  68.                         while(true) //infinite loop ("Debugger")( B  y, l. i% {( K6 s
  69.                         {" c9 I! X- s1 g' s
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    + e! g, e* i2 C7 B: O4 D

  71. 1 S! y& u$ f. D) M" R8 p0 w
  72.                                 /*
    9 {: y; J# I3 u/ q8 d9 x) S; f
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
; w+ }% D2 P! W( W8 [+ O# b* J
: h2 @4 L6 {) R
( R. p; ~: y' W; N; N! h
商业服务端 登录器 网站 出售

13

主题

250

回帖

1199

积分

高级会员

积分
1199
金钱
765
贡献
166
注册时间
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

回帖

1199

积分

高级会员

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

3

主题

97

回帖

4791

积分

金牌会员

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-11-8 05:45 , Processed in 0.075323 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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