diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2009-02-05 09:12:57 +0200 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2009-02-05 09:12:57 +0200 |
commit | 75905a9afc0ee89954ede7d08af70d1148bf0fd9 (patch) | |
tree | fc562f9890c63c4fa7087537941165393155af14 /src/common | |
parent | Another utime() fix. (diff) | |
download | xz-75905a9afc0ee89954ede7d08af70d1148bf0fd9.tar.xz |
Various code cleanups the the xz command line tool.
It now builds with MinGW.
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/physmem.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/common/physmem.h b/src/common/physmem.h index 04a7ab4b..a0e72c8e 100644 --- a/src/common/physmem.h +++ b/src/common/physmem.h @@ -27,6 +27,13 @@ # include <unistd.h> #endif +#ifdef _WIN32 +# ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0500 +# endif +# include <windows.h> +#endif + /// \brief Get the amount of physical memory in bytes /// @@ -62,6 +69,12 @@ physmem(void) ret = mem; } } + +#elif defined(_WIN32) + MEMORYSTATUSEX meminfo; + meminfo.dwLength = sizeof(meminfo); + if (GlobalMemoryStatusEx(&meminfo)) + ret = meminfo.ullTotalPhys; #endif return ret; |