diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2023-09-22 21:12:54 +0300 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2023-09-24 17:48:13 +0300 |
commit | e582f8e0fee46e7cd967f42f465d6bb608b73bc1 (patch) | |
tree | 2161d6a1c7ca2f3d8e36c67c309a278084b6876e /src/common/tuklib_physmem.c | |
parent | sysdefs.h: Update the comment about __USE_MINGW_ANSI_STDIO. (diff) | |
download | xz-e582f8e0fee46e7cd967f42f465d6bb608b73bc1.tar.xz |
tuklib_physmem: Comment out support for Windows versions older than 2000.
Diffstat (limited to '')
-rw-r--r-- | src/common/tuklib_physmem.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/common/tuklib_physmem.c b/src/common/tuklib_physmem.c index 69f6fd4c..779eb0a1 100644 --- a/src/common/tuklib_physmem.c +++ b/src/common/tuklib_physmem.c @@ -73,23 +73,20 @@ #endif -// With GCC >= 8.1 with -Wextra and Clang >= 13 with -Wcast-function-type -// will warn about the Windows-specific code. -#if defined(__has_warning) -# if __has_warning("-Wcast-function-type") -# define CAN_DISABLE_WCAST_FUNCTION_TYPE 1 -# endif -#elif TUKLIB_GNUC_REQ(8,1) -# define CAN_DISABLE_WCAST_FUNCTION_TYPE 1 -#endif - - extern uint64_t tuklib_physmem(void) { uint64_t ret = 0; #if defined(_WIN32) || defined(__CYGWIN__) + // This requires Windows 2000 or later. + MEMORYSTATUSEX meminfo; + meminfo.dwLength = sizeof(meminfo); + if (GlobalMemoryStatusEx(&meminfo)) + ret = meminfo.ullTotalPhys; + +/* + // Old version that is compatible with even Win95: if ((GetVersion() & 0xFF) >= 5) { // Windows 2000 and later have GlobalMemoryStatusEx() which // supports reporting values greater than 4 GiB. To keep the @@ -125,6 +122,7 @@ tuklib_physmem(void) GlobalMemoryStatus(&meminfo); ret = meminfo.dwTotalPhys; } +*/ #elif defined(__OS2__) unsigned long mem; |