aboutsummaryrefslogtreecommitdiff
path: root/src/common/physmem.h
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2009-02-05 09:12:57 +0200
committerLasse Collin <lasse.collin@tukaani.org>2009-02-05 09:12:57 +0200
commit75905a9afc0ee89954ede7d08af70d1148bf0fd9 (patch)
treefc562f9890c63c4fa7087537941165393155af14 /src/common/physmem.h
parentAnother utime() fix. (diff)
downloadxz-75905a9afc0ee89954ede7d08af70d1148bf0fd9.tar.xz
Various code cleanups the the xz command line tool.
It now builds with MinGW.
Diffstat (limited to '')
-rw-r--r--src/common/physmem.h13
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;