[PATCH 2/2] kernel32: Implement a few more classes in GetFileInformationByHandleEx

Andrew Eikum aeikum at codeweavers.com
Tue May 12 10:50:41 CDT 2015


On Tue, May 12, 2015 at 05:17:44PM +0300, Martin Storsjö wrote:
> >@@ -919,8 +919,24 @@ BOOL WINAPI GetFileInformationByHandleEx( HANDLE handle, FILE_INFO_BY_HANDLE_CLA
> >        SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
> >        return FALSE;
> >
> >+    case FileBasicInfo:
> >+    case FileStandardInfo:
> >    case FileNameInfo:
> >-        status = NtQueryInformationFile( handle, &io, info, size, FileNameInformation );
> >+        switch (class) {
> >+        case FileBasicInfo:
> >+            nt_class = FileBasicInformation;
> >+            break;
> >+        case FileStandardInfo:
> >+            nt_class = FileStandardInformation;
> >+            break;
> >+        case FileNameInfo:
> >+            nt_class = FileNameInformation;
> >+            break;
> >+        default:
> >+            assert(0);
> >+            break;

The default case seems unnecessary, since it's impossible.

But, this whole double-switch thing strikes me as ugly. Another option
would be to call NtQueryInformationFile with the correct argument in
each case, then break and do the 'if(status!=SUCCESS)' stuff outside
of the switch statement.  That would eliminate the code duplication
with the NtQueryDirectoryFile error checking, too.

> Is there anything concrete that needs to be fixed in this (and the
> other kernel32 patch in the same thread) to be acceptable?
> 

Tests would help for both patches.

Andrew



More information about the wine-devel mailing list