检查句柄是否属于当前进程?

发布于 2024-08-05 18:25:08 字数 40 浏览 2 评论 0原文

是否有任何 Win32 API 可以检查给定句柄是否属于当前进程?

Is there any Win32 API to check if a given handle belongs to the current process?

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

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

发布评论

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

评论(2

∞觅青森が 2024-08-12 18:25:08

从窗口句柄中,您可以使用 GetWindowThreadProcessId 函数 获取进程 ID。
从进程句柄中,您可以使用 GetProcessId 函数获取 id。

我不知道从其他句柄获取进程句柄有多容易。但我相信这与 内核对象有关 枚举。

From a window handle you can use GetWindowThreadProcessId Function to get process id.
From a process handle you get the id with GetProcessId Function.

I don't know how easy is to get a process handle from some other handle. But I believe it'll have to do with kernel objects enumeration.

深海夜未眠 2024-08-12 18:25:08

一个句柄可以“属于”多个进程(子进程中继承的句柄等)

A handle can "belong" to more than one process (Inherited handles in child process etc)

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