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

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

[复制链接]

155

主题

348

回帖

6179

积分

管理员

积分
6179
金钱
1868
贡献
3808
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献) / y8 B- c8 p8 M' I0 }0 j- S
! p% [! u6 e8 }7 K: K  w, \/ d
虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。' s/ Q8 f( o. }1 @; ]

* D/ ?4 @, i3 K" [
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。
    ( K. @! f* _; @: f. b0 n& T
  2. //& G+ M( t4 I1 j# F5 V# J9 R6 }* d+ c

  3. 0 m2 o% M: k5 q; \
  4. #include "stdafx.h"# I$ _7 Z" I3 m" B& @
  5. #include <iostream>
    + h" H5 X1 \+ r, D9 B4 R
  6. #include <Windows.h>5 K. n" A9 ~* |+ S. R- i- V. H
  7. #include <io.h>. c6 p6 X3 u5 L6 n: f

  8. " W6 ?7 z& E- r, J

  9. # n+ G, @( k# n' W, [, q; J
  10. int _tmain(int argc, _TCHAR* argv[])7 S  S) W& @) \% o9 P; h8 r
  11. {
    $ A8 W: C$ C8 C2 M* b
  12.         printf("Dekaron-Server Launcher by Toasty\n");' g" ^# Q7 k' C

  13. 0 \. b" _, @8 I  X& o& V: w6 n2 V
  14.         //查看文件“DekaronServer.exe”是否存在
    ' Y. _5 b: T- }( |8 o
  15.         if(_access("DekaronServer.exe", 0) == -1)
    / `0 O" w/ H7 {( Y
  16.         {' ]! r) ?& m5 C) M/ x) l
  17.                 printf("DekaronServer.exe not found!\n");7 c0 Q! K- r! l' y) N
  18.                 printf("Program will close in 5seconds\n");, |" F1 j: z2 J" [
  19.                 Sleep(5000);1 q" j& Y# O4 P: i$ j9 `1 ]
  20.         }
    ( i, ]) @( ^1 r2 g8 S
  21.         else
    7 l9 _$ d3 y: c4 q6 L
  22.         {7 K. S0 F0 V2 Z1 I
  23.                 / P. Y0 c- h0 c7 c5 u1 e
  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
    5 b4 q# r4 q! @- A1 I2 l# U
  25.                 STARTUPINFO si;
    6 J6 f: L3 e1 ^

  26. ! Q( M4 T5 h4 n- F/ B6 a9 f2 [
  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
    7 i  i1 j# B# l( y& M. R+ E
  28.                 PROCESS_INFORMATION pi;! J  `+ c2 o! m; G: ^
  29. # H( @: j/ [& }) A& U  q
  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).aspx0 N' V* T4 U8 P' F2 l6 Z( y4 j; h
  31.                 DEBUG_EVENT dbge;3 L! O( ^' @( x+ y$ b( Q

  32. 8 [% S9 k' {5 U- Q( X. o
  33.                 //Commandline that will used at CreateProcess
    6 ^1 n! x; `4 t; S1 e- d
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));3 d* D/ G( _. i' a; \

  35. " \3 l3 f; h! c+ x- f
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    ) g% l1 k, }, J% G/ [9 @* I
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn)
    6 y7 }( N4 J( d4 B
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    7 J' m. X4 t* U+ _1 {
  39. 2 F' v# z5 m$ A3 o- T* G5 S

  40. + p& N. j# ]3 z& H5 K
  41. + y  X! g  B9 ^3 @2 w, W
  42.                 //Start DekaronServer.exe 6 G& i8 Z& K! q1 [4 n8 s, n) e
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx5 g& R5 r9 K4 b  n, F" M
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)& I5 D$ O5 Q  a' m: A
  45.                         szCmdline,        // Command line
    0 W8 v" r  S3 _: Y& P2 h4 q8 N, j7 v
  46.                         NULL,           // Process handle not inheritable
    * z! W( ?  g+ B% ~: K
  47.                         NULL,           // Thread handle not inheritable
      \# I6 `$ `/ D
  48.                         FALSE,          // Set handle inheritance to FALSE- K: I7 k' R; `0 k7 V7 O
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
    ' r: U. b- r3 W2 L
  50.                         NULL,           // Use parent's environment block
    7 |1 [: Q$ e9 ~
  51.                         NULL,           // Use parent's starting directory
    ) L& ^5 V) f! T
  52.                         &si,            // Pointer to STARTUPINFO structure
    8 D9 F4 {! H0 _! E/ p$ G
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure6 q( o2 b. V8 e0 l  Z7 T, K* W$ E
  54.                 )
      L' U' }) [" l* Z
  55.                 {
    ) O  d. \$ d: G6 B( c" b) ]
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );& T, T- n5 [, C2 W0 Y# I* ~- g
  57.                         return 0;
    6 F) v+ |5 R9 s: o
  58.                 }
    * ]- z% d- q' O
  59.                 //Creating Process was sucessful
    + J  }0 H" h0 c" P+ T+ F. }
  60.                 else
    4 ^, T) j  ]; B( ~; E3 m5 L5 }! E9 }
  61.                 {
    * U& w) `5 Q# y5 p/ n9 o
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    * [7 l  ?" C  c+ o  \! T

  63. % F; Q8 j  y3 q) p$ L
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure! o2 Y# t# S' [, @
  65.                         dbge.dwProcessId = pi.dwProcessId;
    ! V" n% C. Z8 J  Y* H7 {/ y
  66.                         dbge.dwProcessId = pi.dwThreadId;
    2 K( Z- P. V. d
  67. $ I/ v4 \3 k% h2 f3 _8 @& S" E6 }
  68.                         while(true) //infinite loop ("Debugger")8 n" Q: ?$ q9 v# T- s( k
  69.                         {, ?2 A+ R7 B1 V  s% o# h0 \
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx1 A5 y, Y- c0 j1 B  |, n# `

  71. 1 n$ u+ F/ i4 S1 O9 M% P
  72.                                 /*
    7 M+ w; L8 O: j. h, s" i
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

* M7 b% |- Q' ^7 V0 V$ |6 e2 n; _" Z( T+ x

: A% }. ?" b9 h+ D0 g( X
商业服务端 登录器 网站 出售

13

主题

251

回帖

1245

积分

金牌会员

积分
1245
金钱
816
贡献
160
注册时间
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

回帖

1245

积分

金牌会员

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

3

主题

100

回帖

5721

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-1-2 00:05 , Processed in 0.068056 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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