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

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

[复制链接]

155

主题

352

回帖

6233

积分

管理员

积分
6233
金钱
1878
贡献
3848
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) + ~- ?  U% A& E! @/ N$ \
5 x7 M+ W* r% f
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。4 S' _) T" b0 Z, C2 ~6 {, r; h& P
: G0 N3 G; F6 `& D- n
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。6 \* F/ H  d7 Q8 z, J
  2. //0 k9 x0 q# O- N* u# ~2 l- O' q

  3. ; d3 o) O0 r- J, n3 Z; `- V5 i
  4. #include "stdafx.h"
    / S5 ^# U0 j5 [
  5. #include <iostream>
    " J# |- V7 u; d$ E
  6. #include <Windows.h>
    . P: J% G1 e1 S' B0 E9 z
  7. #include <io.h>
    4 E% M5 P6 c; Q5 l  n: m
  8. ; q) k7 w7 |6 h  \+ F' M* y

  9. 8 r$ G1 H# K/ e) v' R8 u
  10. int _tmain(int argc, _TCHAR* argv[])
    * J3 ]) V, U- c- J- H/ g, a
  11. {6 N: l+ R; o, b. H( J
  12.         printf("Dekaron-Server Launcher by Toasty\n");/ s& B4 F; N6 M5 e4 Y# r$ D

  13. + z) g9 H5 v8 l+ ^
  14.         //查看文件“DekaronServer.exe”是否存在' S* g6 H8 p' _8 p7 _, y( D
  15.         if(_access("DekaronServer.exe", 0) == -1)) Y0 M4 k& E8 \" {7 u, M
  16.         {0 {% W' T, K6 _$ L
  17.                 printf("DekaronServer.exe not found!\n");# S* H! T/ }- x# X$ a& c2 L
  18.                 printf("Program will close in 5seconds\n");& `* {1 B( O0 ?$ {8 R$ n  j
  19.                 Sleep(5000);
    & _& y8 d" n- }- R7 f6 Y
  20.         }
    & Q- u/ H4 V/ |5 k" F4 S
  21.         else# T) ~# Y6 D3 ?1 c1 `
  22.         {
    + [* I" {! z' w: P" D, C- h+ I5 T; w
  23.                
    - w1 A" F; ?/ \: w
  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) Q. N( H% }* x9 H/ O
  25.                 STARTUPINFO si;. I/ l6 i8 o( i9 c6 n

  26. 6 H: t. I6 B+ c% U1 Y
  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- P" Y8 ?; q0 v+ J4 D+ U# v
  28.                 PROCESS_INFORMATION pi;! b, Q# t0 e: s# q
  29. * i" t# j8 P+ V. w! M
  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# ~# h( Y$ n+ g
  31.                 DEBUG_EVENT dbge;; l- I0 _" m% a8 M

  32. 8 e8 j$ u! C! J) l& Z% i
  33.                 //Commandline that will used at CreateProcess& S& a, I* @8 N. O' r. T
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));* r, J6 F1 t& @& \. o/ [. C

  35. ( J. z6 n4 D6 J8 _( G5 r
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    $ G' |' P: d9 l2 r% U2 x/ C
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    & g* w' b. @! _$ w- t5 W
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)/ ]* h( O0 S/ h) i' T& v3 j, d8 V
  39. 1 ~0 z2 B0 l* d$ A

  40. . I. u2 ]* l/ }

  41. 0 g6 h" N! C& A9 ?5 ^2 L
  42.                 //Start DekaronServer.exe
    9 u0 W. ?* }+ n$ n, X- M5 g9 n
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
      w. p. b, V1 d$ G# `
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)2 V3 w9 _, {( q' v2 k4 Z9 C$ w
  45.                         szCmdline,        // Command line
    6 Y4 c7 m6 _2 D' g+ X# l; a
  46.                         NULL,           // Process handle not inheritable  D2 j! t! S( c5 b
  47.                         NULL,           // Thread handle not inheritable9 s3 `3 e7 f, n8 |$ a9 t. {% P
  48.                         FALSE,          // Set handle inheritance to FALSE
    ! w" j3 t# D7 Y3 F. y
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx" H9 r: @9 Y0 x. \  T; f
  50.                         NULL,           // Use parent's environment block
    6 u# m9 i" W( W( Q4 {: i) c# S
  51.                         NULL,           // Use parent's starting directory ! G( c5 o# p4 m' d6 ?" S
  52.                         &si,            // Pointer to STARTUPINFO structure6 N! D/ v. n4 m! {  H, q  V) s
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure( V; F1 z7 \! Y$ Q( r
  54.                 ) ; I. X/ u1 X5 c8 c) z/ `
  55.                 {+ [, u) z1 w$ I, v/ R! p1 a3 G, U
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );' h* {( r7 H: b( M
  57.                         return 0;
    ! G6 \: g0 `5 w, [5 y6 B
  58.                 }
    5 |) F: m$ ]0 O' M8 C$ p
  59.                 //Creating Process was sucessful# A" _7 V/ T' D/ W  F, [
  60.                 else
    - p! u/ O0 Q. n# P9 s2 x
  61.                 {8 S; M1 ?4 R0 K$ F0 K+ y
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    # W. o/ A9 A4 @. S3 J

  63. $ Q. }; ?/ n0 S5 m# \9 n5 P- q
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure8 W9 a( V. Q" t0 `9 m
  65.                         dbge.dwProcessId = pi.dwProcessId;1 r# y% L5 o3 a3 K
  66.                         dbge.dwProcessId = pi.dwThreadId;
    ! {+ S( K9 S! _' R

  67. / l6 E0 P2 U. h
  68.                         while(true) //infinite loop ("Debugger")
    + w! J4 k4 m  v) j& ?% @9 g
  69.                         {& q: b! W6 {- M( Z2 ?( N' V) F
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx; ^/ _2 O* Y4 q: w

  71. 4 f7 F% l3 K* u4 Q+ u9 Y7 ~
  72.                                 /*
    * D4 ?+ ~( q) ?% B
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

- D9 i/ T# ]; i8 ^' c- ?
2 P0 R; `' ?/ r9 e' X
4 |3 R$ i. i$ P0 h
商业服务端 登录器 网站 出售

13

主题

251

回帖

1250

积分

金牌会员

积分
1250
金钱
826
贡献
155
注册时间
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

主题

251

回帖

1250

积分

金牌会员

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

3

主题

102

回帖

5903

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-12 10:26 , Processed in 0.082985 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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