|
为什么ZwCreateFile总是返回STATUS_INVALID_PARAMETER?
[复制链接]
各位大哥,求救…………
文件存在,只是想打开,可是ZwCreateFile总返回的是0xC000000D,即STATUS_INVALID_PARAMETER。请问是什么问题?
谢谢!!
源代码如下:
HANDLE hFileHandle;
NTSTATUS ntStatus;
UNICODE_STRING uszFileName;
OBJECT_ATTRIBUTES objAttributes;
IO_STATUS_BLOCK isbCreateReadStatus;
FILE_STANDARD_INFORMATION StandardFileInfo;
ULONG ulFileLen;
PVOID pFileImage;
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); // 总返回 STATUS_INVALID_PARAMETER
if(!NT_SUCCESS(ntStatus))
{
KdPrint(("KmdReadWholeFile: Failed to open %ws. Error Code: 0x%xL\n", pFilePath, ntStatus));
return ntStatus;
}
|
|