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 进程的创建/终止


- 从python回调到c++的选项 2022-11-16
- 静态初始化顺序失败 2022-01-01
- C++ 协变模板 2021-01-01
- 一起使用 MPI 和 OpenCV 时出现分段错误 2022-01-01
- STL 中有 dereference_iterator 吗? 2022-01-01
- Stroustrup 的 Simple_window.h 2022-01-01
- 如何对自定义类的向量使用std::find()? 2022-11-07
- 近似搜索的工作原理 2021-01-01
- 与 int by int 相比,为什么执行 float by float 矩阵乘法更快? 2021-01-01
- 使用/clr 时出现 LNK2022 错误 2022-01-01