How to detect win32 process creation/termination in c++(如何在 C++ 中检测 win32 进程的创建/终止)
问题描述
我知道要接收有关 Win32 进程创建或终止的通知,我们可能会使用 API PsSetCreateProcessNotifyRoutine()
实现 NT 内核模式驱动程序,该 API 提供注册系统范围回调函数的能力,该函数是每次新进程启动、退出或终止时由操作系统调用.
I know that to receive notifications about Win32 process creation or termination we might implement a NT kernel-mode driver using the APIs PsSetCreateProcessNotifyRoutine()
that offers the ability to register system-wide callback function which is called by OS each time when a new process starts, exits or is terminated.
这是否可以不创建 NT 内核模式驱动程序,仅使用使用 c++ 的 Win32 API 函数?当然不是使用无限循环查询活动进程列表的基本解决方案.
Is this possible without creating a NT kernel-mode driver, only using Win32 API functions using c++? Not using the basic solution of a infinite cycle querying the list of active process of course.
是否有任何库或 win32 API 提供相同的功能(系统范围的回调、异步事件)?
Is there any library or win32 API that provides the same functionality (system wide callback, asynchronous events)?
推荐答案
我唯一能想到的就是 WMI,不确定它是否提供进程创建回调,但可能值得研究.
The only thing I could think of is WMI, not sure if it provides a process creation callback, but it might be worth looking into.
这篇关于如何在 C++ 中检测 win32 进程的创建/终止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 C++ 中检测 win32 进程的创建/终止


基础教程推荐
- 管理共享内存应该分配多少内存?(助推) 2022-12-07
- 如何在不破坏 vtbl 的情况下做相当于 memset(this, ...) 的操作? 2022-01-01
- 使用从字符串中提取的参数调用函数 2022-01-01
- 如何“在 Finder 中显示"或“在资源管理器中显 2021-01-01
- 为什么语句不能出现在命名空间范围内? 2021-01-01
- 如何使图像调整大小以在 Qt 中缩放? 2021-01-01
- Windows Media Foundation 录制音频 2021-01-01
- 从 std::cin 读取密码 2021-01-01
- 为 C/C++ 中的项目的 makefile 生成依赖项 2022-01-01
- 在 C++ 中循环遍历所有 Lua 全局变量 2021-01-01