It says this in the ZwReadFile documentation:
If the preceding call to ZwCreateFile set the FILE_NO_INTERMEDIATE_BUFFERING
flag in the CreateOptions parameter to ZwCreateFile, the Length and
ByteOffset parameters to ZwReadFile must be multiples of the sector size.
For more information, see ZwCreateFile.
Perhaps the sector size is the issue. I have no idea why the sector size
would change in Vista, but trying a sector size that is a multiple of 2048
should rule this out as the source of the problem. Data sectors on CDs hold
2048 bytes of data.
"Horst" <Horst...discussions.microsoft.com> wrote in message
news:187D17EB-9634-44B2-BF15-4A106370CA37...microsoft.com...
> The following snippet shows some calls to ZwCreateFile and ZwReadFile
> which
> work fine on
> 2000,2003, XP. But on Vista ZwReadFile will fail with
> STATUS_INVALID_PARAMETER. It only fails, if
> the file is located on an UDF formated DVD. If file is located on a
> physical
> disk, USB device or CD, everything is ok.
> ntStatus = ZwCreateFile (&hDeviceFile,
> GENERIC_READ | SYNCHRONIZE,
> &oaFileAttributes,
> &IoStatusBlock,
> NULL,
> FILE_ATTRIBUTE_NORMAL |
> FILE_ATTRIBUTE_SYSTEM,
> FILE_SHARE_READ,
> FILE_OPEN,
> FILE_NO_INTERMEDIATE_BUFFERING |
> FILE_SYNCHRONOUS_IO_NONALERT,
> NULL,
> 0);
> if (!NT_SUCCESS (ntStatus))
> {
> goto error;
> }
>
> ntStatus = ZwReadFile (hDeviceFile,
> NULL,
> NULL,
> NULL,
> &IoStatusBlock,
> ReadBuffer,
> FIRST_READ_SIZE, // means 512 * 11 = 5632
> &BaseOffset, //it's 0
> NULL);
> -->> here ntStatus == STATUS_INVALID_PARAMETER
> I checked the Alignment Requirement with
> #if DBG
> //Alignment Requirement
> ntStatus = ZwQueryInformationFile(hDeviceFile,
> &IoStatusBlock,
> &FileAlignmentInfo,
> sizeof (FileAlignmentInfo),
> FileAlignmentInformation);
> #endif
> FileAlignmentInfo shows 1, which means Word Boundary required. I also
> changed GENERIC_READ to
> FILE_READ_DATA|FILE_READ_ATTRIBUTES|FILE_READ_EA but this also changed
> nothing.
> Any ideas?
> Thanks in advance
> Horst
>