如何以编程方式确定(Windows)操作系统的最大用户模式空间?

发布于 2024-07-20 05:36:24 字数 169 浏览 5 评论 0 原文

我正在编写一个诊断应用程序,它需要记录用户设置为用户模式空间(又名用户模式虚拟地址空间)的内容 又名 WinXP 中的 /3GB 开关或 Vista/Win7 上 bcdedit 中的increaseuserva 开关。

C++ 或 C++/CLI 都可以。

有任何想法吗 ?

I'm writing a diagnostic app which needs to log what the user has set as his user-mode space a.k.a. user-mode virtual address space
a.k.a. the /3GB switch in WinXP or the increaseuserva switch in bcdedit on Vista/Win7.

Either of C++ or C++/CLI will do.

Any ideas ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寒尘 2024-07-27 05:36:24

GlobalMemoryStatusEx 将为您提供 MEMORYSTATUSEX 结构与 ullTotalVirtual

调用进程的虚拟地址空间的用户模式部分的大小(以字节为单位)。 该值取决于进程类型、处理器类型以及操作系统的配置。 例如,对于 x86 处理器上的大多数 32 位进程,该值约为 2 GB;对于在启用了 4 GB 调整的系统上运行的大地址感知的 32 位进程,该值约为 3 GB。

请注意,您必须将 EXE 标记为 LARGEADDRESSAWARE< /a> 以便在您的进程中看到 3GB

我认为还有另一个函数也返回此信息(不 - 不是 GlobalMemoryStatus(已弃用)以及处理器信息 - 但我不记得它是 ATM。

GlobalMemoryStatusEx will give you a MEMORYSTATUSEX struct with ullTotalVirtual:

The size of the user-mode portion of the virtual address space of the calling process, in bytes. This value depends on the type of process, the type of processor, and the configuration of the operating system. For example, this value is approximately 2 GB for most 32-bit processes on an x86 processor and approximately 3 GB for 32-bit processes that are large address aware running on a system with 4-gigabyte tuning enabled.

Note that you'd have to mark your EXE as LARGEADDRESSAWARE in order to see 3GB in your process.

I think there's another function that also returns this info (no - not GlobalMemoryStatus which is deprecated) along with processor info - but I can't recall it ATM.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文