querymng.cpp
来自「The main idea of this work is to create 」· C++ 代码 · 共 28 行
CPP
28 行
#include "QueryMng.h"
QueryMng::~QueryMng()
{
mStorage.Clear();
}
bool QueryMng::AddRoutine(ULONG ControleCode,PFUNCTION_ROUTINE pFunctionPtr)
{
return mStorage.Add(ControleCode,pFunctionPtr);
}
bool QueryMng::ProcessIrp(PIRP pIrp)
{
ULONG BytesTxd =0; // Number of transmitted,received bytes
NTSTATUS status = STATUS_SUCCESS;
PIO_STACK_LOCATION IrpStack = IoGetCurrentIrpStackLocation(pIrp);
// Getting the IOCTL code
ULONG ControlCode = IrpStack->Parameters.DeviceIoControl.IoControlCode;
PVOID pFunc = mStorage.Get(ControlCode);
if(pFunc != NULL)
{
// Function that process IRP will call CompleteIrp()
return ((PFUNCTION_ROUTINE)pFunc)(pIrp);
}
// If no one subscribed for this IOCTL, return bad request.
return CompleteIrp(pIrp,STATUS_INVALID_DEVICE_REQUEST,BytesTxd);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?