Added patch to implement SetFileInformationByHandle.

This commit is contained in:
Sebastian Lackner 2015-02-26 06:12:24 +01:00
parent dd12b420e8
commit 7d2b751466
7 changed files with 375 additions and 1 deletions

View File

@ -38,10 +38,11 @@ Wine. All those differences are also documented on the
Included bug fixes and improvements
===================================
**Bugfixes and features included in the next upcoming release [2]:**
**Bugfixes and features included in the next upcoming release [3]:**
* Fallback to global key state for threads without a queue ([Wine Bug #27238](https://bugs.winehq.org/show_bug.cgi?id=27238))
* Fix race-condition when threads are killed during shutdown
* Implement SetFileInformationByHandle
**Bugs fixed in Wine Staging 1.7.37 [182]:**

1
debian/changelog vendored
View File

@ -8,6 +8,7 @@ wine-staging (1.7.38) UNRELEASED; urgency=low
* Added patch to fix race-condition when threads are killed during shutdown.
* Added patch to avoid deadlock by using _exit() in NtTerminateProcess.
* Added patch to fallback to global key state for threads without a queue.
* Added patch to implement SetFileInformationByHandle.
* Removed patch to properly call DriverUnload when unloading device drivers (accepted upstream).
* Removed patch to allow Accept-Encoding for HTTP/1.0 in wininet (accepted upstream).
* Removed patch to declare pDirectInputCreateEx in a MSVC compatible way (accepted upstream).

View File

@ -0,0 +1,88 @@
From f85a2cc8b1911d19140e90dc317a565ef10e3b0f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 26 Feb 2015 05:27:14 +0100
Subject: ntdll: Define a couple more information classes.
---
dlls/ntdll/file.c | 20 +++++++++++---------
include/winternl.h | 28 +++++++++++++++++-----------
2 files changed, 28 insertions(+), 20 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 5232027..d05289e 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -2042,20 +2042,22 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io,
0, /* FileIdFullDirectoryInformation */
0, /* FileValidDataLengthInformation */
0, /* FileShortNameInformation */
- 0,
- 0,
- 0,
+ 0, /* FileIoCompletionNotificationInformation, */
+ 0, /* FileIoStatusBlockRangeInformation */
+ 0, /* FileIoPriorityHintInformation */
0, /* FileSfioReserveInformation */
0, /* FileSfioVolumeInformation */
0, /* FileHardLinkInformation */
- 0,
+ 0, /* FileProcessIdsUsingFileInformation */
0, /* FileNormalizedNameInformation */
- 0,
+ 0, /* FileNetworkPhysicalNameInformation */
0, /* FileIdGlobalTxDirectoryInformation */
- 0,
- 0,
- 0,
- 0 /* FileStandardLinkInformation */
+ 0, /* FileIsRemoteDeviceInformation */
+ 0, /* FileAttributeCacheInformation */
+ 0, /* FileNumaNodeInformation */
+ 0, /* FileStandardLinkInformation */
+ 0, /* FileRemoteProtocolInformation */
+ 0, /* FileReplaceCompletionInformation */
};
struct stat st;
diff --git a/include/winternl.h b/include/winternl.h
index 1a694da..d769ef0 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -411,17 +411,23 @@ typedef enum _FILE_INFORMATION_CLASS {
FileIdBothDirectoryInformation,
FileIdFullDirectoryInformation,
FileValidDataLengthInformation,
- FileShortNameInformation = 40,
- /* 41, 42, 43 undocumented */
- FileSfioReserveInformation = 44,
- FileSfioVolumeInformation = 45,
- FileHardLinkInformation = 46,
- /* 47 undocumented */
- FileNormalizedNameInformation = 48,
- /* 49 undocumented */
- FileIdGlobalTxDirectoryInformation = 50,
- /* 51, 52, 53 undocumented */
- FileStandardLinkInformation = 54,
+ FileShortNameInformation,
+ FileIoCompletionNotificationInformation,
+ FileIoStatusBlockRangeInformation,
+ FileIoPriorityHintInformation,
+ FileSfioReserveInformation,
+ FileSfioVolumeInformation,
+ FileHardLinkInformation,
+ FileProcessIdsUsingFileInformation,
+ FileNormalizedNameInformation,
+ FileNetworkPhysicalNameInformation,
+ FileIdGlobalTxDirectoryInformation,
+ FileIsRemoteDeviceInformation,
+ FileAttributeCacheInformation,
+ FileNumaNodeInformation,
+ FileStandardLinkInformation,
+ FileRemoteProtocolInformation,
+ FileReplaceCompletionInformation,
FileMaximumInformation
} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
--
2.3.0

View File

@ -0,0 +1,118 @@
From 92a522e2fd22e78a8aec27e6121aa261e5bf0777 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 26 Feb 2015 05:28:23 +0100
Subject: include: Declare a couple more file information class structures.
---
include/winbase.h | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 88 insertions(+)
diff --git a/include/winbase.h b/include/winbase.h
index 1eb49b3..2b6df8d 100644
--- a/include/winbase.h
+++ b/include/winbase.h
@@ -796,6 +796,68 @@ typedef enum _FILE_INFO_BY_HANDLE_CLASS {
MaximumFileInfoByHandlesClass
} FILE_INFO_BY_HANDLE_CLASS, *PFILE_INFO_BY_HANDLE_CLASS;
+typedef struct _FILE_BASIC_INFO {
+ LARGE_INTEGER CreationTime;
+ LARGE_INTEGER LastAccessTime;
+ LARGE_INTEGER LastWriteTime;
+ LARGE_INTEGER ChangeTime;
+ DWORD FileAttributes;
+} FILE_BASIC_INFO, *PFILE_BASIC_INFO;
+
+typedef struct _FILE_STANDARD_INFO {
+ LARGE_INTEGER AllocationSize;
+ LARGE_INTEGER EndOfFile;
+ DWORD NumberOfLinks;
+ BOOLEAN DeletePending;
+ BOOLEAN Directory;
+} FILE_STANDARD_INFO, *PFILE_STANDARD_INFO;
+
+typedef struct _FILE_NAME_INFO {
+ DWORD FileNameLength;
+ WCHAR FileName[1];
+} FILE_NAME_INFO, *PFILE_NAME_INFO;
+
+typedef struct _FILE_RENAME_INFO {
+ BOOLEAN ReplaceIfExists;
+ HANDLE RootDirectory;
+ DWORD FileNameLength;
+ WCHAR FileName[1];
+} FILE_RENAME_INFO, *PFILE_RENAME_INFO;
+
+typedef struct _FILE_DISPOSITION_INFO {
+ BOOLEAN DoDeleteFile;
+} FILE_DISPOSITION_INFO, *PFILE_DISPOSITION_INFO;
+
+typedef struct _FILE_ALLOCATION_INFO {
+ LARGE_INTEGER AllocationSize;
+} FILE_ALLOCATION_INFO, *PFILE_ALLOCATION_INFO;
+
+typedef struct _FILE_END_OF_FILE_INFO {
+ LARGE_INTEGER EndOfFile;
+} FILE_END_OF_FILE_INFO, *PFILE_END_OF_FILE_INFO;
+
+typedef struct _FILE_STREAM_INFO {
+ DWORD NextEntryOffset;
+ DWORD StreamNameLength;
+ LARGE_INTEGER StreamSize;
+ LARGE_INTEGER StreamAllocationSize;
+ WCHAR StreamName[1];
+} FILE_STREAM_INFO, *PFILE_STREAM_INFO;
+
+typedef struct _FILE_COMPRESSION_INFO {
+ LARGE_INTEGER CompressedFileSize;
+ WORD CompressionFormat;
+ UCHAR CompressionUnitShift;
+ UCHAR ChunkShift;
+ UCHAR ClusterShift;
+ UCHAR Reserved[3];
+} FILE_COMPRESSION_INFO, *PFILE_COMPRESSION_INFO;
+
+typedef struct _FILE_ATTRIBUTE_TAG_INFO {
+ DWORD FileAttributes;
+ DWORD ReparseTag;
+} FILE_ATTRIBUTE_TAG_INFO, *PFILE_ATTRIBUTE_TAG_INFO;
+
typedef struct _FILE_ID_BOTH_DIR_INFO {
DWORD NextEntryOffset;
DWORD FileIndex;
@@ -814,6 +876,32 @@ typedef struct _FILE_ID_BOTH_DIR_INFO {
WCHAR FileName[1];
} FILE_ID_BOTH_DIR_INFO, *PFILE_ID_BOTH_DIR_INFO;
+typedef struct _FILE_FULL_DIR_INFO {
+ ULONG NextEntryOffset;
+ ULONG FileIndex;
+ LARGE_INTEGER CreationTime;
+ LARGE_INTEGER LastAccessTime;
+ LARGE_INTEGER LastWriteTime;
+ LARGE_INTEGER ChangeTime;
+ LARGE_INTEGER EndOfFile;
+ LARGE_INTEGER AllocationSize;
+ ULONG FileAttributes;
+ ULONG FileNameLength;
+ ULONG EaSize;
+ WCHAR FileName[1];
+} FILE_FULL_DIR_INFO, *PFILE_FULL_DIR_INFO;
+
+typedef enum _PRIORITY_HINT {
+ IoPriorityHintVeryLow = 0,
+ IoPriorityHintLow,
+ IoPriorityHintNormal,
+ MaximumIoPriorityHintType
+} PRIORITY_HINT;
+
+typedef struct _FILE_IO_PRIORITY_HINT_INFO {
+ PRIORITY_HINT PriorityHint;
+} FILE_IO_PRIORITY_HINT_INFO, *PFILE_IO_PRIORITY_HINT_INFO;
+
#define PIPE_ACCESS_INBOUND 1
#define PIPE_ACCESS_OUTBOUND 2
#define PIPE_ACCESS_DUPLEX 3
--
2.3.0

View File

@ -0,0 +1,145 @@
From f13e94038f8a3c59dd184013b747cc31ef4b6f9a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 26 Feb 2015 06:08:58 +0100
Subject: ntdll: Implement SetFileInformationByHandle.
---
dlls/kernel32/file.c | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++-
include/winbase.h | 1 +
2 files changed, 102 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/file.c b/dlls/kernel32/file.c
index 006db1c..ffecef3 100644
--- a/dlls/kernel32/file.c
+++ b/dlls/kernel32/file.c
@@ -48,6 +48,22 @@
#include "wine/unicode.h"
#include "wine/debug.h"
+C_ASSERT(sizeof(FILE_BASIC_INFO) == sizeof(FILE_BASIC_INFORMATION));
+C_ASSERT(sizeof(FILE_STANDARD_INFO) == sizeof(FILE_STANDARD_INFORMATION));
+C_ASSERT(sizeof(FILE_NAME_INFO) == sizeof(FILE_NAME_INFORMATION));
+C_ASSERT(FIELD_OFFSET(FILE_RENAME_INFO, RootDirectory) == FIELD_OFFSET(FILE_RENAME_INFORMATION, RootDir));
+C_ASSERT(sizeof(FILE_RENAME_INFO) == sizeof(FILE_RENAME_INFORMATION));
+C_ASSERT(sizeof(FILE_DISPOSITION_INFO) == sizeof(FILE_DISPOSITION_INFORMATION));
+C_ASSERT(sizeof(FILE_ALLOCATION_INFO) == sizeof(FILE_ALLOCATION_INFORMATION));
+C_ASSERT(sizeof(FILE_END_OF_FILE_INFO) == sizeof(FILE_END_OF_FILE_INFORMATION));
+C_ASSERT(sizeof(FILE_STREAM_INFO) == sizeof(FILE_STREAM_INFORMATION));
+/* C_ASSERT(sizeof(FILE_COMPRESSION_INFO) == sizeof(FILE_COMPRESSION_INFORMATION)); */
+C_ASSERT(sizeof(FILE_ATTRIBUTE_TAG_INFO) == sizeof(FILE_ATTRIBUTE_TAG_INFORMATION));
+/* C_ASSERT(sizeof(FILE_ID_BOTH_DIR_INFO) == sizeof(FILE_ID_BOTH_DIR_INFORMATION)); */
+/* C_ASSERT(sizeof(FILE_IO_PRIORITY_HINT_INFO) == sizeof(FILE_IO_PRIORITY_HINT_INFORMATION)); */
+C_ASSERT(sizeof(FILE_FULL_DIR_INFO) == sizeof(FILE_FULL_DIR_INFORMATION));
+/* C_ASSERT(sizeof(FILE_ALIGNMENT_INFO) == sizeof(FILE_ALIGNMENT_INFORMATION)); */
+
WINE_DEFAULT_DEBUG_CHANNEL(file);
/* info structure for FindFirstFile handle */
@@ -1039,7 +1055,91 @@ BOOL WINAPI SetEndOfFile( HANDLE hFile )
BOOL WINAPI SetFileInformationByHandle( HANDLE file, FILE_INFO_BY_HANDLE_CLASS class, VOID *info, DWORD size )
{
- FIXME("%p %u %p %u - stub\n", file, class, info, size);
+ IO_STATUS_BLOCK io;
+ FILE_INFORMATION_CLASS ntclass;
+ NTSTATUS status;
+
+ TRACE("%p %u %p %u\n", file, class, info, size);
+
+ switch (class)
+ {
+ /* make sure that the kernel32 and NT structures are identical */
+ case FileBasicInfo:
+ /* FILE_BASIC_INFO matches FILE_BASIC_INFORMATION */
+ ntclass = FileBasicInformation;
+ break;
+ case FileStandardInfo:
+ /* FILE_STANDARD_INFO matches FILE_STANDARD_INFORMATION */
+ ntclass = FileStandardInformation;
+ break;
+ case FileNameInfo:
+ /* FILE_NAME_INFO matches FILE_NAME_INFORMATION */
+ ntclass = FileNameInformation;
+ break;
+ case FileRenameInfo:
+ /* FILE_RENAME_INFO matches FILE_RENAME_INFORMATION,
+ * except BOOL <-> BOOLEAN. */
+ ntclass = FileRenameInformation;
+ break;
+ case FileDispositionInfo:
+ /* FILE_DISPOSITION_INFO matches FILE_DISPOSITION_INFORMATION,
+ * except BOOL <-> BOOLEAN. */
+ ntclass = FileDispositionInformation;
+ break;
+ case FileAllocationInfo:
+ /* FILE_ALLOCATION_INFO matches FILE_ALLOCATION_INFORMATION */
+ ntclass = FileAllocationInformation;
+ break;
+ case FileEndOfFileInfo:
+ /* FILE_END_OF_FILE_INFO matches FILE_END_OF_FILE_INFORMATION */
+ ntclass = FileEndOfFileInformation;
+ break;
+ case FileStreamInfo:
+ /* FILE_STREAM_INFO matches FILE_STREAM_INFORMATION */
+ ntclass = FileStreamInformation;
+ break;
+ case FileCompressionInfo:
+ /* FILE_COMPRESSION_INFO matches FILE_COMPRESSION_INFORMATION */
+ ntclass = FileCompressionInformation;
+ break;
+ case FileAttributeTagInfo:
+ /* FILE_ATTRIBUTE_TAG_INFO matches FILE_ATTRIBUTE_TAG_INFORMATION */
+ ntclass = FileAttributeTagInformation;
+ break;
+ case FileIdBothDirectoryInfo:
+ /* FILE_ID_BOTH_DIR_INFO matches FILE_ID_BOTH_DIR_INFORMATION */
+ ntclass = FileIdBothDirectoryInformation;
+ break;
+ case FileIoPriorityHintInfo:
+ /* FILE_IO_PRIORITY_HINT_INFO matches FILE_IO_PRIORITY_HINT_INFORMATION */
+ ntclass = FileIoPriorityHintInformation;
+ break;
+ case FileFullDirectoryInfo:
+ /* FILE_FULL_DIR_INFO matches FILE_FULL_DIR_INFORMATION */
+ ntclass = FileFullDirectoryInformation;
+ break;
+ case FileAlignmentInfo:
+ /* FILE_ALIGNMENT_INFO matches FILE_ALIGNMENT_INFORMATION */
+ ntclass = FileAlignmentInformation;
+ break;
+
+ /* do not have a NT equivalent with same structure */
+ case FileFullDirectoryRestartInfo:
+ case FileIdBothDirectoryRestartInfo:
+ case FileIdExtdDirectoryInfo:
+ case FileIdInfo:
+ case FileRemoteProtocolInfo:
+ case FileStorageInfo:
+ default:
+ FIXME("unsupported class: %u\n", class);
+ SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
+ return FALSE;
+ }
+
+ status = NtSetInformationFile( file, &io, info, size, ntclass );
+
+ if (status == STATUS_SUCCESS) return TRUE;
+ SetLastError( RtlNtStatusToDosError(status) );
return FALSE;
}
diff --git a/include/winbase.h b/include/winbase.h
index 2b6df8d..a4c5408 100644
--- a/include/winbase.h
+++ b/include/winbase.h
@@ -2447,6 +2447,7 @@ WINBASEAPI VOID WINAPI SetFileApisToOEM(void);
WINBASEAPI BOOL WINAPI SetFileAttributesA(LPCSTR,DWORD);
WINBASEAPI BOOL WINAPI SetFileAttributesW(LPCWSTR,DWORD);
#define SetFileAttributes WINELIB_NAME_AW(SetFileAttributes)
+WINBASEAPI BOOL WINAPI SetFileInformationByHandle(HANDLE,FILE_INFO_BY_HANDLE_CLASS,LPVOID,DWORD);
WINBASEAPI DWORD WINAPI SetFilePointer(HANDLE,LONG,LPLONG,DWORD);
WINBASEAPI BOOL WINAPI SetFilePointerEx(HANDLE,LARGE_INTEGER,LARGE_INTEGER*,DWORD);
WINADVAPI BOOL WINAPI SetFileSecurityA(LPCSTR,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR);
--
2.3.0

View File

@ -0,0 +1 @@
Fixes: Implement SetFileInformationByHandle

View File

@ -132,6 +132,7 @@ patch_enable_all ()
enable_ntdll_Pipe_SpecialCharacters="$1"
enable_ntdll_RtlIpv4StringToAddressExA="$1"
enable_ntdll_RtlUnwindEx="$1"
enable_ntdll_SetFileInformationByHandle="$1"
enable_ntdll_ThreadTime="$1"
enable_ntdll_Threading="$1"
enable_ntdll_User_Shared_Data="$1"
@ -429,6 +430,9 @@ patch_enable ()
ntdll-RtlUnwindEx)
enable_ntdll_RtlUnwindEx="$2"
;;
ntdll-SetFileInformationByHandle)
enable_ntdll_SetFileInformationByHandle="$2"
;;
ntdll-ThreadTime)
enable_ntdll_ThreadTime="$2"
;;
@ -2736,6 +2740,22 @@ if test "$enable_ntdll_RtlUnwindEx" -eq 1; then
) >> "$patchlist"
fi
# Patchset ntdll-SetFileInformationByHandle
# |
# | Modified files:
# | * dlls/kernel32/file.c, dlls/ntdll/file.c, include/winbase.h, include/winternl.h
# |
if test "$enable_ntdll_SetFileInformationByHandle" -eq 1; then
patch_apply ntdll-SetFileInformationByHandle/0001-ntdll-Define-a-couple-more-information-classes.patch
patch_apply ntdll-SetFileInformationByHandle/0002-include-Declare-a-couple-more-file-information-class.patch
patch_apply ntdll-SetFileInformationByHandle/0003-ntdll-Implement-SetFileInformationByHandle.patch
(
echo '+ { "Michael Müller", "ntdll: Define a couple more information classes.", 1 },';
echo '+ { "Michael Müller", "include: Declare a couple more file information class structures.", 1 },';
echo '+ { "Michael Müller", "ntdll: Implement SetFileInformationByHandle.", 1 },';
) >> "$patchlist"
fi
# Patchset ntdll-ThreadTime
# |
# | This patchset fixes the following Wine bugs: