From: Fritz on
I want to programmatically determine if the /3GB is active in the
boot.ini (and warn my users if not when my app starts). My best plan
so far is to search for /3GB in the boot.ini file. Obviously this has
flaws. They may not have rebooted or have choosen an alternate
configuration.

Ideally I an looking for some .NET or W32 API call that indicates the
switch is in effect. Thanks in advance for any suggestions.

- Fritz
From: Jeroen Mostert on
Fritz wrote:
> I want to programmatically determine if the /3GB is active in the
> boot.ini (and warn my users if not when my app starts). My best plan
> so far is to search for /3GB in the boot.ini file. Obviously this has
> flaws. They may not have rebooted or have choosen an alternate
> configuration.
>
> Ideally I an looking for some .NET or W32 API call that indicates the
> switch is in effect. Thanks in advance for any suggestions.
>
Use WMI to access Win32_OperatingSystem.MaxProcessMemorySize.

Alternatively, P/Invoke to GlobalMemoryStatusEx() and check the
ulTotalVirtual member of the MEMORYSTATUSEX structure.

--
J.
From: Ben Voigt [C++ MVP] on
Jeroen Mostert wrote:
> Fritz wrote:
>> I want to programmatically determine if the /3GB is active in the
>> boot.ini (and warn my users if not when my app starts). My best plan
>> so far is to search for /3GB in the boot.ini file. Obviously this has
>> flaws. They may not have rebooted or have choosen an alternate
>> configuration.
>>
>> Ideally I an looking for some .NET or W32 API call that indicates the
>> switch is in effect. Thanks in advance for any suggestions.
>>
> Use WMI to access Win32_OperatingSystem.MaxProcessMemorySize.
>
> Alternatively, P/Invoke to GlobalMemoryStatusEx() and check the
> ulTotalVirtual member of the MEMORYSTATUSEX structure.

Also note that WOW64 gives the full 4GB of virtual memory address space to
the user process, no need to reserve any for the kernel because it is aware
of 64-bit addresses.