kernel32: Ignore FileIoPriorityHintInfo in SetFileInformationByHandle().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46130
Signed-off-by: Greg Smith <codedonewell@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Greg Smith 2018-11-19 07:13:50 +11:00 committed by Alexandre Julliard
parent 33de7fb7a8
commit f4b07ee8ec
3 changed files with 38 additions and 2 deletions

View File

@ -1103,7 +1103,6 @@ BOOL WINAPI SetFileInformationByHandle( HANDLE file, FILE_INFO_BY_HANDLE_CLASS c
case FileStreamInfo:
case FileIdBothDirectoryInfo:
case FileIdBothDirectoryRestartInfo:
case FileIoPriorityHintInfo:
case FileFullDirectoryInfo:
case FileFullDirectoryRestartInfo:
case FileStorageInfo:
@ -1118,7 +1117,9 @@ BOOL WINAPI SetFileInformationByHandle( HANDLE file, FILE_INFO_BY_HANDLE_CLASS c
case FileDispositionInfo:
status = NtSetInformationFile( file, &io, info, size, FileDispositionInformation );
break;
case FileIoPriorityHintInfo:
status = NtSetInformationFile( file, &io, info, size, FileIoPriorityHintInformation );
break;
case FileStandardInfo:
case FileCompressionInfo:
case FileAttributeTagInfo:

View File

@ -4914,6 +4914,7 @@ static void test_SetFileInformationByHandle(void)
FILE_STANDARD_INFO stdinfo = { {{0}},{{0}},0,FALSE,FALSE };
FILE_COMPRESSION_INFO compressinfo;
FILE_DISPOSITION_INFO dispinfo;
DECLSPEC_ALIGN(8) FILE_IO_PRIORITY_HINT_INFO hintinfo;
char tempFileName[MAX_PATH];
char tempPath[MAX_PATH];
HANDLE file;
@ -4950,6 +4951,28 @@ static void test_SetFileInformationByHandle(void)
ret = pSetFileInformationByHandle(file, FileAttributeTagInfo, &fileattrinfo, sizeof(fileattrinfo));
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "got %d, error %d\n", ret, GetLastError());
SetLastError(0xdeadbeef);
hintinfo.PriorityHint = MaximumIoPriorityHintType;
ret = pSetFileInformationByHandle(file, FileIoPriorityHintInfo, &hintinfo, sizeof(hintinfo));
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "got %d, error %d\n", ret, GetLastError());
hintinfo.PriorityHint = IoPriorityHintNormal;
ret = pSetFileInformationByHandle(file, FileIoPriorityHintInfo, &hintinfo, sizeof(hintinfo));
ok(ret, "setting FileIoPriorityHintInfo got %d, error %d\n", ret, GetLastError());
hintinfo.PriorityHint = IoPriorityHintVeryLow;
ret = pSetFileInformationByHandle(file, FileIoPriorityHintInfo, &hintinfo, sizeof(hintinfo));
ok(ret, "setting FileIoPriorityHintInfo got %d, error %d\n", ret, GetLastError());
SetLastError(0xdeadbeef);
ret = pSetFileInformationByHandle(file, FileIoPriorityHintInfo, &hintinfo, sizeof(hintinfo) - 1);
ok(!ret && GetLastError() == ERROR_BAD_LENGTH, "got %d, error %d\n", ret, GetLastError());
SetLastError(0xdeadbeef);
hintinfo.PriorityHint = IoPriorityHintVeryLow - 1;
ret = pSetFileInformationByHandle(file, FileIoPriorityHintInfo, &hintinfo, sizeof(hintinfo));
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "got %d, error %d\n", ret, GetLastError());
memset(&protinfo, 0, sizeof(protinfo));
protinfo.StructureVersion = 1;
protinfo.StructureSize = sizeof(protinfo);

View File

@ -2671,6 +2671,18 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
io->u.Status = STATUS_INFO_LENGTH_MISMATCH;
break;
case FileIoPriorityHintInformation:
if (len >= sizeof(FILE_IO_PRIORITY_HINT_INFO))
{
FILE_IO_PRIORITY_HINT_INFO *info = ptr;
if (info->PriorityHint < MaximumIoPriorityHintType)
TRACE( "ignoring FileIoPriorityHintInformation %u\n", info->PriorityHint );
else
io->u.Status = STATUS_INVALID_PARAMETER;
}
else io->u.Status = STATUS_INFO_LENGTH_MISMATCH;
break;
case FileAllInformation:
io->u.Status = STATUS_INVALID_INFO_CLASS;
break;