代码之家  ›  专栏  ›  技术社区  ›  Alvaromon

如何获取用户模式的总虚拟内存?

  •  -1
  • Alvaromon  · 技术社区  · 8 年前

    询问Win 7/Win 10(BIOS/EFI)。我一直在研究这个问题,但一直没有找到解决办法,故事如下:

    在我使用的程序中 bcdedit /set IncreaseUserVa 3872 要将用户模式虚拟地址空间设置为3872MB,请重新启动。

    对于单元测试,我需要使用C#检查更改是否完成。经过大量研究,我尝试了以下方法:

    • This similar solution here 。我遇到一个例外: System.AccessViolationException HResult=0x80004003 Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt. 我在admin帐户中以admin身份运行VS。
    • 使用 Process.GetCurrentProcess().X (有一些内存属性)但这些属性不适用于整个系统。
    • [systemdrive]:/boot中的BCD reg文件包含此数据。在regedit HKLM/BCD000000中,我在web上找不到要查看的注册表项
    • 正在导入Microsoft。VisualBasic并使用ComputerInfo类,这一类很有希望,但im设置为3872MB(3.78GB),其恢复为3GB

    有人能帮忙吗?在BCD000000或其他方式中找到正确的注册表项?

    1 回复  |  直到 8 年前
        1
  •  0
  •   Alvaromon    8 年前

    找到了答案。

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

    BCDEdit不允许设置超过3GB的虚拟地址空间。

    推荐文章