I’m doing sth in sfilter. I just added sth on the sample of DDK, sfilter.
Now I faced the problem: When I used ZwCreateFile, the function always
return 0xC000000D, which is STATUS_INVALID_PARAMETER. No matter where I put
the source, at the beginning of the DriverEntry, or in other .c file, it’s
the same result.
The source is below:
HANDLE hFileHandle;
NTSTATUS ntStatus;
UNICODE_STRING uszFileName;
OBJECT_ATTRIBUTES objAttributes;
IO_STATUS_BLOCK isbCreateReadStatus;
if(KeGetCurrentIrql() >= DISPATCH_LEVEL)
return STATUS_UNSUCCESSFUL;
RtlInitUnicodeString(&uszFileName,
pFilePath);
InitializeObjectAttributes(&objAttributes,
&uszFileName,
OBJ_CASE_INSENSITIVE|OBJ_KERNEL_HANDLE,
NULL,
NULL);
ntStatus = ZwCreateFile(&hFileHandle,
SYNCHRONIZE|FILE_READ_DATA,
&objAttributes,
&isbCreateReadStatus,
NULL,
0,
FILE_SHARE_READ|FILE_SHARE_WRITE,
FILE_OPEN,
FILE_SYNCHRONOUS_IO_NONALERT|FILE_NON_DIRECTORY_FILE,
NULL,
0); // always return STATUS_INVALID_PARAMETER
if(!NT_SUCCESS(ntStatus))
{
KdPrint((“KmdReadWholeFile: Failed to open %ws. Error Code:
0x%xL\n”, pFilePath, ntStatus));
return ntStatus;
}
pFilePath is: L"\??\c:\windows\system32\pro.dat"
Please help me… Thank you…