Mercurial > minori
comparison dep/animia/src/fd/win32.cc @ 202:71832ffe425a
animia: re-add kvm fd source
this is all being merged from my wildly out-of-date laptop. SORRY!
in other news, I edited the CI file to install the wayland client
as well, so the linux CI build might finally get wayland stuff.
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Tue, 02 Jan 2024 06:05:06 -0500 |
parents | bc1ae1810855 |
children |
comparison
equal
deleted
inserted
replaced
201:8f6f8dd2eb23 | 202:71832ffe425a |
---|---|
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 */ |
34 constexpr SYSTEM_INFORMATION_CLASS SystemExtendedHandleInformation = static_cast<SYSTEM_INFORMATION_CLASS>(0x40); | 34 constexpr SYSTEM_INFORMATION_CLASS SystemExtendedHandleInformation = static_cast<SYSTEM_INFORMATION_CLASS>(0x40); |
35 | |
36 /* more constants not in winternl.h */ | |
37 constexpr NTSTATUS STATUS_INFO_LENGTH_MISMATCH = 0xC0000004UL; | 35 constexpr NTSTATUS STATUS_INFO_LENGTH_MISMATCH = 0xC0000004UL; |
38 | 36 |
39 /* this is filled in at runtime because it's not guaranteed to be (and isn't) | 37 /* this is filled in at runtime because it's not guaranteed to be (and isn't) |
40 constant between different versions of Windows */ | 38 constant between different versions of Windows */ |
41 static unsigned short file_type_index = 0; | 39 static unsigned short file_type_index = 0; |
172 return false; | 170 return false; |
173 | 171 |
174 return true; | 172 return true; |
175 } | 173 } |
176 | 174 |
177 bool Win32FdTools::EnumerateOpenProcesses(process_proc_t process_proc) { | 175 bool EnumerateOpenProcesses(process_proc_t process_proc) { |
178 HANDLE hProcessSnap = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); | 176 HANDLE hProcessSnap = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); |
179 if (hProcessSnap == INVALID_HANDLE_VALUE) | 177 if (hProcessSnap == INVALID_HANDLE_VALUE) |
180 return false; | 178 return false; |
181 | 179 |
182 PROCESSENTRY32 pe32; | 180 PROCESSENTRY32 pe32; |
196 | 194 |
197 return true; | 195 return true; |
198 } | 196 } |
199 | 197 |
200 /* this could be changed to being a callback, but... I'm too lazy right now :) */ | 198 /* this could be changed to being a callback, but... I'm too lazy right now :) */ |
201 bool Win32FdTools::EnumerateOpenFiles(const std::set<pid_t>& pids, open_file_proc_t open_file_proc) { | 199 bool EnumerateOpenFiles(const std::set<pid_t>& pids, open_file_proc_t open_file_proc) { |
202 if (!open_file_proc) | 200 if (!open_file_proc) |
203 return false; | 201 return false; |
204 | 202 |
205 std::unordered_map<pid_t, Handle> proc_handles; | 203 std::unordered_map<pid_t, Handle> proc_handles; |
206 | 204 |