How to get user mode total virtual memory?

274 views Asked by At

Asking for Win 7/Win 10 (BIOS/EFI). Ive been researching this and havent been able to find a way, heres the story:

In a program I am using bcdedit /set IncreaseUserVa 3872 to set the user-mode virtual address space to 3872MB, then I restart.

For a unit test I need to check that the change went through using C#. After much research I've tried the following methods:

  • This similar solution here. I am getting an exception: System.AccessViolationException HResult=0x80004003 Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt. I am running VS as admin in the admin account.
  • Using Process.GetCurrentProcess().X(theres a few memory properties) but those arent for the whole system.
  • The BCD reg file in [systemdrive]:/boot contains this data. In regedit HKLM/BCD000000 i cant find anywhere on the web for which reg key to look at
  • Importing Microsoft.VisualBasic and use the ComputerInfo class, this one was promising but im setting to 3872MB (3.78GB) and its coming back as ~3GB

Can anyone help? either find the right reg key in BCD000000 or another way?

1

There are 1 answers

0
Alvaromon On BEST ANSWER

Figured it out.

ComputerInfo myCompInfo = new ComputerInfo(); myCompInfo.TotalVirtualMemory();

BCDEdit does not allow to set virtual address space over 3GB.