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

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

[复制链接]

157

主题

372

回帖

7194

积分

管理员

积分
7194
金钱
2070
贡献
4595
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) 3 \6 B. n8 a+ e: ?$ v# r7 m$ i5 t
" @; p& P# ~# M& C; N! ]) {
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
9 q7 N. f: _2 m) v: X. b' Z* D- N  M8 _* [+ T: h7 L1 M
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。2 v+ H! r( g5 [1 t" J+ S
  2. //
    ( T' O& W  k5 B8 Y, Z" H

  3. & H6 U1 @% q2 T
  4. #include "stdafx.h"& {- x/ l$ v3 D9 H$ a0 y: G& s
  5. #include <iostream>+ S" A. W4 o. J9 \$ o  \$ _  u0 d
  6. #include <Windows.h>
    $ R. W8 m: A- ^2 ?" m' e& i% k
  7. #include <io.h>$ n8 n( n* o0 e
  8. 4 x- g* x# R  \) p) v: u

  9. & _! E/ Y/ e) E9 b9 D
  10. int _tmain(int argc, _TCHAR* argv[])4 }; f9 b8 n! E, P1 i, Y6 G
  11. {
    5 p' s& W8 ^) j! r) @. P' z
  12.         printf("Dekaron-Server Launcher by Toasty\n");8 X8 y  j! `6 H  Z! `

  13. ! j. h' Y# S/ |) Y& s
  14.         //查看文件“DekaronServer.exe”是否存在
    # Z2 c+ ]4 V" m
  15.         if(_access("DekaronServer.exe", 0) == -1). S% B, u' `9 M$ n7 J# |. @8 e. U2 }+ u
  16.         {
    5 d( }3 s+ H/ D/ {/ o3 c+ F6 b
  17.                 printf("DekaronServer.exe not found!\n");) e8 [. f; J, l. ~4 R( n; X+ N
  18.                 printf("Program will close in 5seconds\n");! K0 m' [6 Y, W& \' c% K+ |9 }
  19.                 Sleep(5000);3 D0 ~! g- h9 L0 h) }
  20.         }* N% f. u" j8 E# w+ N- t+ l- p, z7 V
  21.         else
    ! a$ J) i% K0 @2 [  ]# K) r, t" d  p" ~
  22.         {- C. U3 t, Y, }7 H- {0 C
  23.                
    ; |0 L& S  o2 J' N* U* h: C/ G/ V* ?' c
  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
    ! c; K; Y1 a( G: [
  25.                 STARTUPINFO si;& \) s2 }! b; ^3 G# I1 w; b( B) k* s
  26. 6 ?& O6 H! E% L# y4 ^
  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
    + S* c5 i# Q* t+ J; ?% n5 T. H
  28.                 PROCESS_INFORMATION pi;4 H& I& I( r+ `

  29. / E8 K4 z# g  d3 a
  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).aspx7 ]- m3 d5 K. y" M0 m+ S/ u
  31.                 DEBUG_EVENT dbge;2 {, \% g% B3 L

  32. 0 u; ~" I$ P1 v5 Z% u4 R& `: S
  33.                 //Commandline that will used at CreateProcess/ I% m& q/ J! I7 u7 \5 a" ^( c
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    . G7 E8 P1 O6 b6 s
  35. ' e5 w% F+ U. ]6 V; b7 Y
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    8 ^& |5 q2 F! H% R3 p8 ~
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)/ @+ n. l3 E, u: J; H- {
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)% _1 j% k( R( a9 `
  39. 0 }( p+ m! |! i0 ?& X3 a; I5 m
  40. 0 x0 K0 K+ p  J7 x$ [0 _

  41. * L9 j" q3 c3 N% ?# `
  42.                 //Start DekaronServer.exe + p1 w* \, q2 Q; x1 u6 n. ^$ K7 U
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx4 D& B" U1 m( ?# Y) ~3 l5 w
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)" m/ P) E1 b5 u) Y! K1 q. _
  45.                         szCmdline,        // Command line
    & {9 F' E( ?/ o# @+ d
  46.                         NULL,           // Process handle not inheritable
    - P( u% O$ E- r5 B2 ~
  47.                         NULL,           // Thread handle not inheritable* `% K) N5 _7 [# F
  48.                         FALSE,          // Set handle inheritance to FALSE
    8 ~, Z, d8 d2 V5 g/ S' R
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    ( S- l- ^3 ]: ^3 A
  50.                         NULL,           // Use parent's environment block
    $ }, S: ]/ v& x  i+ o
  51.                         NULL,           // Use parent's starting directory 5 i; L' t0 d! \+ U4 B* e
  52.                         &si,            // Pointer to STARTUPINFO structure
    " l$ {- a" i3 S5 W4 }! Y2 O
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure, E0 ?0 a  ~* ?) X* B  V
  54.                 )
    : V$ {( E  }; S5 P5 C& G* o7 \
  55.                 {* c9 t0 k% s7 T8 ?3 m, ?# H6 J
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    0 G* P: m; l& C  _2 @' @2 x
  57.                         return 0;
    $ z% \& z, s- P$ e
  58.                 }+ M6 Y' g0 C6 w5 z9 y
  59.                 //Creating Process was sucessful+ V5 i7 r# v8 q" r
  60.                 else
    . N: s( \9 a- M5 j. H
  61.                 {
    . [! S: {( U0 e8 t3 c
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    2 s# R2 f" j6 k) n) Z+ p' I

  63. ( K* d: I7 k8 A  m% p; }( z
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    ' L" R- i: r2 S& b, t$ @' o1 j  D
  65.                         dbge.dwProcessId = pi.dwProcessId;3 h; A: P% R" H! B2 l! g: B
  66.                         dbge.dwProcessId = pi.dwThreadId;2 s" w1 ^, P9 @/ o" `5 k
  67. 5 m7 S. U2 ~( \. I# u
  68.                         while(true) //infinite loop ("Debugger")# X) \. |! R! y. d
  69.                         {
    . b. p7 t0 p3 z* a1 S0 m
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    ' o9 Z9 e! R3 J# u1 ?7 ?  y9 R
  71. 1 _5 b+ x8 `# s8 c0 d+ A! j  t
  72.                                 /*
    . f) o/ Q) Y' U$ C$ n$ s- C6 ?
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
: d/ F6 ~! I1 b9 s
" N7 H2 q/ o# B8 ^9 [  a" c: b3 Y. v7 ]

* S7 S8 L" P# O& Y
商业服务端 登录器 网站 出售

15

主题

258

回帖

1251

积分

金牌会员

积分
1251
金钱
907
贡献
66
注册时间
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

主题

258

回帖

1251

积分

金牌会员

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

3

主题

102

回帖

7517

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-12 05:24 , Processed in 0.037677 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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