There is no requirement to act on FileIoPriorityHintInfo Return success when this is passed to SetFileInformationByHandle.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46130 Signed-off-by: Greg Smith codedonewell@gmail.com --- v3: Fix test bugs. Add parameter validation as per guidance. Expand test coverage for parameter validation. --- dlls/kernel32/file.c | 15 ++++++++++++++- dlls/kernel32/tests/file.c | 26 ++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/file.c b/dlls/kernel32/file.c index eeccf67e15..6386c7d2b2 100644 --- a/dlls/kernel32/file.c +++ b/dlls/kernel32/file.c @@ -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: @@ -1119,6 +1118,20 @@ BOOL WINAPI SetFileInformationByHandle( HANDLE file, FILE_INFO_BY_HANDLE_CLASS c status = NtSetInformationFile( file, &io, info, size, FileDispositionInformation ); break;
+ case FileIoPriorityHintInfo: + if ( file == INVALID_HANDLE_VALUE || !info || size != sizeof( FILE_IO_PRIORITY_HINT_INFO ) + || ( ( FILE_IO_PRIORITY_HINT_INFO * ) info )-> PriorityHint < IoPriorityHintVeryLow + || ( ( FILE_IO_PRIORITY_HINT_INFO * ) info )-> PriorityHint >= MaximumIoPriorityHintType ) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return FALSE; + } + else + { + FIXME( "Ignoring file IO priority hint: %p, %u, %p, %u\n", file, class, info, size ); + return TRUE; + } + case FileStandardInfo: case FileCompressionInfo: case FileAttributeTagInfo: diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c index 168bdd5e7b..cfcb1c4a93 100644 --- a/dlls/kernel32/tests/file.c +++ b/dlls/kernel32/tests/file.c @@ -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,31 @@ 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());
+ /* Bug 46130: Star Citizen installer fails when FileIoPriorityHintInfo call does not return sucess */ + /* Bug 46130: Boundary violation test - value too great */ + SetLastError(0xdeadbeef); + hintinfo.PriorityHint = MaximumIoPriorityHintType; + ret = pSetFileInformationByHandle(file, FileIoPriorityHintInfo, &hintinfo, sizeof(hintinfo)); + ok(!ret, "setting FileIoPriorityHintInfo got %d, should have been an error\n", ret); + + /* Bug 46130: Maximum value test */ + SetLastError(0xdeadbeef); + hintinfo.PriorityHint = IoPriorityHintNormal; + ret = pSetFileInformationByHandle(file, FileIoPriorityHintInfo, &hintinfo, sizeof(hintinfo)); + ok(ret, "setting FileIoPriorityHintInfo got %d, error %d\n", ret, GetLastError()); + + /* Bug 46130: Minimum value test */ + SetLastError(0xdeadbeef); + hintinfo.PriorityHint = IoPriorityHintVeryLow; + ret = pSetFileInformationByHandle(file, FileIoPriorityHintInfo, &hintinfo, sizeof(hintinfo)); + ok(ret, "setting FileIoPriorityHintInfo got %d, error %d\n", ret, GetLastError()); + + /* Bug 46130: Boundary violation test - value too low */ + SetLastError(0xdeadbeef); + hintinfo.PriorityHint = IoPriorityHintVeryLow - 1; + ret = pSetFileInformationByHandle(file, FileIoPriorityHintInfo, &hintinfo, sizeof(hintinfo)); + ok(!ret, "setting FileIoPriorityHintInfo got %d, should have been an error\n", ret); + memset(&protinfo, 0, sizeof(protinfo)); protinfo.StructureVersion = 1; protinfo.StructureSize = sizeof(protinfo);