[KERNEL32_VISTA] Sync GetFileInformationByHandleEx with wine head

This commit is contained in:
Timo Kreuzer 2023-10-16 16:11:58 +03:00
parent 908cda5ee4
commit 455f330775
3 changed files with 171 additions and 81 deletions

View file

@ -4,51 +4,86 @@
#include <ndk/rtlfuncs.h>
#include <ndk/iofuncs.h>
#define NDEBUG
#include <debug.h>
#undef FIXME
#define FIXME DPRINT1
/* Taken from Wine kernel32/file.c */
/***********************************************************************
* GetFileInformationByHandleEx (KERNEL32.@)
*/
BOOL WINAPI GetFileInformationByHandleEx( HANDLE handle, FILE_INFO_BY_HANDLE_CLASS class,
LPVOID info, DWORD size )
* GetFileInformationByHandleEx (kernelbase.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH GetFileInformationByHandleEx(HANDLE handle, FILE_INFO_BY_HANDLE_CLASS class,
LPVOID info, DWORD size)
{
NTSTATUS status;
IO_STATUS_BLOCK io;
switch (class)
{
case FileStreamInfo:
case FileCompressionInfo:
case FileAttributeTagInfo:
case FileRemoteProtocolInfo:
case FileFullDirectoryInfo:
case FileFullDirectoryRestartInfo:
case FileStorageInfo:
case FileAlignmentInfo:
case FileIdInfo:
case FileIdExtdDirectoryInfo:
case FileIdExtdDirectoryRestartInfo:
//FIXME( "%p, %u, %p, %u\n", handle, class, info, size );
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
case FileDispositionInfoEx:
case FileRenameInfoEx:
case FileCaseSensitiveInfo:
case FileNormalizedNameInfo:
FIXME("%p, %u, %p, %lu\n", handle, class, info, size);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
case FileStreamInfo:
status = NtQueryInformationFile(handle, &io, info, size, FileStreamInformation);
break;
case FileCompressionInfo:
status = NtQueryInformationFile(handle, &io, info, size, FileCompressionInformation);
break;
case FileAlignmentInfo:
status = NtQueryInformationFile(handle, &io, info, size, FileAlignmentInformation);
break;
case FileAttributeTagInfo:
status = NtQueryInformationFile(handle, &io, info, size, FileAttributeTagInformation);
break;
case FileBasicInfo:
status = NtQueryInformationFile( handle, &io, info, size, FileBasicInformation );
status = NtQueryInformationFile(handle, &io, info, size, FileBasicInformation);
break;
case FileStandardInfo:
status = NtQueryInformationFile( handle, &io, info, size, FileStandardInformation );
status = NtQueryInformationFile(handle, &io, info, size, FileStandardInformation);
break;
case FileNameInfo:
status = NtQueryInformationFile( handle, &io, info, size, FileNameInformation );
status = NtQueryInformationFile(handle, &io, info, size, FileNameInformation);
break;
case FileIdInfo:
status = NtQueryInformationFile(handle, &io, info, size, FileIdInformation);
break;
case FileIdBothDirectoryRestartInfo:
case FileIdBothDirectoryInfo:
status = NtQueryDirectoryFile( handle, NULL, NULL, NULL, &io, info, size,
status = NtQueryDirectoryFile(handle, NULL, NULL, NULL, &io, info, size,
FileIdBothDirectoryInformation, FALSE, NULL,
(class == FileIdBothDirectoryRestartInfo) );
(class == FileIdBothDirectoryRestartInfo));
break;
case FileFullDirectoryInfo:
case FileFullDirectoryRestartInfo:
status = NtQueryDirectoryFile(handle, NULL, NULL, NULL, &io, info, size,
FileFullDirectoryInformation, FALSE, NULL,
(class == FileFullDirectoryRestartInfo));
break;
case FileIdExtdDirectoryInfo:
case FileIdExtdDirectoryRestartInfo:
status = NtQueryDirectoryFile(handle, NULL, NULL, NULL, &io, info, size,
FileIdExtdDirectoryInformation, FALSE, NULL,
(class == FileIdExtdDirectoryRestartInfo));
break;
case FileRenameInfo:
@ -57,14 +92,19 @@ BOOL WINAPI GetFileInformationByHandleEx( HANDLE handle, FILE_INFO_BY_HANDLE_CLA
case FileIoPriorityHintInfo:
case FileEndOfFileInfo:
default:
SetLastError( ERROR_INVALID_PARAMETER );
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (status != STATUS_SUCCESS)
#ifdef __REACTOS__
if (!NT_SUCCESS(status))
{
SetLastError( RtlNtStatusToDosError( status ) );
SetLastError(RtlNtStatusToDosError(status));
return FALSE;
}
return TRUE;
#else
return set_ntstatus(status);
#endif
}

View file

@ -284,63 +284,100 @@ typedef enum _BUS_DATA_TYPE
typedef enum _FILE_INFORMATION_CLASS
{
FileDirectoryInformation = 1,
FileFullDirectoryInformation,
FileBothDirectoryInformation,
FileBasicInformation,
FileStandardInformation,
FileInternalInformation,
FileEaInformation,
FileAccessInformation,
FileNameInformation,
FileRenameInformation,
FileLinkInformation,
FileNamesInformation,
FileDispositionInformation,
FilePositionInformation,
FileFullEaInformation,
FileModeInformation,
FileAlignmentInformation,
FileAllInformation,
FileAllocationInformation,
FileEndOfFileInformation,
FileAlternateNameInformation,
FileStreamInformation,
FilePipeInformation,
FilePipeLocalInformation,
FilePipeRemoteInformation,
FileMailslotQueryInformation,
FileMailslotSetInformation,
FileCompressionInformation,
FileObjectIdInformation,
FileCompletionInformation,
FileMoveClusterInformation,
FileQuotaInformation,
FileReparsePointInformation,
FileNetworkOpenInformation,
FileAttributeTagInformation,
FileTrackingInformation,
FileIdBothDirectoryInformation,
FileIdFullDirectoryInformation,
FileValidDataLengthInformation,
FileShortNameInformation,
FileIoCompletionNotificationInformation,
#if (NTDDI_VERSION >= NTDDI_VISTA)
FileIoStatusBlockRangeInformation,
FileIoPriorityHintInformation,
FileSfioReserveInformation,
FileSfioVolumeInformation,
FileHardLinkInformation,
FileProcessIdsUsingFileInformation,
FileNormalizedNameInformation,
FileNetworkPhysicalNameInformation,
FileFullDirectoryInformation = 2,
FileBothDirectoryInformation = 3,
FileBasicInformation = 4,
FileStandardInformation = 5,
FileInternalInformation = 6,
FileEaInformation = 7,
FileAccessInformation = 8,
FileNameInformation = 9,
FileRenameInformation = 10,
FileLinkInformation = 11,
FileNamesInformation = 12,
FileDispositionInformation = 13,
FilePositionInformation = 14,
FileFullEaInformation = 15,
FileModeInformation = 16,
FileAlignmentInformation = 17,
FileAllInformation = 18,
FileAllocationInformation = 19,
FileEndOfFileInformation = 20,
FileAlternateNameInformation = 21,
FileStreamInformation = 22,
FilePipeInformation = 23,
FilePipeLocalInformation = 24,
FilePipeRemoteInformation = 25,
FileMailslotQueryInformation = 26,
FileMailslotSetInformation = 27,
FileCompressionInformation = 28,
FileObjectIdInformation = 29,
FileCompletionInformation = 30,
FileMoveClusterInformation = 31,
FileQuotaInformation = 32,
FileReparsePointInformation = 33,
FileNetworkOpenInformation = 34,
FileAttributeTagInformation = 35,
FileTrackingInformation = 36,
FileIdBothDirectoryInformation = 37,
FileIdFullDirectoryInformation = 38,
FileValidDataLengthInformation = 39,
FileShortNameInformation = 40,
FileIoCompletionNotificationInformation = 41,
#if (NTDDI_VERSION >= NTDDI_VISTA) || defined(__REACTOS__)
FileIoStatusBlockRangeInformation = 42,
FileIoPriorityHintInformation = 43,
FileSfioReserveInformation = 44,
FileSfioVolumeInformation = 45,
FileHardLinkInformation = 46,
FileProcessIdsUsingFileInformation = 47,
FileNormalizedNameInformation = 48,
FileNetworkPhysicalNameInformation = 49,
#endif
#if (NTDDI_VERSION >= NTDDI_WIN7)
FileIdGlobalTxDirectoryInformation,
FileIsRemoteDeviceInformation,
FileUnusedInformation,
FileNumaNodeInformation,
FileStandardLinkInformation,
FileRemoteProtocolInformation,
#if (NTDDI_VERSION >= NTDDI_WIN7) || defined(__REACTOS__)
FileIdGlobalTxDirectoryInformation = 50,
FileIsRemoteDeviceInformation = 51,
FileAttributeCacheInformation = 52, // FileUnusedInformation since Windows 8.1
FileNumaNodeInformation = 53,
FileStandardLinkInformation = 54,
FileRemoteProtocolInformation = 55,
#endif
#if (NTDDI_VERSION >= NTDDI_WIN8) || defined(__REACTOS__)
FileRenameInformationBypassAccessCheck = 56,
FileLinkInformationBypassAccessCheck = 57,
FileVolumeNameInformation = 58,
FileIdInformation = 59,
FileIdExtdDirectoryInformation = 60,
#endif
#if (NTDDI_VERSION >= NTDDI_WINBLUE) || defined(__REACTOS__)
FileReplaceCompletionInformation = 61,
FileHardLinkFullIdInformation = 62,
FileIdExtdBothDirectoryInformation = 63, // Update 1
#endif
#if (NTDDI_VERSION >= NTDDI_WIN10_RS1) || defined(__REACTOS__)
FileDispositionInformationEx = 64,
FileRenameInformationEx = 65,
FileRenameInformationExBypassAccessCheck = 66,
#endif
#if (NTDDI_VERSION >= NTDDI_WIN10_RS2) || defined(__REACTOS__)
FileDesiredStorageClassInformation = 67,
FileStatInformation = 68,
#endif
#if (NTDDI_VERSION >= NTDDI_WIN10_RS3) || defined(__REACTOS__)
FileMemoryPartitionInformation = 69,
#endif
#if (NTDDI_VERSION >= NTDDI_WIN10_RS4) || defined(__REACTOS__)
FileStatLxInformation = 70,
FileCaseSensitiveInformation = 71,
#endif
#if (NTDDI_VERSION >= NTDDI_WIN10_RS5) || defined(__REACTOS__)
FileLinkInformationEx = 72,
FileLinkInformationExBypassAccessCheck = 73,
FileStorageReserveIdInformation = 74,
FileCaseSensitiveInformationForceAccessCheck = 75,
#endif
#if (NTDDI_VERSION >= NTDDI_WIN11) || defined(__REACTOS__) // 10.0.20150.1000
FileKnownFolderInformation = 76,
#endif
FileMaximumInformation
} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;

View file

@ -985,6 +985,7 @@ typedef struct _FILE_ID_DESCRIPTOR {
} DUMMYUNIONNAME;
} FILE_ID_DESCRIPTOR, *LPFILE_ID_DESCRIPTOR;
#if (NTDDI_VERSION >= NTDDI_LONGHORN) || defined(__REACTOS__)
typedef enum _FILE_INFO_BY_HANDLE_CLASS {
FileBasicInfo,
FileStandardInfo,
@ -1002,13 +1003,25 @@ typedef enum _FILE_INFO_BY_HANDLE_CLASS {
FileRemoteProtocolInfo,
FileFullDirectoryInfo,
FileFullDirectoryRestartInfo,
#if (NTDDI_VERSION >= NTDDI_WIN8) || defined(__REACTOS__)
FileStorageInfo,
FileAlignmentInfo,
FileIdInfo,
FileIdExtdDirectoryInfo,
FileIdExtdDirectoryRestartInfo,
MaximumFileInfoByHandlesClass
#endif
#if (NTDDI_VERSION >= NTDDI_WIN10_RS1) || defined(__REACTOS__)
FileDispositionInfoEx,
FileRenameInfoEx,
#endif
#if (NTDDI_VERSION >= NTDDI_WIN10_19H1) || defined(__REACTOS__)
FileCaseSensitiveInfo,
FileNormalizedNameInfo,
#endif
MaximumFileInfoByHandleClass,
MaximumFileInfoByHandlesClass = MaximumFileInfoByHandleClass // Old name
} FILE_INFO_BY_HANDLE_CLASS, *PFILE_INFO_BY_HANDLE_CLASS;
#endif
typedef struct _FILE_ID_BOTH_DIR_INFO {
DWORD NextEntryOffset;