Skip to content

Commit 9999608

Browse files
enen92kmilos
authored andcommitted
Disable psapi in UWP (unsupported)
1 parent 41f05b1 commit 9999608

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/version.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@
3333
// platform specific support for getLoadedLibraries
3434
#if defined(_WIN32) || defined(__CYGWIN__)
3535
// clang-format off
36+
#include <winapifamily.h>
3637
#include <windows.h>
37-
#include <psapi.h>
38+
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_APP)
39+
#include <psapi.h>
40+
#endif
3841
// clang-format on
3942
#if __LP64__
4043
#ifdef _WIN64
@@ -121,7 +124,8 @@ static std::vector<std::string> getLoadedLibraries() {
121124
std::string path;
122125

123126
#if defined(_WIN32) || defined(__CYGWIN__)
124-
// enumerate loaded libraries and determine path to executable
127+
// enumerate loaded libraries and determine path to executable (unsupported on UWP)
128+
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_APP)
125129
HMODULE handles[200];
126130
DWORD cbNeeded;
127131
if (EnumProcessModules(GetCurrentProcess(), handles, static_cast<DWORD>(std::size(handles)), &cbNeeded)) {
@@ -131,6 +135,7 @@ static std::vector<std::string> getLoadedLibraries() {
131135
pushPath(szFilename, libs, paths);
132136
}
133137
}
138+
#endif
134139
#elif defined(__APPLE__)
135140
// man 3 dyld
136141
uint32_t count = _dyld_image_count();

0 commit comments

Comments
 (0)