Hi,
I am trying to read a structure from a file (HDD) into the device
extension of my driver,
{
[…]
RtlInitUnicodeString(&PathPrefix, L"\??\");
/* Allocate memory for full path name */
FullPath.MaximumLength = puniFileName->MaximumLength +
PathPrefix.Length;
FullPath.Buffer = (PWCHAR)ExAllocatePool(NonPagedPool,
FullPath.MaximumLength);
RtlCopyUnicodeString(&FullPath, &PathPrefix);
RtlAppendUnicodeStringToString(&FullPath, puniFileName);
/* Open the file */
InitializeObjectAttributes(&objAttrib, &FullPath, OBJ_CASE_INSENSITIVE
| OBJ_KERNEL_HANDLE, NULL, NULL);
status = ZwCreateFile(&hFile, GENERIC_READ | GENERIC_WRITE,
&objAttrib,
&ioStatusBlock, NULL, FILE_ATTRIBUTE_NORMAL, 0, FILE_OPEN,
FILE_NON_DIRECTORY_FILE, NULL, 0);
[…]
status = ZwReadFile(hFile, NULL, NULL, NULL, &ioStatusBlock,
&(pDevExt->MyInfo), sizeof(MY_INFO_t), NULL, NULL);
[…]
}
I am able to open the file, but ZwReadFile fails with error code C000000D
(STATUS_INVALID_PARAMETER). The code (above) is called from an IOCTL (from
user mode) dispatch routine.
Anyone?
- Girish