【问题标题】:How to get user mode total virtual memory?如何获取用户模式总虚拟内存?
【发布时间】:2018-08-18 10:30:48
【问题描述】:

要求 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. 我在管理员帐户中以管理员身份运行 VS。
  • 使用Process.GetCurrentProcess().X(有一些内存属性),但这些不适用于整个系统。
  • [systemdrive]:/boot 中的 BCD reg 文件包含此数据。在 regedit HKLM/BCD000000 中,我无法在网络上的任何地方找到要查看的 reg 密钥
  • 导入 Microsoft.VisualBasic 并使用 ComputerInfo 类,这个很有希望,但我设置为 3872MB (3.78GB) 并且它会恢复为 ~3GB

有人可以帮忙吗?在 BCD000000 或其他方式中找到正确的 reg 密钥?

【问题讨论】:

    标签: c# virtual-address-space bcdedit bcdstore


    【解决方案1】:

    想通了。

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

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

    【讨论】:

      猜你喜欢
      • 2014-06-17
      • 1970-01-01
      • 2020-10-15
      • 2011-04-13
      • 2017-12-29
      • 2017-11-20
      • 1970-01-01
      • 2016-09-12
      • 1970-01-01
      相关资源
      最近更新 更多