I have a simple struct which I would like to pass to my driver. Here is the struct:
typedef struct readStruct
{
...
} ReadStruct, *pRreadStruct;
Here is my usermode application:
DWORD dwReturn;
readStruct reader{ ... };
WriteFile(hDriver, (LPCVOID)&reader, sizeof(ReadStruct), &dwReturn, NULL);
Here is my driver code, it always returns NULL to the readStruct. What am I doing wrong?
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);
}
}
}