comparison dep/animia/src/fd/win32.cc @ 169:e44b7c428d7c

dep/animia: add libkvm method (UNTESTED)
author Paper <mrpapersonic@gmail.com>
date Sun, 19 Nov 2023 17:30:38 -0500
parents cdf79282d647
children c413e475f496
comparison
equal deleted inserted replaced
168:79a2a24453fa 169:e44b7c428d7c
1 /*
2 ** win32.cpp
3 ** - provides support for Windows clients
4 **
5 */
6 #include "animia/fd/win32.h" 1 #include "animia/fd/win32.h"
7 #include "animia/util/win32.h" 2 #include "animia/util/win32.h"
8 #include "animia.h" 3 #include "animia.h"
9 4
10 #include <stdexcept> 5 #include <stdexcept>
22 #include <tlhelp32.h> 17 #include <tlhelp32.h>
23 #include <windows.h> 18 #include <windows.h>
24 #include <winternl.h> 19 #include <winternl.h>
25 20
26 /* This file is noticably more complex than Unix and Linux, and that's because 21 /* This file is noticably more complex than Unix and Linux, and that's because
27 there is no "simple" way to get the paths of a file. In fact, this thing requires 22 * there is no "simple" way to get the paths of a file. In fact, this thing requires
28 you to use *internal functions* that can't even be linked to, hence why we have to 23 * you to use *internal functions* that can't even be linked to, hence why we have to
29 use GetProcAddress and such. What a mess. */ 24 * use GetProcAddress and such. What a mess.
25 *
26 * Speaking of which, because this file uses internal functions of the OS, it is not
27 * guaranteed to work far into the future. However, it has worked since NT 6.0 (Vista)
28 * at least, so it's unlikely to be changed much ever.
29 */
30 30
31 /* SystemExtendedHandleInformation is only available in NT 5.1+ (XP and higher) and provides information for 31 /* SystemExtendedHandleInformation is only available in NT 5.1+ (XP and higher) and provides information for
32 32-bit PIDs, unlike SystemHandleInformation */ 32 * 32-bit PIDs, unlike SystemHandleInformation
33 */
33 constexpr SYSTEM_INFORMATION_CLASS SystemExtendedHandleInformation = static_cast<SYSTEM_INFORMATION_CLASS>(0x40); 34 constexpr SYSTEM_INFORMATION_CLASS SystemExtendedHandleInformation = static_cast<SYSTEM_INFORMATION_CLASS>(0x40);
34 35
35 /* more constants not in winternl.h */ 36 /* more constants not in winternl.h */
36 constexpr NTSTATUS STATUS_INFO_LENGTH_MISMATCH = 0xC0000004UL; 37 constexpr NTSTATUS STATUS_INFO_LENGTH_MISMATCH = 0xC0000004UL;
37 38