1 Star 0 Fork 2

Prome/DnfDebug_old1

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
R3_ReadProcess.cpp 2.91 KB
一键复制 编辑 原始数据 按行查看 历史
1114135188 提交于 2019-01-05 16:32 . 修复蓝屏
#include "R3_ReadProcess.h"
NTSTATUS R3_ReadProcess:: R3_ReadProcess_Start(PDRIVER_OBJECT pPDriverObj)
{
PLDR_DATA ldr;
ldr = (PLDR_DATA)pPDriverObj->DriverSection;
ldr->Flags |= 0x20;
if (!NT_SUCCESS(Start_ProcessObProcess())) {
return STATUS_UNSUCCESSFUL;
}
return Start_ThradObProcess();
}
NTSTATUS R3_ReadProcess::Start_ProcessObProcess()
{
NTSTATUS status;
OB_CALLBACK_REGISTRATION obReg;
OB_OPERATION_REGISTRATION opReg;
memset(&obReg, 0, sizeof(obReg));
obReg.Version = ObGetFilterVersion();
obReg.OperationRegistrationCount = 1;
obReg.RegistrationContext = NULL;
RtlInitUnicodeString(&obReg.Altitude, L"25444");
memset(&opReg, 0, sizeof(opReg));
opReg.ObjectType = PsProcessType;
opReg.Operations = OB_OPERATION_HANDLE_CREATE | OB_OPERATION_HANDLE_DUPLICATE;
opReg.PreOperation = (POB_PRE_OPERATION_CALLBACK)preCall;
obReg.OperationRegistration = &opReg;
status = ObRegisterCallbacks(&obReg, &m_ProcessHandle);
return status;
}
NTSTATUS R3_ReadProcess::Start_ThradObProcess()
{
NTSTATUS status;
OB_CALLBACK_REGISTRATION obReg;
OB_OPERATION_REGISTRATION opReg;
memset(&obReg, 0, sizeof(obReg));
obReg.Version = ObGetFilterVersion();
obReg.OperationRegistrationCount = 1;
obReg.RegistrationContext = NULL;
RtlInitUnicodeString(&obReg.Altitude, L"25444");
memset(&opReg, 0, sizeof(opReg));
opReg.ObjectType = PsThreadType;
opReg.Operations = OB_OPERATION_HANDLE_CREATE | OB_OPERATION_HANDLE_DUPLICATE;
opReg.PreOperation = (POB_PRE_OPERATION_CALLBACK)preCall2;
obReg.OperationRegistration = &opReg;
status = ObRegisterCallbacks(&obReg, &m_ThreadHandle);
return status;
}
VOID R3_ReadProcess::UnLoad_R3_ReadProcess()
{
if (m_ProcessHandle) {
ObUnRegisterCallbacks(m_ProcessHandle);
m_ProcessHandle = NULL;
}
if (m_ThreadHandle) {
ObUnRegisterCallbacks(m_ThreadHandle);
m_ThreadHandle = NULL;
}
}
OB_PREOP_CALLBACK_STATUS R3_ReadProcess::preCall(PVOID RegistrationContext, POB_PRE_OPERATION_INFORMATION pOperationInformation)
{
if (strcmp((char *)PsGetProcessImageFileName(IoGetCurrentProcess()),GAME_NAME) == 0 || strcmp((char *)PsGetProcessImageFileName(IoGetCurrentProcess()), GAME_NAME1) == 0)
{
return OB_PREOP_SUCCESS;
}
pOperationInformation->Parameters->CreateHandleInformation.DesiredAccess = PROCESS_ALL_ACCESS;
pOperationInformation->Parameters->CreateHandleInformation.OriginalDesiredAccess = PROCESS_ALL_ACCESS;
return OB_PREOP_SUCCESS;
}
OB_PREOP_CALLBACK_STATUS R3_ReadProcess::preCall2(PVOID RegistrationContext, POB_PRE_OPERATION_INFORMATION pOperationInformation)
{
if (strcmp((char *)PsGetProcessImageFileName(IoGetCurrentProcess()), GAME_NAME) == 0 || strcmp((char *)PsGetProcessImageFileName(IoGetCurrentProcess()), GAME_NAME1) == 0)
{
return OB_PREOP_SUCCESS;
}
pOperationInformation->Parameters->CreateHandleInformation.DesiredAccess = THREAD_ALL_ACCESS;
pOperationInformation->Parameters->CreateHandleInformation.OriginalDesiredAccess = THREAD_ALL_ACCESS;
return OB_PREOP_SUCCESS;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yzhiyuan/DnfDebug_old1.git
git@gitee.com:yzhiyuan/DnfDebug_old1.git
yzhiyuan
DnfDebug_old1
DnfDebug_old1
master

搜索帮助