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

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

[复制链接]

154

主题

339

回帖

5794

积分

管理员

积分
5794
金钱
1825
贡献
3476
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
; p) R# l0 v, R9 O" v
5 ]1 O  U, I3 q  {& s7 h虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。" m& q. f/ k. P9 A* F

8 J9 Z5 f: p# q+ h. s, a* V
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。( v+ h( o/ ?6 x; D5 O% A
  2. //
    9 ?8 d. o  J% b

  3. ! W, v. k: D2 i& _6 }2 x* Y' i
  4. #include "stdafx.h". {9 R/ H+ s, ^; b' [' p
  5. #include <iostream>
    . _9 L2 X8 x/ K6 N- y9 ~
  6. #include <Windows.h># U  S4 V$ f  _* s) P  v
  7. #include <io.h>
    . j9 L8 g" e+ K) N# Y  ]

  8. : `, e; M4 H4 `8 j: W% t; o4 {1 `
  9. * A, S" b& r* _* H5 G6 L0 `/ G+ V6 r4 s
  10. int _tmain(int argc, _TCHAR* argv[])
    ) v1 J. @  y3 w- s
  11. {
    2 o* _. Z) H. z+ f% {( q' E
  12.         printf("Dekaron-Server Launcher by Toasty\n");$ I6 a% N0 e2 P4 w3 Y
  13. 9 e( r1 N+ O6 J2 c4 I1 ~; \
  14.         //查看文件“DekaronServer.exe”是否存在
    # t! e/ Q( ?* u% L
  15.         if(_access("DekaronServer.exe", 0) == -1)
    * @* k2 U7 w/ m" X. }1 Y/ D: h
  16.         {
    % x$ V3 b: h" `4 Y6 V
  17.                 printf("DekaronServer.exe not found!\n");
    1 P: Z6 j; O- _% R$ Y- X
  18.                 printf("Program will close in 5seconds\n");. k; X) a7 }. B) j
  19.                 Sleep(5000);
    # m* {! C* `3 N& X
  20.         }
    0 z* Q( E  i( G, z5 ^" Q0 X4 A+ W/ E
  21.         else
    * w+ A5 n7 I, C/ ?3 {) m! E9 |3 r
  22.         {" e: W7 \. P; l" A
  23.                 . i/ w9 U( @3 W1 U' k! j( c, [3 h3 z" L
  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
    9 r, q3 E+ q6 P9 c4 F- m
  25.                 STARTUPINFO si;
    3 D- F# ^( Y$ t0 J2 H

  26. ( Z& J2 D  B1 N2 G
  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& Z2 R& P3 j. ^
  28.                 PROCESS_INFORMATION pi;
    , E% _" O, y0 U) N7 B
  29. 5 J% O" v: U4 p4 l4 v
  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
      w4 j& X; ?# A5 ~$ x8 `
  31.                 DEBUG_EVENT dbge;. Z& g1 s+ e$ r2 m( G8 d

  32. 4 m# H* Q$ b) W* f: v
  33.                 //Commandline that will used at CreateProcess
    ( B) f4 p% U/ m! T% [
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));' H- ]) M6 A7 |& A; i* @

  35. 5 q' i; M! h: i% V
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)- ]3 h. X" f! f7 E1 s" J- e9 @( V
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)  o- x- u9 K% i2 G9 }6 s3 `
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    * r. c' f; ]/ E4 C
  39. , h- t( o% g" N; G* f
  40. + |7 f) n0 O- ^. N9 a
  41. ; Z! g9 u2 ~' Z, S/ H) r
  42.                 //Start DekaronServer.exe
    1 J" K& M. r. Q3 h
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    ( U6 x3 C# z" l4 Z  f
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)0 u: h, Q2 s2 v% Y
  45.                         szCmdline,        // Command line. f- G: a. y1 E6 m4 Q% v: a
  46.                         NULL,           // Process handle not inheritable1 l! G3 }& {; e' A
  47.                         NULL,           // Thread handle not inheritable
    6 _* M% ^+ m5 f$ E" `
  48.                         FALSE,          // Set handle inheritance to FALSE
    : x' B9 ~$ _# a3 p: H+ j
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    * C2 ?( L2 @9 r& }
  50.                         NULL,           // Use parent's environment block7 x' v1 S, }# M
  51.                         NULL,           // Use parent's starting directory & ]+ z4 `% @- K" K: C" f9 Z
  52.                         &si,            // Pointer to STARTUPINFO structure
    + ^6 h2 U# v2 t7 I- R9 |
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    8 R% H5 ^) m% Q) o/ F6 T& K
  54.                 )
    , `. g* p" C; Q! t, A2 J  H1 q2 G9 l
  55.                 {
      W7 N0 `1 _0 G
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    * @5 b0 s; {9 X6 [' V
  57.                         return 0;
    ; P4 v. q/ n, h8 d
  58.                 }* [* q) e8 n1 F9 n7 I6 ~
  59.                 //Creating Process was sucessful
    , [# |2 N+ F: {8 O! ]
  60.                 else: o7 U9 x2 s4 k- N$ P& o
  61.                 {0 H+ q! |' a* ~  p4 e( `; j
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    7 x2 `. L  n4 j* n5 x6 i% N

  63. " y+ ]7 q( ^4 @7 N; O
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    $ w7 G% S+ _  P7 r" q; N' v
  65.                         dbge.dwProcessId = pi.dwProcessId;# o# B. p0 x" i6 w
  66.                         dbge.dwProcessId = pi.dwThreadId;+ s  }0 B  {% a, Z8 c/ F( J
  67. ; t" J/ H2 O$ }# v- I
  68.                         while(true) //infinite loop ("Debugger")! a( g. e1 Q$ D- L: m6 [1 U9 Z  `
  69.                         {( e/ W0 B+ U8 ?, V1 r, L
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx3 v  c+ \, H% m7 y
  71. + V2 Y6 ~/ r! y  _  E$ Z4 h! r
  72.                                 /*
    ' B- o# w5 V+ R3 O7 {
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

9 I) v7 R  e+ ]4 z. X/ U6 V; f$ }, p$ w* _

6 t" I9 D" t, i( G" Q
商业服务端 登录器 网站 出售

13

主题

251

回帖

1249

积分

金牌会员

积分
1249
金钱
796
贡献
184
注册时间
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

回帖

1249

积分

金牌会员

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

3

主题

99

回帖

5293

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-5 15:20 , Processed in 0.102742 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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