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

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

[复制链接]

160

主题

385

回帖

7412

积分

管理员

积分
7412
金钱
2123
贡献
4744
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
+ H$ x# k4 E$ X2 Z: q
; l8 P7 M4 B7 l8 T$ d3 M5 v虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
7 \0 k  ?8 y% B# e. a; J2 o% p3 P3 H
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。) ]0 N' q3 g5 j# C0 T
  2. //
    5 b  I! z0 V6 [( t0 y
  3. 5 x2 ?) L" v' c* ^) X
  4. #include "stdafx.h"
    0 l! ]( ^/ |+ d% X& B( ?/ X
  5. #include <iostream>( S' I& ^% S2 v9 W2 B: W1 s
  6. #include <Windows.h>
    9 ~" C* V, M) {
  7. #include <io.h>9 m5 i$ i) l8 w* A$ W
  8. 2 ~- [3 s5 h: A" B7 w
  9. 4 [6 s) t& z% U- G; S! X* G% ~
  10. int _tmain(int argc, _TCHAR* argv[])
    & H0 K8 f: M& z# Q8 b
  11. {
    ( w' m- J6 E/ C, R* ?7 a
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    8 v# r. G8 f/ o

  13. ! U" \9 w& m& \6 W3 b8 A. Q$ g4 |
  14.         //查看文件“DekaronServer.exe”是否存在4 t4 @6 [. l  W' t) `+ p
  15.         if(_access("DekaronServer.exe", 0) == -1)
    9 `1 u2 t3 M8 K
  16.         {8 I( R9 S: k. q- x
  17.                 printf("DekaronServer.exe not found!\n");4 V( f& @6 K/ G# e
  18.                 printf("Program will close in 5seconds\n");
    5 `5 _9 x' W0 R* N8 P, j: Z8 B' t
  19.                 Sleep(5000);: j; `/ o3 }0 h7 [2 T  m% F
  20.         }0 z! B$ A$ \* j$ P
  21.         else
    / U% C6 j% I  O$ x
  22.         {+ m) o+ p! S1 O9 j) l" e- P2 g" z
  23.                 ; @+ X0 s: m- f# d$ F" b
  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: a5 ?6 e0 l/ N" b; O" s/ g4 C" K
  25.                 STARTUPINFO si;8 [* v$ M# t7 U  L! F
  26. - I4 @# Y  g& 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; l4 y4 r; z, r
  28.                 PROCESS_INFORMATION pi;
    % d: T$ `' t7 r" o# [* j+ k7 ^
  29. & l3 u1 n" N; i6 n
  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
    ) O) Q6 ]! J* e
  31.                 DEBUG_EVENT dbge;
    # i  ?5 R- q5 e1 c: Z) r

  32. ( o5 p; n5 ?3 a
  33.                 //Commandline that will used at CreateProcess5 D1 U( }% d1 }/ I
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));3 W* B7 X% @0 ?4 B3 |/ z9 A5 |

  35. - b7 B, t* B. b$ I
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    # q$ T3 E" }0 H. ~( t7 }
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)7 w9 _: h9 A& V8 d1 @! S5 E
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    1 B  O- y6 I4 H% j4 x, p

  39. 5 r7 V. a. f& L" ~, P# |7 E# r8 F

  40. 8 ^. E! l, @. O4 b& t
  41. 0 f2 U/ r( z& S7 g9 T
  42.                 //Start DekaronServer.exe ; w. F' O  I& H5 L% m9 U9 S9 D
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    * D% X# V7 z1 Y8 E
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    & n- W8 L5 l2 `7 E
  45.                         szCmdline,        // Command line& l9 o, z+ k/ n+ W# M3 _5 W
  46.                         NULL,           // Process handle not inheritable. K( ?* S/ C7 }& g
  47.                         NULL,           // Thread handle not inheritable9 E6 T1 L, A2 E7 w. A
  48.                         FALSE,          // Set handle inheritance to FALSE
    4 _/ c4 p, j. Z* e. M* s) _
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx' u% [9 P% x- Z, h  y$ Z
  50.                         NULL,           // Use parent's environment block1 `9 N; n' Q) u! g6 O+ A0 L8 u4 d( p
  51.                         NULL,           // Use parent's starting directory   a9 A  {2 [; r6 i' j/ p2 `' `' l
  52.                         &si,            // Pointer to STARTUPINFO structure7 ~5 Y- A- @0 |( Y  E: C* a% [
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure$ b0 x: s* q/ v7 F
  54.                 ) 8 f) s3 i* K& s4 o
  55.                 {  V9 s2 H5 j$ H1 f2 n" i
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );
    / R. {+ ~' {/ |0 j# b' L& O6 P
  57.                         return 0;
    % r4 `6 k, |& M; Q
  58.                 }  D. I! s6 E$ f: L) U4 p
  59.                 //Creating Process was sucessful
      m. B) l8 F0 @  U% A2 j, S
  60.                 else) C- c1 b4 E" j6 o9 }
  61.                 {
    + f" C2 t' a+ o: G5 [! b
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    # a; `4 |6 g$ F& b& C

  63. ' _$ p/ O* ^3 s9 n: o/ C. U7 @) _/ F# f6 M
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure) Q) e- ~* M4 t
  65.                         dbge.dwProcessId = pi.dwProcessId;
    ) j; k( E$ I" v$ U+ |$ A
  66.                         dbge.dwProcessId = pi.dwThreadId;
      M# I) _, a  a+ K* i/ o2 X
  67. 8 u/ p/ @' y3 z) [
  68.                         while(true) //infinite loop ("Debugger")
    3 F0 [2 x  h4 W3 ?! I( M/ k2 i
  69.                         {
    ' Y7 `; _4 K/ Z; \
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx0 m! W+ l, E* X: ^
  71. , @% j; `6 \4 _, ^! G: n
  72.                                 /*/ `: J: G; m2 Y
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
2 J( r& `5 Q/ P; b: T$ g/ @
, u, y2 K+ x5 b, \$ t7 a0 ~

+ K" V3 t! b# k# S4 s
商业服务端 登录器 网站 出售

15

主题

259

回帖

1278

积分

金牌会员

积分
1278
金钱
922
贡献
77
注册时间
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

主题

259

回帖

1278

积分

金牌会员

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

3

主题

102

回帖

7837

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-4-28 09:21 , Processed in 0.040482 second(s), 28 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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