[NTDLL_APITEST] Add test for FileEndOfFileInformation

This commit is contained in:
Timo Kreuzer 2024-04-22 11:41:00 +03:00
parent 35dc2f2410
commit bebf99aaf1

View file

@ -20,4 +20,36 @@ START_TEST(NtQueryInformationFile)
Status = NtQueryInformationFile(NULL, NULL, NULL, 0, 0x80000000);
ok(Status == STATUS_INVALID_INFO_CLASS ||
ntv6(Status == STATUS_NOT_IMPLEMENTED), "Status = %lx\n", Status);
/* Get the full path of the current executable */
CHAR Path[MAX_PATH];
DWORD Length = GetModuleFileNameA(NULL, Path, _countof(Path));
ok(Length != 0, "GetModuleFileNameA failed\n");
if (Length == 0)
return;
/* Open the file */
HANDLE hFile = CreateFileA(Path,
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
ok(hFile != INVALID_HANDLE_VALUE, "CreateFileA failed\n");
if (hFile == INVALID_HANDLE_VALUE)
return;
/* Query FileEndOfFileInformation */
FILE_END_OF_FILE_INFORMATION EndOfFileInformation;
EndOfFileInformation.EndOfFile.QuadPart = 0xdeaddead;
Status = NtQueryInformationFile(hFile,
NULL,
&EndOfFileInformation,
sizeof(EndOfFileInformation),
FileEndOfFileInformation);
ok_hex(Status, STATUS_INVALID_INFO_CLASS);
ok(EndOfFileInformation.EndOfFile.QuadPart == 0xdeaddead, "EndOfFile is modified\n");
CloseHandle(hFile);
}