On Wed, Jul 22, 2020 at 12:31:06PM +0100, Alex Bennée wrote: > > Stefan Weil <s...@weilnetz.de> writes: > > > Am 22.07.20 um 12:32 schrieb 罗勇刚(Yonggang Luo): > > > >> I would suggest use loadLibrary to retrieve the function, if not > >> available, then return 0 (For Win Xp and Vista); > > > > > > Maybe using GlobalMemoryStatusEx is a better alternative. It is > > available since XP. > > I would welcome an alternative patch. I have no way to test if it works > anyway.
Something like this should work: LPMEMORYSTATUSEX info = { .dwLength = sizeof(LPMEMORYSTATUSEX), }; if (!GlobalMemoryStatusEx(&info)) { ...error report... } return info.ullTotalPhys; (or ullAvailPhys for current free memory) Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|