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

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

[复制链接]

167

主题

431

回帖

8422

积分

管理员

积分
8422
金钱
2429
贡献
5395
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) ( J8 s1 J7 u" g4 E" w% @
, w* _) l* E6 i" h  h: ?
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。, Q; _$ i6 Z- @! B

3 P3 X2 }! ~. f
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。1 O+ F" c! [+ P
  2. /// A9 J. H5 F3 f: L+ C2 m
  3. 5 X7 o5 F2 p2 g3 o- j) H( t
  4. #include "stdafx.h"
    & L$ n5 d2 y: J( h3 o' t
  5. #include <iostream>% c) I$ B" |2 w2 y
  6. #include <Windows.h>3 v# S% F( \/ ]3 W6 h7 [' ~9 }
  7. #include <io.h>4 [9 ^9 Z! g" K& ]7 u' N: l8 [

  8. ' s) @2 N3 x# p4 o  i4 q" k3 c

  9. 0 n# `' W# q" b* G" Z5 D$ A, v
  10. int _tmain(int argc, _TCHAR* argv[])
    3 s; k2 P$ A* B" P# h
  11. {/ t; m2 ]5 x* u5 q- L8 E. D" T7 g" t
  12.         printf("Dekaron-Server Launcher by Toasty\n");/ i- W, |9 `! a3 P" {) t) [' l
  13. 9 u/ O# {. D* Q) ~
  14.         //查看文件“DekaronServer.exe”是否存在: N1 ]7 t, X" P3 X, z! I
  15.         if(_access("DekaronServer.exe", 0) == -1)
    ) a6 e9 F1 M1 s8 B8 l, M5 O5 |
  16.         {. |4 s. q! r/ F
  17.                 printf("DekaronServer.exe not found!\n");
    9 D+ ^+ \5 L/ M+ K- _
  18.                 printf("Program will close in 5seconds\n");
    % p1 [* S' t" c7 Z3 P" w
  19.                 Sleep(5000);
    " h* C3 h4 E4 _( ]7 B
  20.         }
    " D! H% J9 W# v( {; [
  21.         else% e- x" o  k: i4 H5 j6 ]
  22.         {3 h. T. t/ c1 n7 D2 ?3 ?
  23.                
    & e, L! z2 x) W3 T5 d
  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
    6 k$ K. J3 z, w9 d5 d. v
  25.                 STARTUPINFO si;# E8 L: K. Z; ]
  26. ' I& f/ V2 d8 ~8 U% Z1 z9 e4 w
  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
    2 t/ N( Q! ^0 _  H2 |6 h
  28.                 PROCESS_INFORMATION pi;2 s- |( G: p, O: y  `% Z
  29. ' w  {  l9 c5 C) z* K! j
  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 Z  h5 K1 e7 S; ^' T7 I2 B: O
  31.                 DEBUG_EVENT dbge;
    1 A1 `6 l) S+ D1 \# V$ Z7 I
  32. ) c' ?6 ?- M& ~5 J
  33.                 //Commandline that will used at CreateProcess* A* m  I( D. F' w
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));$ |& W/ U# w# a3 e4 s$ z
  35. 8 P# C& W$ S  l; p8 t$ j( O5 S
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)6 i; [: n) i0 s$ t1 L0 Y1 ~
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)7 ~7 z5 z5 ]! q8 j$ y; M
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)! f+ k$ T1 n4 c8 Z4 X& Y7 E7 q
  39. " i( N9 i; L* v* G- q

  40. 8 j1 g$ K7 E+ `& \+ R; g/ W
  41. . g9 c7 c1 S4 K5 r8 s4 x* m
  42.                 //Start DekaronServer.exe
    # y% f' ~3 E& b- C# H8 a
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    0 g$ u7 A7 i1 r3 g
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    ; x) z2 u# L8 Z
  45.                         szCmdline,        // Command line2 n" {4 p. {+ X4 P# s
  46.                         NULL,           // Process handle not inheritable0 R- z2 j, k# M& J  B9 M3 t  [
  47.                         NULL,           // Thread handle not inheritable: X2 D0 N' u1 U
  48.                         FALSE,          // Set handle inheritance to FALSE
    ! {. W9 {8 ~% ~$ R" r* o# n6 I0 F
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx! `" \  V) k# ?- a' f
  50.                         NULL,           // Use parent's environment block
    * L+ }8 ~# Y9 b- O; L9 |7 ^9 b7 b
  51.                         NULL,           // Use parent's starting directory
    4 \2 _; O  O2 H
  52.                         &si,            // Pointer to STARTUPINFO structure9 ^/ ^, f0 h3 _2 k% d6 n4 Y
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    1 F0 V6 V# A1 G1 ^
  54.                 ) 1 |" r5 w4 g4 m% t2 k1 _9 f
  55.                 {+ m( E9 h! X+ h, |6 d) L" G
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );9 ~- U! Z: ]  X0 x4 X' W  q
  57.                         return 0;0 P% L$ n9 \4 q0 R; e0 C! [
  58.                 }
    " r6 r6 C1 s2 [/ A( c' E
  59.                 //Creating Process was sucessful& h# P9 w9 [7 |& m: w/ l
  60.                 else3 E; N: Q3 p2 c# S; K- u, X/ r
  61.                 {
    8 M) X& X6 P7 f- i) j
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    0 K0 s4 N1 n$ ?+ \2 i2 Q; h2 y  a
  63. 5 n1 i! N9 M4 t& Z0 h  Z7 R' Y
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    4 h4 X; n, w9 {4 t/ t, ^1 P" k
  65.                         dbge.dwProcessId = pi.dwProcessId;' F+ n& n: Y+ Y" @
  66.                         dbge.dwProcessId = pi.dwThreadId;
    ! {+ A  B& U1 E/ g4 q# J5 K

  67. 6 y7 t- n3 k, n4 c; P- p
  68.                         while(true) //infinite loop ("Debugger")
    1 i9 P! Z$ q$ m
  69.                         {
    + e9 [% ^4 r; |* i2 O9 x( N
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    # _5 @! H& D- A( Y2 d1 N
  71. $ s. j! r  {$ ~/ q  m+ B* \$ o
  72.                                 /*! o* y& W! Q9 _
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

+ P# {: k7 f1 I7 K% Q( b/ |
5 q7 |0 Y, H2 `5 ~. [+ j) r% w9 K# Z3 x$ ]
商业服务端 登录器 网站 出售

16

主题

270

回帖

1605

积分

金牌会员

积分
1605
金钱
1161
贡献
153
注册时间
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

主题

212

回帖

370

积分

中级会员

积分
370
金钱
155
贡献
3
注册时间
2024-5-14
发表于 2024-5-14 15:56:57 | 显示全部楼层
学习学习赞赞赞

16

主题

270

回帖

1605

积分

金牌会员

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

3

主题

103

回帖

9250

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-11-16 08:20 , Processed in 0.053203 second(s), 30 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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