我有一个简单的结构,我想传递给我的驱动程序。这是结构:
typedef struct readStruct
{
...
} ReadStruct, *pRreadStruct;
这是我的用户模式应用程序:
DWORD dwReturn;
readStruct reader{ ... };
WriteFile(hDriver, (LPCVOID)&reader, sizeof(ReadStruct), &dwReturn, NULL);
这是我的驱动程序代码,它总是向readStruct返回NULL。我做错了什么?
PIO_STACK_LOCATION pIoStackIrp = NULL;
pRreadStruct readStruct;
pIoStackIrp = IoGetCurrentIrpStackLocation(Irp);
DbgPrintEx(0, 0, "WriteBufferedIO\n");
if (pIoStackIrp)
{
readStruct = (pRreadStruct)Irp->AssociatedIrp.SystemBuffer;
if (readStruct)
{
// this is the place I never get into
if (readStruct->ReadSize)
{
ReadMemOutputClient(readStruct);
}
}
}
答案 0 :(得分:0)
DO_BUFFERED_IO 标志。
感谢用户@RbMm指出这一点。