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

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

[复制链接]

157

主题

364

回帖

6927

积分

管理员

积分
6927
金钱
1964
贡献
4442
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 4 B& W7 A# l: d7 \4 f
2 T- R0 @  `4 L$ M" z4 y& Y
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
; I+ w' V7 A" J5 L: I6 r! a: C2 i: H0 ~) Q1 e: ^
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。' B3 f! `# r3 t" M4 i& D: w: Z3 c
  2. //
    ( e, o0 k  l  }1 B( o

  3. 1 @$ Z$ y1 }) u* x& F8 ~8 V
  4. #include "stdafx.h"
    2 ^: W* U: o9 ^# ~
  5. #include <iostream>
    7 @- x7 |" C8 f) R- Q
  6. #include <Windows.h>
    + J8 k* u3 o) Q% S1 o, A; x
  7. #include <io.h>
    - R+ ?: Z% V: n6 K( a
  8. ! B8 F  T  Z) {
  9. 0 s# ~8 ]+ p) d7 M" V: z; S4 W
  10. int _tmain(int argc, _TCHAR* argv[])
    & e! J( S) j) C/ n
  11. {
    ' @$ y" B( s! o) ]5 [: v
  12.         printf("Dekaron-Server Launcher by Toasty\n");( _4 r  O7 n- g- v6 H1 R. u$ _
  13. 7 c9 b2 G  U+ A8 ~
  14.         //查看文件“DekaronServer.exe”是否存在
    6 p  e! q6 y" g; T6 X/ s
  15.         if(_access("DekaronServer.exe", 0) == -1)1 t7 n. e, [/ i: g
  16.         {% G+ I' D' Z0 U$ }' K2 f4 _
  17.                 printf("DekaronServer.exe not found!\n");, o- ?, `% ^' c
  18.                 printf("Program will close in 5seconds\n");
    4 Q! o) }. a: b/ F3 E1 C
  19.                 Sleep(5000);
    # Q5 p. J4 I6 j/ M* I& p) G6 [
  20.         }, u: e8 W! a) i1 [( n
  21.         else
    % J' ^) U/ [. K" l
  22.         {2 H: Z! v2 s$ h! P7 d7 ?
  23.                
    " x4 n1 f$ r3 u7 E
  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# b! z, \1 B/ o2 ]! s8 y2 Q- o& \
  25.                 STARTUPINFO si;& v: ]* o  r! o& L( E

  26. ' J6 m* D3 s# u& b" v
  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$ A- F  t' K& {$ P
  28.                 PROCESS_INFORMATION pi;* V+ q5 R6 G7 W, [. z! _" O
  29. / ?( Q" B6 j5 b! ?. k
  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) e" _1 x3 Y  v3 Y% C
  31.                 DEBUG_EVENT dbge;  v6 S; c6 t' W# m$ l. A

  32. 8 N$ l( k5 r5 x& P2 o8 X
  33.                 //Commandline that will used at CreateProcess' F: t4 l2 b1 N: d1 V/ M( V; n" X
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    9 U( T. r. h1 H# T0 \$ y8 t

  35. 9 B( o! k* k% }3 O* J
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    1 t- O4 Y" u$ u! H# F6 w
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    $ F/ s# O" n# Q2 y, y
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)9 \2 l5 D* P" q7 z* O

  39. : V4 y- s: l- y0 D3 g, x+ r1 a  W

  40. 0 @. f" L# H1 M1 a# `; T

  41. 4 }3 T8 e# k. c8 k$ U4 e+ C
  42.                 //Start DekaronServer.exe , G/ l5 D6 ]1 A6 q2 I) X
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    , K% b% @; w. O: {( |3 i
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)1 W0 Z3 c: z. d" I) o4 e
  45.                         szCmdline,        // Command line
    # [* h" _' b# o4 U7 |
  46.                         NULL,           // Process handle not inheritable
    ( O  f9 }, i, E2 H# p; \5 g
  47.                         NULL,           // Thread handle not inheritable0 T% g8 R- s' ?
  48.                         FALSE,          // Set handle inheritance to FALSE" [( j4 h% `/ d1 m
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    4 p2 R3 c1 A" v# i+ D0 J
  50.                         NULL,           // Use parent's environment block
    . t- _& |2 q7 J- C5 B
  51.                         NULL,           // Use parent's starting directory
    $ K9 ]% p( h2 S: W- P) j; {, g
  52.                         &si,            // Pointer to STARTUPINFO structure4 J; E! R: j* O: u) x
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    % `4 n# Z* G" ^0 {2 @0 a: n
  54.                 ) # n! o  p$ k* k; i& o
  55.                 {( m" b6 v, O# Q  b6 H
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    ( N; \) G7 {9 M) k$ L
  57.                         return 0;2 _. R3 F# `9 i. t4 f
  58.                 }0 b9 d0 [1 d* T- C
  59.                 //Creating Process was sucessful& c) f+ R# v" W: f" j
  60.                 else
    ( O2 W- e0 }$ U1 E
  61.                 {
    4 k+ _. n1 u1 U' H" v
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    # Q6 @- a# I6 W8 `; L2 G* f2 B% I
  63. " X: _& d7 o% N6 U: v+ m! u
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    6 G6 N& e: J* W( f4 z
  65.                         dbge.dwProcessId = pi.dwProcessId;- H6 J5 E+ r1 a# H% W+ q% W" C! S
  66.                         dbge.dwProcessId = pi.dwThreadId;7 _# G' w% K7 e1 e. H6 m
  67. 2 r- z0 e& s6 w9 S
  68.                         while(true) //infinite loop ("Debugger")* d/ a2 L- Q( ]
  69.                         {
    3 p9 U: _1 Z2 s5 E! U
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    1 L6 y: ?, h+ J  }5 j  ?( ^( h
  71. ) C) A: t! l; l3 F8 P3 C
  72.                                 /*
    3 |+ B' M2 v$ {
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

5 c9 ?7 `! l& c' h4 X$ x5 T3 G6 G8 \

6 M. P. B4 n+ Q+ p. {# M! G
商业服务端 登录器 网站 出售

15

主题

257

回帖

1226

积分

金牌会员

积分
1226
金钱
886
贡献
63
注册时间
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

回帖

1226

积分

金牌会员

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

3

主题

102

回帖

6739

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-28 22:35 , Processed in 0.069216 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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