Dear all,

I have a Virtual Cdrom Driver, it can emulate an ISO file on network
drive as a Cdrom.It works well on Win2k/WinXp/Win2003. I need to port
it to Windows Vista, but it can't work well.

In this driver, I use DO_DIRECT_IO as I/O flags, use
MmGetSystemAddressForMdl( Irp->MdlAddress) to get current Mdl Address,
and use ZwReadFile to read data from Virtual Cdrom. I also use
MmGetMdlByteCount(Irp->MdlAddress) to get the length of system
assigned buffer for Mdl.

On Win2k/Xp/2003, ZwReadFile can be executed normally. For the first 3
executed times for ZwReadFile, the length of Mdl buffer is 2k, from
the 4th time of executed ZwReadFile, the length of Mdl buffer is 4k.

But on Vista, ZwReadFile can be only executed 3 times, the length of
Mdl buffer is also 2k for these 3 times. For the 4th executed times of
ZwReadFile, the Mdl buffer is 32k, ZwReadFile is blocked and can't be
executed anymore. Also the driver is blocked.

Can anyone give me a hint for this issue? Any help will be
appreciated!

Brs,
David

Re: Virtual Cdrom Driver Port to Vista by Vladimir

Vladimir
Fri Dec 07 00:27:57 PST 2007

Check the IRQL. ZwReadFile can be called only at PASSIVE_LEVEL.
You can either call ZwReadFile from a separate thread in your driver or
perform read by manually created irps (IoBuildAsynchronousFsdRequest, etc).

--
Best regards,
Vladimir Zinin
mailto:vzinin@gmail.com


davidma@ingrasys.com.cn wrote:
> Dear all,
>
> I have a Virtual Cdrom Driver, it can emulate an ISO file on network
> drive as a Cdrom.It works well on Win2k/WinXp/Win2003. I need to port
> it to Windows Vista, but it can't work well.
>
> In this driver, I use DO_DIRECT_IO as I/O flags, use
> MmGetSystemAddressForMdl( Irp->MdlAddress) to get current Mdl Address,
> and use ZwReadFile to read data from Virtual Cdrom. I also use
> MmGetMdlByteCount(Irp->MdlAddress) to get the length of system
> assigned buffer for Mdl.
>
> On Win2k/Xp/2003, ZwReadFile can be executed normally. For the first 3
> executed times for ZwReadFile, the length of Mdl buffer is 2k, from
> the 4th time of executed ZwReadFile, the length of Mdl buffer is 4k.
>
> But on Vista, ZwReadFile can be only executed 3 times, the length of
> Mdl buffer is also 2k for these 3 times. For the 4th executed times of
> ZwReadFile, the Mdl buffer is 32k, ZwReadFile is blocked and can't be
> executed anymore. Also the driver is blocked.
>
> Can anyone give me a hint for this issue? Any help will be
> appreciated!
>
> Brs,
> David

Re: Virtual Cdrom Driver Port to Vista by davidma

davidma
Fri Dec 07 01:50:00 PST 2007

On 12=D4=C27=C8=D5, =CF=C2=CE=E74=CA=B127=B7=D6, Vladimir Zinin <vzi...@gmai=
l.com> wrote:
> Check the IRQL. ZwReadFile can be called only at PASSIVE_LEVEL.
> You can either call ZwReadFile from a separate thread in your driver or
> perform read by manually created irps (IoBuildAsynchronousFsdRequest, etc)=
.
>
> --
> Best regards,
> Vladimir Zinin
> mailto:vzi...@gmail.com
>
>
>
> davi...@ingrasys.com.cn wrote:
> > Dear all,
>
> > I have a Virtual Cdrom Driver, it can emulate an ISO file on network
> > drive as a Cdrom.It works well on Win2k/WinXp/Win2003. I need to port
> > it to Windows Vista, but it can't work well.
>
> > In this driver, I use DO_DIRECT_IO as I/O flags, use
> > MmGetSystemAddressForMdl( Irp->MdlAddress) to get current Mdl Address,
> > and use ZwReadFile to read data from Virtual Cdrom. I also use
> > MmGetMdlByteCount(Irp->MdlAddress) to get the length of system
> > assigned buffer for Mdl.
>
> > On Win2k/Xp/2003, ZwReadFile can be executed normally. For the first 3
> > executed times for ZwReadFile, the length of Mdl buffer is 2k, from
> > the 4th time of executed ZwReadFile, the length of Mdl buffer is 4k.
>
> > But on Vista, ZwReadFile can be only executed 3 times, the length of
> > Mdl buffer is also 2k for these 3 times. For the 4th executed times of
> > ZwReadFile, the Mdl buffer is 32k, ZwReadFile is blocked and can't be
> > executed anymore. Also the driver is blocked.
>
> > Can anyone give me a hint for this issue? Any help will be
> > appreciated!
>
> > Brs,
> > David- =D2=FE=B2=D8=B1=BB=D2=FD=D3=C3=CE=C4=D7=D6 -
>
> - =CF=D4=CA=BE=D2=FD=D3=C3=B5=C4=CE=C4=D7=D6 -

Vladimir, thank you very much! This issue is solved by add a flag
FILE_SYNCHRONOUS_IO_NONALERT to ZwCreateFile. Thanks for your help!

Brs,
David