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

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

[复制链接]

154

主题

343

回帖

5865

积分

管理员

积分
5865
金钱
1837
贡献
3531
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) - I8 [4 g  t9 j# P7 O. l% [0 b9 ~

! x: B* ]  g3 e: L6 P: y虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。. M1 w2 X3 v5 O) M. Y* W) g/ F
, S. K' t* P& R  s8 k
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。: A6 m# ]1 X  ^' j: a
  2. //8 \8 ^+ @, Y4 S8 }- }

  3. ; L% \8 o) o% b
  4. #include "stdafx.h"
    0 ]5 r) t0 L  U" O& e
  5. #include <iostream>5 U1 S( x; q) X. @
  6. #include <Windows.h>
    5 d: g8 x% B. n' \/ B- j# k: v5 _) ?
  7. #include <io.h>6 \' J: k8 g2 _4 H3 w6 q4 L& k

  8. 9 z- T8 V8 l) ]$ k% G( O
  9. 2 l, `3 {; V; W, x- T2 W  F! P
  10. int _tmain(int argc, _TCHAR* argv[])! K5 Y! O7 m" U; ]
  11. {+ j3 G/ f* z8 F" a+ A6 s* {
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    ; ^# R: L$ t+ k/ p1 p8 k# p+ L
  13. . c4 L( \8 g" m, D
  14.         //查看文件“DekaronServer.exe”是否存在  ]& J' E/ _0 P
  15.         if(_access("DekaronServer.exe", 0) == -1)
    4 P' |! G7 q' M4 p: W0 z
  16.         {
    & o, t* Y* e0 w3 A9 _
  17.                 printf("DekaronServer.exe not found!\n");
    2 [5 H# T/ f) Q5 `3 Z& r
  18.                 printf("Program will close in 5seconds\n");
    * T/ l: k$ Q" r2 O" {
  19.                 Sleep(5000);
    8 t! g9 x- W1 i. D9 _+ @7 Q1 `
  20.         }
    9 n3 t7 d) }6 \: f- p) M
  21.         else
    " a2 Y" z7 K) d4 K+ X: n: p
  22.         {. a7 q3 t6 i& e$ N' W  ?6 H
  23.                
    ' o! f6 H( z  F/ [
  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, C# E' F8 T. _6 H/ B
  25.                 STARTUPINFO si;
    5 ^2 c! j; `% }3 D/ z

  26. / z% Y& M9 ]; _3 A3 D
  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
    / L2 j! j) w( e2 i( E# y2 P7 M
  28.                 PROCESS_INFORMATION pi;4 P2 G' T  F* p# C7 Y
  29. + D; j  A8 ~' `. 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: S3 R9 Z8 p8 r: E: T- _9 L
  31.                 DEBUG_EVENT dbge;+ K5 Q0 v5 F. v% c: G  w9 ?0 J  ^

  32. ; s& z1 f7 k. ^9 }9 ~  N, D4 m
  33.                 //Commandline that will used at CreateProcess" K& A: M3 [- w) z7 z8 l
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));1 }1 ]! J, J1 a( h; m! D* f" ~
  35. 0 n# m' b2 m" p) x/ C& \
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)% H0 K; w) b3 H9 S+ i1 ~
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    / l3 p0 Z# L5 q. j0 j
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    0 X1 R  t7 l, B( z9 u$ ^6 Y

  39. 6 l9 A# J7 ~" |& T- v0 d9 }

  40. 5 C" N# }0 u- s1 R( @! T/ j

  41. : Z; f" `3 E; v7 C& J- K( \: ^4 ?+ p
  42.                 //Start DekaronServer.exe
    4 N  r  G3 s' q1 N) C+ O
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    + {! t- ~3 `  w, _& X" t$ U7 j- w8 y7 A
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    7 _* H8 y7 e7 E+ s+ k; ]7 V7 D
  45.                         szCmdline,        // Command line4 }! A/ b* l" R" W+ e
  46.                         NULL,           // Process handle not inheritable4 a7 L: o, C+ G  d
  47.                         NULL,           // Thread handle not inheritable
    0 p% z- m( {8 F& s+ Q
  48.                         FALSE,          // Set handle inheritance to FALSE$ b: J. N& D, s# W5 O) T9 R5 ~0 f
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    9 n& y# j+ }( c
  50.                         NULL,           // Use parent's environment block
    ' K* B- O' g: D2 m) I* r- H% O
  51.                         NULL,           // Use parent's starting directory 7 ~. b0 F4 Q) c6 s3 u
  52.                         &si,            // Pointer to STARTUPINFO structure
    : C: v9 C- r# f8 k: e
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure. o" ?; f! H( E, e9 }, J
  54.                 ) 4 W. \$ ?' F. z0 C: T
  55.                 {8 U4 _# g# U* i* O, Y, ?5 ~" s
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );, m. O. n" Y" Z) @& M0 h) m
  57.                         return 0;* k( J1 i1 X5 O2 F; ]: M- R3 Y$ i
  58.                 }
    2 r) P+ V- }" K% x" F; I6 J. _
  59.                 //Creating Process was sucessful
    & e; l4 Z% v; ], }
  60.                 else/ J( q0 e4 `4 a3 D5 c# c
  61.                 {: @. d5 J1 o. U' a" k$ @
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    $ |2 Y% p6 B3 n( G2 w. Z" q

  63. ) z: i& V* C* L
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure7 j6 G7 O- I/ v9 P
  65.                         dbge.dwProcessId = pi.dwProcessId;
    4 f# N2 n6 q1 M6 s1 C
  66.                         dbge.dwProcessId = pi.dwThreadId;5 |9 U  B  @/ O7 I* U: j! v4 g
  67. - E& H: O$ D. n1 ?8 J: [0 W/ R" Z
  68.                         while(true) //infinite loop ("Debugger")
    5 O$ E& J6 j5 ~! R* K+ H5 Y. h! ^
  69.                         {
    ) a6 ?/ T6 W8 G
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx
    3 i& Z0 H' @8 P# f
  71. 9 w; g) [! w! G$ f
  72.                                 /*
    ) J; v! R( n4 |1 L$ b
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

6 T2 P( W7 c& Q/ X0 f* Y+ c8 F# r* R3 o

+ @4 c. O7 g% J( o$ w
商业服务端 登录器 网站 出售

13

主题

251

回帖

1258

积分

金牌会员

积分
1258
金钱
802
贡献
187
注册时间
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

回帖

1258

积分

金牌会员

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

3

主题

99

回帖

5473

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2025-12-14 15:54 , Processed in 0.068528 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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