From: petr2 on
Helo everyone,

I noticed that the function GlobalMemoryStatusEx returns non precise
results for total memory installed on a machine.

I am using the field ullTotalPhys of structure MEMORYSTATUSEX to
obtain the installed physical memory. I noticed, that on different
machines the results are different. I tested on 5 XP machines in the
office, all running XP SP3 x32, and all machines have 1 GB of RAM
installed. The results are the following:

1071759360
1063325696
1062756352
1062641664
1073274880

How is it possible that all machines have 1 GB of RAM, and results are
not the same for them?

Thanks.

From: Boba on
"petr2" <petr.kizima2(a)gmail.com> wrote in message
news:fcbf3f16-5e18-4b30-825f-a667e6aafdc7(a)j19g2000vbp.googlegroups.com...
> ...
> I am using the field ullTotalPhys of structure MEMORYSTATUSEX to
> obtain the installed physical memory.

ullTotalPhys is "The amount of actual physical memory, in bytes."
not "the installed physical memory". these 2 values may be equal
for identical hw configurations, but are seldom the same for dif-
ferent ones. Boba.


From: petr2 on
On 26 oct, 17:05, "Boba" <B...(a)somewhere.net> wrote:
> "petr2" <petr.kizi...(a)gmail.com> wrote in message
>
> news:fcbf3f16-5e18-4b30-825f-a667e6aafdc7(a)j19g2000vbp.googlegroups.com...
>
> > ...
> > I am using the field ullTotalPhys of structure MEMORYSTATUSEX to
> > obtain the installed physical memory.
>
> ullTotalPhys is "The amount of actual physical memory, in bytes."
> not "the installed physical memory". these 2 values may be equal
> for identical hw configurations, but are seldom the same for dif-
> ferent ones.  Boba.

I see. So what is the best way to get exactly installed memory on a
machine?
From: Boba on
"petr2" <petr.kizima2(a)gmail.com> wrote in message
news:e7d256d7-537a-49aa-8059-86b050b2ac80(a)d21g2000yqn.googlegroups.com...
> ...
> I see. So what is the best way to get exactly installed memory on a
> machine?

it depends on what you need that number for. from programmer's point
of view - this is what this forum is for - you've got it right. from
hardware configuration pov - i'd suggest read bios directly and keep
in mind that there are combinations of chips that even bios will lie
to you about and a special driver might be needed.


From: Pavel Lebedinsky [MSFT] on
> it depends on what you need that number for. from programmer's point
> of view - this is what this forum is for - you've got it right. from
> hardware configuration pov - i'd suggest read bios directly

On Vista SP1 and later you can also use GetPhysicallyInstalledSystemMemory.

--
Pavel Lebedinsky/Windows Kernel Test
This posting is provided "AS IS" with no warranties, and confers no rights.


 |  Next  |  Last
Pages: 1 2
Prev: IEEE1284/USB
Next: what is kernelbase.dll ?