Everhart, Glenn From: Rob Green [robg@sundial.net] Sent: Monday, November 09, 1998 10:55 PM To: ntdev@atria.com Subject: [ntdev] NT writing back to file it is reading Hello, I've come across a rather odd problem. I have a disk driver that NTFS calls to read data. So far so good, i read the request data from another device (that isn't in control by any other driver) , and alls well. as a test i started copying a 100MB file (using copy file /b nul) after about 10 MB i start getting writes to the file that is being copied! I have even opened the file in read only mode and it still does it. I have tracked it done to my call to read the data from the raw hard drive. (not a fdisk format) I use IoBuildSyncRequest to create the irp to send to the driver. from the pseudo code below you can see that i call MmGetSystemAddressForMdl then call IoBuildSync on the resulting buffer. I think this is where the problem is, as IoBuildSync is going to generate another Mdl for the buffer, so now i have 2 mdls(the one from the Irp, and the newly created one) and 2 systems addresses (the users buffer, and the system buffer) Am i right in that this could be my problem? I tried creating an irp using the original Irp, but it always BugChecks in KiInsertDeviceQueueAPC (or something similar) I have check the Irp APC fields and they are all null. i used IoAllocateIrp with a completion routine(bugcheck), and allocing my own with a completion routine. The completion routine is executed, but after it returns my main code is never restarted. (yes i return STATUS_MORE_PROCESSING_REQUIRED) If i check to see what file is being read, and don't call the ReadDataFromDrive routine on it, no writes occur to the file. Thanks ReadDataFromDrive() { Irp = IoBuildSynchronousRequest(...); if(Irp) { IoCallDriver(DeviceObject,Irp); } } DriverEntry(DeviceObject,Irp) { Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress); ntStatus = ReadDataFromDrive( DevExt, &ByteOffset, Stack->Parameters.Read.Length, Buffer); ntStatus = DoPostProcessingOnData( DevExt, &ByteOffset, Stack->Parameters.Read.Length, Buffer); Irp->IoStatus.Status = ntStatus; Irp->IoStatus.Information = Stack->Parameters.Read.Length; IoCompleteRequest(Irp,IO_DISK_INCREMENT); } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [ To unsubscribe, send email to ntdev-request@atria.com with body UNSUBSCRIBE (the subject is ignored). ]