Skip to content

Commit

Permalink
Disable psapi in UWP (unsupported)
Browse files Browse the repository at this point in the history
(cherry picked from commit 9999608)
  • Loading branch information
enen92 authored and mergify[bot] committed Jun 18, 2024
1 parent 4b1ce62 commit e04f93b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@
// platform specific support for getLoadedLibraries
#if defined(_WIN32) || defined(__CYGWIN__)
// clang-format off
#include <winapifamily.h>
#include <windows.h>
#include <psapi.h>
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_APP)
#include <psapi.h>
#endif
// clang-format on
#if __LP64__
#ifdef _WIN64
Expand Down Expand Up @@ -122,7 +125,8 @@ static std::vector<std::string> getLoadedLibraries() {
std::string path;

#if defined(_WIN32) || defined(__CYGWIN__)
// enumerate loaded libraries and determine path to executable
// enumerate loaded libraries and determine path to executable (unsupported on UWP)
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_APP)
HMODULE handles[200];
DWORD cbNeeded;
if (EnumProcessModules(GetCurrentProcess(), handles, static_cast<DWORD>(std::size(handles)), &cbNeeded)) {
Expand All @@ -132,6 +136,7 @@ static std::vector<std::string> getLoadedLibraries() {
pushPath(szFilename, libs, paths);
}
}
#endif
#elif defined(__APPLE__)
// man 3 dyld
uint32_t count = _dyld_image_count();
Expand Down

0 comments on commit e04f93b

Please sign in to comment.