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

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

[复制链接]

165

主题

418

回帖

7945

积分

管理员

积分
7945
金钱
2326
贡献
5036
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
# o; `% W6 t+ N! X+ K& _2 G6 n* S5 }3 q! E, r0 \) `, \0 k
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。
; C6 _; J8 M5 G: `# f" `5 }' {' K1 n( ^- b# p0 h+ ~
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    - e* H+ g( F* w, ]6 S# N
  2. //
    " I) G8 H% s' q: G% k3 V
  3. ( ?/ i+ e2 F. U; ~& b" e
  4. #include "stdafx.h"
    , U/ x; ?' b1 e* Q+ e7 S
  5. #include <iostream>
    : o! t7 l9 D9 i9 j
  6. #include <Windows.h>8 C' O. Y1 h" Q( V
  7. #include <io.h>
    5 ]3 H4 ^5 t/ v% _4 T2 L: }4 {

  8. 7 j7 v7 g- V$ P% L, S

  9. 8 k+ P8 J- x. C- _
  10. int _tmain(int argc, _TCHAR* argv[]). {/ s/ h) ?. p; |
  11. {& t, F  y& e5 |3 y
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    : ~4 ]$ q3 D# L7 J$ W  w

  13. - O. {; o1 O7 y* T1 q$ ^
  14.         //查看文件“DekaronServer.exe”是否存在
    ) q5 }# d& C9 O
  15.         if(_access("DekaronServer.exe", 0) == -1)& K& X" W+ n) _4 c( m
  16.         {
    / F: y* K0 S7 M6 o
  17.                 printf("DekaronServer.exe not found!\n");
    ' M5 B7 z" D( T7 J; m+ S
  18.                 printf("Program will close in 5seconds\n");
    , b% z- |6 G+ h* k
  19.                 Sleep(5000);0 C- O& r1 b' P
  20.         }
    ' t7 Z2 D- |/ @0 q" j
  21.         else
    4 \8 F" V) r; n3 J
  22.         {0 w: D! G1 `! ?& X+ f2 J: K& N
  23.                 . U5 r- ?* `) V3 {0 ?) 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).aspx1 P% o1 ^: [. i7 y- M3 x
  25.                 STARTUPINFO si;3 m- G; h/ B" Y
  26. : }+ }! Y9 [' `* A0 M
  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
    ( U: K, x! E) c1 d$ ~, r' q
  28.                 PROCESS_INFORMATION pi;1 _- f6 X' R. S: f1 Z0 p
  29. : P  Z& f! Z9 e1 p# ]+ g
  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
    $ l. j, X( ~2 _1 X) V6 [1 X
  31.                 DEBUG_EVENT dbge;
    8 f8 {, u  n; U1 n' m' N
  32. 5 n) x  T$ z" U8 X
  33.                 //Commandline that will used at CreateProcess4 b, s- H  M/ B- R6 [. `
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    3 D. C" @+ }* _2 z% p
  35. ' r: r3 M  U6 n) V- J$ O5 V
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    3 ?) }7 L+ l$ ~3 |$ [7 ?9 q) J
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    7 [$ M3 h+ m" ~9 M
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    ' i- N2 l0 L1 L4 [
  39. ; S0 ]' i1 H; A  v6 i6 y
  40. 3 Y: J. f; _2 x. k! [( w

  41. ; Y% z+ Q; U$ J( \
  42.                 //Start DekaronServer.exe
    5 _0 D9 d1 n* J+ n
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx# z2 x; [8 F" }& K
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)& M4 z0 ~1 \. I- c4 Q
  45.                         szCmdline,        // Command line
    ' c" o: R1 n& a$ k$ e5 J+ b
  46.                         NULL,           // Process handle not inheritable3 x, b4 L/ ^5 @5 y$ j$ S: l1 J1 V
  47.                         NULL,           // Thread handle not inheritable9 }. B  }  }' O
  48.                         FALSE,          // Set handle inheritance to FALSE
    & U' G* [# j8 a3 j% i4 ^
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx9 o0 A9 V  f: a2 t
  50.                         NULL,           // Use parent's environment block( D! k* u9 i3 n5 G
  51.                         NULL,           // Use parent's starting directory
    3 A' S* n* |. ~/ u
  52.                         &si,            // Pointer to STARTUPINFO structure. Q1 n3 `6 Y4 ?% O& o" ]
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure1 ?/ D/ j- f& C
  54.                 ) 4 N7 ]0 q# O. K5 y; J: s* p  ^) S
  55.                 {
    0 g! j- h/ h' l7 r( T5 L, k
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );: K5 c1 U& U- f2 @  D; {
  57.                         return 0;1 _$ J( j6 [% `+ ]# ?" g
  58.                 }! t+ i6 J" p1 k  q  k$ t
  59.                 //Creating Process was sucessful' d! \/ m; f6 s8 q+ @3 @: g
  60.                 else
    ; g, L( k1 |- I8 W9 U, I8 H8 e: l, ~# w
  61.                 {" f( q1 L" s4 O4 K
  62.                         printf("Sucessfully launched DekaronServer.exe\n");% O% K  }- \6 O# _" I/ x

  63.   @6 i: \$ d1 M7 ^5 A
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    & X+ {! I* Q1 d/ ^
  65.                         dbge.dwProcessId = pi.dwProcessId;
    $ ~' s5 C# J9 [3 y
  66.                         dbge.dwProcessId = pi.dwThreadId;" U9 B" A8 ^) y$ i, I6 U
  67. $ f( E$ d5 d7 c
  68.                         while(true) //infinite loop ("Debugger")
    , [% E2 Y8 d4 _) D2 p
  69.                         {: u4 P' [+ Q. ~# l2 p) Y3 ~
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx6 h0 l2 _) c/ K9 b- d

  71. ' l8 I, V/ F* ^6 Y" Y
  72.                                 /*. o# \; X7 [% G) C& i+ l6 }
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码
& z, q7 x6 i* M) }) N
/ X3 x) b! F7 o
( [1 a7 Y0 _% r! r$ [
商业服务端 登录器 网站 出售

16

主题

264

回帖

1420

积分

金牌会员

积分
1420
金钱
1035
贡献
100
注册时间
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

回帖

355

积分

中级会员

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

16

主题

264

回帖

1420

积分

金牌会员

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

3

主题

102

回帖

9192

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-8-17 12:06 , Processed in 0.054862 second(s), 30 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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