PsSetCreateProcessNotifyRoutineEx vs PsSetCreateProcessNotifyRoutine

时间:2014-10-09 21:09:29

标签: windows kernel

PsSetCreateProcessNotifyRoutineEx成功返回,但无论何时创建新进程,都不会调用回调函数CreateProcessNotifyEX。另一方面,如果我使用PsSetCreateProcessNotifyRoutine,则会调用回调函数CreateProcessNotify。为什么当我用PsSetCreateProcessNotifyRoutineEx替换PsSetCreateProcessNotifyRoutine而用CreateProcessNotifyEx替换CreateProcessNotify时,操作系统似乎在创建新进程时不会通知我的内核驱动程序?

此代码现在基于我现在回家的记忆。

**Class.cpp:**    
Class::Class{   
//Other Person's Code    
PsSetCreateProcessNotifyRoutineEx(CreateProcessNotifyEX, FALSE);    
//More of Other People's Code    
}


void Class::(PEPROCESS Process, HANDLE ProcessID, PPS_CREATE_INFO CreateInfo){
//Code that never occurs (breakpoint doesn't arrive)
}

**Class.h**    
(Library is included because code originally used PsSetCreateProcessNotifyRoutine)    

void CreateProcessNotifyEx(PEPROCESS Process, HANDLE ProcessID, PPS_CREATE_INFO CreateInfo);    

1 个答案:

答案 0 :(得分:4)

PsSetCreateProcessNotifyRoutineEx的文档指出包含回调的模块必须在PE头中设置IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY标志。没有该标志将导致API返回STATUS_ACCESS_DENIED

IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY

  

强制执行代码完整性检查。如果您设置此标志和一个部分   仅包含未初始化的数据,设置PointerToRawData成员   该部分的IMAGE_SECTION_HEADER为零;否则,图像   将无法加载,因为无法验证数字签名。

使用链接器的/INTEGRITYCHECK开关启用。