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

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

[复制链接]

157

主题

361

回帖

6695

积分

管理员

积分
6695
金钱
1935
贡献
4242
注册时间
2023-11-3
QQ
发表于 2023-12-9 17:54:37 | 显示全部楼层 |阅读模式
SourceCode_Win7DKLauncher.txt (3.77 KB, 下载次数: 0, 售价: 5 贡献)
! |6 h( k5 P# z
* |+ w0 n3 _( S  l  s, X% p) n虽然很多朋友有了成品的工具,但是我发的是源代码。。。需要的可以拿去研究研究。。$ l: I, X& j  w0 w! ^  w% p
4 X$ g/ D8 V5 V, @  `& x
  1. // Win7_DKLauncher_v1.0 : 定义控制台应用程序的入口点。% x# X! T5 n4 w
  2. //: t$ j+ ]. v0 i& m5 `% v* g
  3. 3 O  {1 L3 x. R+ k
  4. #include "stdafx.h"' f7 E. M  `0 n! f# H
  5. #include <iostream>
    ' t; v1 f% ?8 J/ x+ H2 f
  6. #include <Windows.h>
    7 N5 H; n& w& ?+ q- _, [6 W* i5 F
  7. #include <io.h>
    ! o5 K* \# R7 q* v4 I
  8. . u& @+ t0 `- w9 l* M& @

  9. ; i2 E% {# Y+ t
  10. int _tmain(int argc, _TCHAR* argv[])
    2 L8 m4 K" n1 Z5 N! h) Z3 n
  11. {$ j- w: T! l& O5 J
  12.         printf("Dekaron-Server Launcher by Toasty\n");
    - ?) R+ V, O1 E* ^) j
  13. 7 Y% N. Z) s* X0 E; x6 W
  14.         //查看文件“DekaronServer.exe”是否存在: J: \+ a  d$ S0 `
  15.         if(_access("DekaronServer.exe", 0) == -1)
    . p5 O, k2 l  ^3 L
  16.         {' S; ?9 E0 E  }1 n& f
  17.                 printf("DekaronServer.exe not found!\n");* X  M' g+ n7 Y# _0 Y
  18.                 printf("Program will close in 5seconds\n");0 Q# d" f# x& k; t9 J" g+ @
  19.                 Sleep(5000);
    - u( h$ h: V9 F8 E# G) @% C
  20.         }$ a% [3 J" r  e$ a, w& O
  21.         else
    0 M( C7 W. j3 O* o5 U6 }6 _
  22.         {
    * y4 e- z8 Y7 A/ F8 t0 X) x) v) h
  23.                 / ]/ ^* W1 e: n2 U1 X0 i
  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).aspx9 o% ^7 C: C5 @
  25.                 STARTUPINFO si;
    7 x! K  {( Y5 y" F- J

  26. 1 O1 ?; |3 |. h. 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/ F, u) ]  ?1 Z$ L! g
  28.                 PROCESS_INFORMATION pi;2 ?6 a- H6 C$ a% ^0 ]" c  e
  29. , @) X/ M8 U( s
  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, k0 C7 f& m' R  t3 j1 Q, D# @; Z
  31.                 DEBUG_EVENT dbge;* q0 q- K, h: O9 J) j6 u6 X8 E

  32. * `' C0 n- t7 F
  33.                 //Commandline that will used at CreateProcess1 n% q* @# p; a4 r1 ~/ n! y
  34.                 LPTSTR szCmdline = _tcsdup(TEXT("DekaronServer.exe"));
    + j+ i% [$ c! x8 }7 W

  35. + ~4 c# {4 }2 E- U2 r
  36.                 ZeroMemory( &si, sizeof(si) ); //Set memory of the startupinfo structure to Zero (because no initialization was made)
    # E' y3 c# N4 o5 S9 Z
  37.                 si.cb = sizeof(si); //Size of the Structure (see msdn), q% G) k* O$ L! |8 l- `
  38.                 ZeroMemory( &pi, sizeof(pi) ); //Set memory of the process_information structure to Zero (because no initialization was made)
    1 `' o" ]$ g- H3 ?8 ?

  39. 4 H0 R9 f" k( O: \; f* \* g, G2 q- M
  40. 4 u3 s" V) Y( O+ ?* O3 x

  41. 6 `! Q$ g1 ~) H2 m: C& X4 A4 S. o7 U- H
  42.                 //Start DekaronServer.exe
    # m: I: Y" N4 j4 ?! T, u% d$ l
  43.                 //More info fore CreateProcess function at: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
    * o; Y$ D# n  q+ P- e# K
  44.                 if( !CreateProcess( NULL,   // No module name (use command line)
    7 G, b0 h7 G6 w, C7 e0 ]+ P
  45.                         szCmdline,        // Command line8 Q0 Q0 c7 t' s7 ?7 h; P
  46.                         NULL,           // Process handle not inheritable
    : n9 m! R+ K3 C! [( T( ]  C
  47.                         NULL,           // Thread handle not inheritable9 O8 z! J$ c+ c; v/ t
  48.                         FALSE,          // Set handle inheritance to FALSE
    0 Q' ?, ~$ p# W1 U6 \; g( N
  49.                         DEBUG_PROCESS,  // Enables Debugging for the started Process http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx( u) P6 r  _2 N
  50.                         NULL,           // Use parent's environment block8 `  w8 c$ q" X: M9 q
  51.                         NULL,           // Use parent's starting directory 1 m2 T( V  h% m1 B& h4 @
  52.                         &si,            // Pointer to STARTUPINFO structure
    3 ?( j0 k' V" O
  53.                         &pi )           // Pointer to PROCESS_INFORMATION structure
    , ?' Y3 T) M# t$ A
  54.                 ) 8 B+ w4 S! z3 `$ z' p/ `8 ]
  55.                 {
      o& v: B6 ~! g. o! f
  56.                         printf( "CreateProcess failed (%d).\n", GetLastError() );# S) R: J$ ~  ^9 S  p! o2 K4 n
  57.                         return 0;
    8 l3 M  j- b+ J& `! r0 I
  58.                 }
    4 C& [6 T( R6 l2 i% E# a* L
  59.                 //Creating Process was sucessful0 Q# c9 r9 \; v  Z& J$ g! i/ m
  60.                 else
    1 o: r) R6 M% h! Y
  61.                 {, Y/ f) Q- l4 Y3 e- ^" C
  62.                         printf("Sucessfully launched DekaronServer.exe\n");
    & a6 L; `4 s, N4 E$ F4 ?$ [
  63. ; i* K6 F4 f  ]1 S( G9 T
  64.                         //Write ProcessId and ThreadId to the DEBUG_EVENT structure
    + T' L$ Z! m9 S  Y. o
  65.                         dbge.dwProcessId = pi.dwProcessId;
    9 c  h( i. K1 f* A# z1 `1 \& C
  66.                         dbge.dwProcessId = pi.dwThreadId;
    + N$ x2 U9 W5 l  r; U3 ^8 c
  67. ' E: v1 J' L2 @- h
  68.                         while(true) //infinite loop ("Debugger")
    7 `" p% C! j6 d5 x  x
  69.                         {$ k( |2 h1 y# d( |' l6 D/ }
  70.                                 WaitForDebugEvent(&dbge, INFINITE); //Wait for an debugevent to occur http://msdn.microsoft.com/en-us/library/windows/desktop/ms681423(v=vs.85).aspx8 A7 d1 \7 E- W% O! p5 c$ E3 Q  j
  71. . Y, e: U: f: I  L% |5 d6 P
  72.                                 /*7 u5 t3 f& z3 C9 f# y7 P
  73. <blockquote>通常,您必须在此处处理不同的调试事件(这些事件被写入dbge.dwDebugEventCode),
复制代码

, m4 `0 [* A7 P; B
  F0 |% P4 f4 U+ H3 N0 x  z2 O8 P" _4 P
商业服务端 登录器 网站 出售

15

主题

256

回帖

1265

积分

金牌会员

积分
1265
金钱
869
贡献
120
注册时间
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

主题

256

回帖

1265

积分

金牌会员

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

3

主题

102

回帖

6421

积分

论坛元老

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

本版积分规则


Archiver|小黑屋|EGameol

GMT+8, 2026-2-10 10:12 , Processed in 0.071903 second(s), 27 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

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