I am trying to create a basic “hello world” example of
“Programmed I/O. In my drivers read entry point I have
the following synopsis of the code.
====> Kernel Code
UserBuffer = MmGetSystemAddressForMdlSafe(
Irp->MdlAddress, NormalPagePriority );
RtlCopyMemory( UserBuffer, tmp, TIME_SIZE );
KeFlushIoBuffers(Irp->MdlAddress, FALSE, TRUE);
IoCompleteRequest(Irp, IO_NO_INCREMENT);
// When I view the code in the UserBufffer at this
point its contents are OK.
=====> User Code
DriverHandle = CreateFile(“\\.\Test_Driver”,
GENERIC_READ|GENERIC_WRITE, 0, 0, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0);
ReadFile( DriverHandle, (unsigned char*)Time_Array,
TIME_SIZE, &BytesRead, NULL );
When I get the data back into the user space
application it is corrupted. I realize this is pretty
trivial stuff but any comments would be appreciated.
Am I missing something?
Cheers
Dave Sharp
Find your next car at http://autos.yahoo.ca