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

View file

@ -284,63 +284,100 @@ typedef enum _BUS_DATA_TYPE
typedef enum _FILE_INFORMATION_CLASS typedef enum _FILE_INFORMATION_CLASS
{ {
FileDirectoryInformation = 1, FileDirectoryInformation = 1,
FileFullDirectoryInformation, FileFullDirectoryInformation = 2,
FileBothDirectoryInformation, FileBothDirectoryInformation = 3,
FileBasicInformation, FileBasicInformation = 4,
FileStandardInformation, FileStandardInformation = 5,
FileInternalInformation, FileInternalInformation = 6,
FileEaInformation, FileEaInformation = 7,
FileAccessInformation, FileAccessInformation = 8,
FileNameInformation, FileNameInformation = 9,
FileRenameInformation, FileRenameInformation = 10,
FileLinkInformation, FileLinkInformation = 11,
FileNamesInformation, FileNamesInformation = 12,
FileDispositionInformation, FileDispositionInformation = 13,
FilePositionInformation, FilePositionInformation = 14,
FileFullEaInformation, FileFullEaInformation = 15,
FileModeInformation, FileModeInformation = 16,
FileAlignmentInformation, FileAlignmentInformation = 17,
FileAllInformation, FileAllInformation = 18,
FileAllocationInformation, FileAllocationInformation = 19,
FileEndOfFileInformation, FileEndOfFileInformation = 20,
FileAlternateNameInformation, FileAlternateNameInformation = 21,
FileStreamInformation, FileStreamInformation = 22,
FilePipeInformation, FilePipeInformation = 23,
FilePipeLocalInformation, FilePipeLocalInformation = 24,
FilePipeRemoteInformation, FilePipeRemoteInformation = 25,
FileMailslotQueryInformation, FileMailslotQueryInformation = 26,
FileMailslotSetInformation, FileMailslotSetInformation = 27,
FileCompressionInformation, FileCompressionInformation = 28,
FileObjectIdInformation, FileObjectIdInformation = 29,
FileCompletionInformation, FileCompletionInformation = 30,
FileMoveClusterInformation, FileMoveClusterInformation = 31,
FileQuotaInformation, FileQuotaInformation = 32,
FileReparsePointInformation, FileReparsePointInformation = 33,
FileNetworkOpenInformation, FileNetworkOpenInformation = 34,
FileAttributeTagInformation, FileAttributeTagInformation = 35,
FileTrackingInformation, FileTrackingInformation = 36,
FileIdBothDirectoryInformation, FileIdBothDirectoryInformation = 37,
FileIdFullDirectoryInformation, FileIdFullDirectoryInformation = 38,
FileValidDataLengthInformation, FileValidDataLengthInformation = 39,
FileShortNameInformation, FileShortNameInformation = 40,
FileIoCompletionNotificationInformation, FileIoCompletionNotificationInformation = 41,
#if (NTDDI_VERSION >= NTDDI_VISTA) #if (NTDDI_VERSION >= NTDDI_VISTA) || defined(__REACTOS__)
FileIoStatusBlockRangeInformation, FileIoStatusBlockRangeInformation = 42,
FileIoPriorityHintInformation, FileIoPriorityHintInformation = 43,
FileSfioReserveInformation, FileSfioReserveInformation = 44,
FileSfioVolumeInformation, FileSfioVolumeInformation = 45,
FileHardLinkInformation, FileHardLinkInformation = 46,
FileProcessIdsUsingFileInformation, FileProcessIdsUsingFileInformation = 47,
FileNormalizedNameInformation, FileNormalizedNameInformation = 48,
FileNetworkPhysicalNameInformation, FileNetworkPhysicalNameInformation = 49,
#endif #endif
#if (NTDDI_VERSION >= NTDDI_WIN7) #if (NTDDI_VERSION >= NTDDI_WIN7) || defined(__REACTOS__)
FileIdGlobalTxDirectoryInformation, FileIdGlobalTxDirectoryInformation = 50,
FileIsRemoteDeviceInformation, FileIsRemoteDeviceInformation = 51,
FileUnusedInformation, FileAttributeCacheInformation = 52, // FileUnusedInformation since Windows 8.1
FileNumaNodeInformation, FileNumaNodeInformation = 53,
FileStandardLinkInformation, FileStandardLinkInformation = 54,
FileRemoteProtocolInformation, 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 #endif
FileMaximumInformation FileMaximumInformation
} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS; } FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;

View file

@ -985,6 +985,7 @@ typedef struct _FILE_ID_DESCRIPTOR {
} DUMMYUNIONNAME; } DUMMYUNIONNAME;
} FILE_ID_DESCRIPTOR, *LPFILE_ID_DESCRIPTOR; } FILE_ID_DESCRIPTOR, *LPFILE_ID_DESCRIPTOR;
#if (NTDDI_VERSION >= NTDDI_LONGHORN) || defined(__REACTOS__)
typedef enum _FILE_INFO_BY_HANDLE_CLASS { typedef enum _FILE_INFO_BY_HANDLE_CLASS {
FileBasicInfo, FileBasicInfo,
FileStandardInfo, FileStandardInfo,
@ -1002,13 +1003,25 @@ typedef enum _FILE_INFO_BY_HANDLE_CLASS {
FileRemoteProtocolInfo, FileRemoteProtocolInfo,
FileFullDirectoryInfo, FileFullDirectoryInfo,
FileFullDirectoryRestartInfo, FileFullDirectoryRestartInfo,
#if (NTDDI_VERSION >= NTDDI_WIN8) || defined(__REACTOS__)
FileStorageInfo, FileStorageInfo,
FileAlignmentInfo, FileAlignmentInfo,
FileIdInfo, FileIdInfo,
FileIdExtdDirectoryInfo, FileIdExtdDirectoryInfo,
FileIdExtdDirectoryRestartInfo, 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; } FILE_INFO_BY_HANDLE_CLASS, *PFILE_INFO_BY_HANDLE_CLASS;
#endif
typedef struct _FILE_ID_BOTH_DIR_INFO { typedef struct _FILE_ID_BOTH_DIR_INFO {
DWORD NextEntryOffset; DWORD NextEntryOffset;