PDA

View Full Version : Wron result of MEM_TOTALPHYS



NewsArchive
04-17-2009, 01:38 AM
Hi Friedrich,

the line

Set Variable %TEMPSTRING% to FUNCTION:Get System Info(Memory Status) for
"$MEM_TOTALPHYS$"

gives wrong results. On every machine, there is 1MB difference (for
example: 511MB <--> 512 MB). On WinXP32 with 3072MB, the result is just
2047MB.

Can you help, please?

Markus

NewsArchive
04-17-2009, 01:39 AM
Hi Markus,

> the line
>
> Set Variable %TEMPSTRING% to FUNCTION:Get System Info(Memory Status) for
> "$MEM_TOTALPHYS$"
>
> gives wrong results. On every machine, there is 1MB difference (for
> example: 511MB <--> 512 MB). On WinXP32 with 3072MB, the result is just
> 2047MB.
>
> Can you help, please?

Unfortunately, I can't help. FUNCTION:Get System Info(Memory Status) is
a wrapper to the GlobalMemoryStatus Windows API.

http://msdn.microsoft.com/en-us/library/aa366586%28VS.85%29.aspx

"On Intel x86 computers with more than 2 GB and less than 4 GB of memory,
the GlobalMemoryStatus function will always return 2 GB in the dwTotalPhys
member of the MEMORYSTATUS structure."

BTW, on a system with 2GB, the API returns 2,145,480,704. 2,145,480,704 /
1048576 = 2,046.

Friedrich

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

SetupBuilder "point. click. ship"
Create Windows Vista ready installations in minutes

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
04-17-2009, 01:39 AM
Hi Friedrich,

in the MSDN, there is a hint:

[GlobalMemoryStatus can return incorrect information. Use the
GlobalMemoryStatusEx function instead.]

Why don't you use this function on Windows200 or newer systems?

Markus

NewsArchive
04-17-2009, 01:39 AM
Hi Markus,

> in the MSDN, there is a hint:
>
> [GlobalMemoryStatus can return incorrect information. Use the
> GlobalMemoryStatusEx function instead.]
>
> Why don't you use this function on Windows200 or newer systems?

Yes, it should be possible to change the runtime in such a way that the API
is called dynamically on systems that support it. We will definitely add
your suggestion to the wish list for future releases!

Thanks,
Friedrich

NewsArchive
04-17-2009, 03:35 AM
Installer runtime changed in SB7. GlobalMemoryStatusEx is used now with
fall back mechanism to the old API.

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

SetupBuilder "point. click. ship"
Create Windows Vista ready installations in minutes

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
04-18-2009, 01:25 AM
Great! Thank you very much!

Markus Zander