我的 PEB 中的“ConsoleHandle”句柄是什么?

发布于 2025-01-16 21:56:48 字数 699 浏览 2 评论 0原文

我正在深入研究进程的 PEB,并在嵌套的 RTL_USER_PROCESS_PARAMETERS 结构中发现了所谓的 ConsoleHandle HANDLE。到目前为止,我已经将此句柄与标准输入、输出和错误句柄以及控制台 HWND 进行了比较。它与它们都不匹配,我不知道这个 HANDLE 是什么或代表什么。

我还偶然发现所有这些句柄(减去 HWND)都指向 \Devices\ConDrv,所以我也很困惑为什么 CompareObjectHandles()只对 stdout 和 stderr 对返回 true。从我的正常理解来看,这是直观的,但现在我发现 \Devices\ConDrv 是所有这些句柄的真正支持内核对象,我想知道为什么这个函数不更多情况下返回true。

  1. 这个未知的 ConsoleHandle HANDLE 是什么?它是默认的控制台屏幕缓冲区吗?特别是,用这个HANDLE作为参数可以调用哪些函数?
  2. 如果 stdin、stdout、stderr 和这个未知的 ConsoleHandle HANDLE 都由 \Devices\ConDrv 支持,为什么 CompareObjectHandles() 不支持对于它们的任何配对都返回 true 吗?来自内核空间的任何见解将不胜感激。

I'm digging around in my process's PEB and I came across the so-called ConsoleHandle HANDLE in the nested RTL_USER_PROCESS_PARAMETERS struct. So far, I've compared this HANDLE to the standard input, output, and error HANDLEs and the console HWND. It matches none of them and I'm at a loss for what this HANDLE is or represents.

I've also stumbled upon the fact that all these handles (minus the HWND) point to \Devices\ConDrv, so I'm also befuddled as to why CompareObjectHandles() only returns true for the pair of stdout and stderr. This makes intuitive sense from my normal understanding but now that I've found out about \Devices\ConDrv being the true backing kernel object for all these HANDLEs, I'm left wondering why this function doesn't return true in more cases.

  1. What is this unknown ConsoleHandle HANDLE? Is it the default console screen buffer? In particular, what functions can be called with this HANDLE as a parameter?
  2. If stdin, stdout, stderr, and this unknown ConsoleHandle HANDLE are all backed by \Devices\ConDrv, how come CompareObjectHandles() doesn't return true for any pairing of them? Any insight from kernel-land would be appreciated.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文