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

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

[复制链接]

157

主题

372

回帖

7186

积分

管理员

积分
7186
金钱
2070
贡献
4587
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) - {: N4 Q; \5 \% h
, ~! |4 }0 A5 q' j% q) }/ I+ G
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。0 s8 v2 r1 L* W5 z  L
3 ~" R# Y; ]) D5 n
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    6 w5 x/ F& c# M' D, X+ {) [
  2. //
    " \9 c" p( ~6 [6 Z9 `" Q& K! Q

  3.   p2 a9 u2 j: o$ y# D1 W3 B0 b
  4. #include "stdafx.h"
    - ~0 i' m/ ^- M+ r; [' Z. R
  5. #include <iostream>
    6 k' F0 N# t$ \4 r
  6. #include <Windows.h>3 t" n$ H2 i$ k+ T
  7. #include <io.h>5 ^( p+ v5 g! j& `

  8. 8 [+ F$ H* v" U  m; \; c
  9. + q/ }. t8 l2 C& R
  10. int _tmain(int argc, _TCHAR* argv[])
    + N; \0 c, a1 p% f
  11. {
    1 @/ v& J% a6 U, b, Q' Z8 W
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    4 Q* L8 ~+ s. ?+ f% S/ K$ `
  13. : q1 F7 e; W. a2 r9 ]) t2 V- Z6 ~( |
  14.         //查看文件“DekaronServer.exe”是否存在
    " h% u2 K7 m# o! K* t! C
  15.         if(_access("DekaronServer.exe", 0) == -1)5 T6 r7 R4 d" r4 K
  16.         {
    * j& ~" D0 v  M
  17.                 printf("DekaronServer.exe not found!\n");+ U6 B+ ^5 d& [# |$ g
  18.                 printf("Program will close in 5seconds\n");
    3 h% s) U# F$ t4 \( ]+ o( t4 [# I7 C
  19.                 Sleep(5000);* v( Y: B; n( K* h7 W
  20.         }
    . M& v9 C, P; S7 d) T( _
  21.         else( k! j4 y% f. v: o6 X
  22.         {# Q& `8 w- w# B5 e
  23.                
    7 T: J: h5 |  s" O7 p
  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: p9 H& I+ y3 p' [' H& n
  25.                 STARTUPINFO si;. ~/ g/ B3 W% N/ i. n! i

  26. % _) U8 r( \4 K4 h2 i/ }0 Q! B
  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
    6 \. P7 h; I& \% ^( k7 l
  28.                 PROCESS_INFORMATION pi;; P0 I( X1 D+ j
  29. 2 h0 Z) S, Y) i3 z- W  Q$ ]8 e" E
  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. f, v, x& C4 N% j: m  }
  31.                 DEBUG_EVENT dbge;
    ! W$ w0 y( ]4 Y9 v1 j) k6 ^

  32. ' H! Q* E. j/ l! m" f- D
  33.                 //Commandline that will used at CreateProcess
    1 i) I* ^- P$ b9 @( g- l6 k: M
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    # _# S* D" q* l  P" x
  35. 0 g/ q( t4 `$ b6 R' z
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    " _3 Q5 w5 Q, Z: ^' V& J) U' g
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)( I" c) D) R0 R% X
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    8 K5 s, v* e* ]* f, \- E! `

  39. + l& f; s/ z4 g3 r
  40. / M) f) }8 |! Q- f( t5 T2 ]3 u5 C

  41. - a2 d" a  z# T
  42.                 //Start DekaronServer.exe ; y! _0 v# @8 e% e/ _- J6 l6 y
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx) ]3 U7 k) Q4 Q' ?2 X- ~5 P
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    , g3 K! s5 [$ ]6 x) E
  45.                         szCmdline,        // Command line2 K; }6 k) C' j' w, _; t7 S* [
  46.                         NULL,           // Process handle not inheritable
    / [( [7 v) B2 L* o. y  X; U% @
  47.                         NULL,           // Thread handle not inheritable5 t; K3 w: [- o" R
  48.                         FALSE,          // Set handle inheritance to FALSE
    3 Y* K* f" ?9 X. D
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx& E$ M! ^0 Q' u% X1 c; z
  50.                         NULL,           // Use parent's environment block, X# e" k9 \) v
  51.                         NULL,           // Use parent's starting directory
    : e" A# x. Z3 o; [# `5 f3 T
  52.                         &si,            // Pointer to STARTUPINFO structure
    2 P4 x. N6 |4 w
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    $ ~: V' _* [/ C2 R1 p/ x
  54.                 )
    , J) U+ i1 b9 N" D  e- |
  55.                 {
    4 T0 E0 S. l- r) Q9 S% n* m, s
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );# L8 N0 K4 X. o7 |  G! Q. s$ R
  57.                         return 0;
    6 G# C' @7 u7 ^0 [+ [! Z
  58.                 }, ^" G& \+ q; T2 @) W8 s# H5 c
  59.                 //Creating Process was sucessful' B2 c8 Y' I# n6 d9 ~
  60.                 else
    + K7 D8 ^( }4 B: L* }1 Y7 K, y$ m
  61.                 {/ d: G' {# f9 N. V
  62.                         printf("Sucessfully launched DekaronServer.exe\n");, e  S- i* H6 q  N* s1 p' |; D' \
  63.   Z- o: G( ~2 N, d1 K0 B
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    + x+ Y9 Z3 S5 N, Y' O* r( j
  65.                         dbge.dwProcessId = pi.dwProcessId;  n  m& p6 Q, Q& k& V0 _4 _# K
  66.                         dbge.dwProcessId = pi.dwThreadId;
    + h' w- V% P) k. r3 q
  67. 7 o1 ?- f3 P" H
  68.                         while(true) //infinite loop ("Debugger")  h4 x# x/ O2 R
  69.                         {
    7 F/ E. j, x. @- I* f. X
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx5 ]4 j+ ^, c4 L7 J# U( o' o
  71. ! V  L- {2 _7 t5 q
  72.                                 /*- \& N9 J4 E+ i* L9 r7 _
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
% N# J* O* C; i( ]; a" w  @3 t
/ B, b" z' S: R4 a  e& v/ Y, c

2 P: ^1 A3 Z9 g0 k' R& U5 @( q
商业服务端 登录器 网站 出售

15

主题

258

回帖

1248

积分

金牌会员

积分
1248
金钱
905
贡献
65
注册时间
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

回帖

1248

积分

金牌会员

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

3

主题

102

回帖

7497

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-11 01:37 , Processed in 0.040341 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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