mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
Rebase against ad7cb436571ec66ae7a5687568fca2f5318c7e76.
This commit is contained in:
parent
acd63ecddd
commit
38db26b6d9
@ -19,7 +19,6 @@ Fixes: Add ext-ms-win-kernel32-package-current-l1-1-0 dll
|
||||
Fixes: Add kernelbase dll
|
||||
Fixes: Add iertutil dll
|
||||
Fixes: Add shcore dll
|
||||
Depends: kernel32-GetFinalPathNameByHandle
|
||||
Depends: kernel32-FreeUserPhysicalPages
|
||||
Depends: kernel32-GetCurrentPackageFamilyName
|
||||
Depends: combase-RoApi
|
||||
|
@ -1,283 +0,0 @@
|
||||
From 7a4c38b61ea0192792a6b90a264f0353767f56bf Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Tue, 12 Aug 2014 20:24:14 +0200
|
||||
Subject: kernel32: Implement GetFinalPathNameByHandle.
|
||||
|
||||
---
|
||||
.../api-ms-win-core-file-l1-1-0.spec | 4 +-
|
||||
.../api-ms-win-core-file-l1-2-0.spec | 4 +-
|
||||
.../api-ms-win-core-file-l1-2-1.spec | 4 +-
|
||||
dlls/kernel32/file.c | 182 +++++++++++++++++++++
|
||||
dlls/kernel32/kernel32.spec | 4 +-
|
||||
dlls/kernelbase/kernelbase.spec | 4 +-
|
||||
6 files changed, 192 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/dlls/api-ms-win-core-file-l1-1-0/api-ms-win-core-file-l1-1-0.spec b/dlls/api-ms-win-core-file-l1-1-0/api-ms-win-core-file-l1-1-0.spec
|
||||
index 9e5b809..61e8038 100644
|
||||
--- a/dlls/api-ms-win-core-file-l1-1-0/api-ms-win-core-file-l1-1-0.spec
|
||||
+++ b/dlls/api-ms-win-core-file-l1-1-0/api-ms-win-core-file-l1-1-0.spec
|
||||
@@ -39,8 +39,8 @@
|
||||
@ stdcall GetFileSizeEx(long ptr) kernel32.GetFileSizeEx
|
||||
@ stdcall GetFileTime(long ptr ptr ptr) kernel32.GetFileTime
|
||||
@ stdcall GetFileType(long) kernel32.GetFileType
|
||||
-@ stub GetFinalPathNameByHandleA
|
||||
-@ stub GetFinalPathNameByHandleW
|
||||
+@ stdcall GetFinalPathNameByHandleA(long ptr long long) kernel32.GetFinalPathNameByHandleA
|
||||
+@ stdcall GetFinalPathNameByHandleW(long ptr long long) kernel32.GetFinalPathNameByHandleW
|
||||
@ stdcall GetFullPathNameA(str long ptr ptr) kernel32.GetFullPathNameA
|
||||
@ stdcall GetFullPathNameW(wstr long ptr ptr) kernel32.GetFullPathNameW
|
||||
@ stdcall GetLogicalDriveStringsW(long ptr) kernel32.GetLogicalDriveStringsW
|
||||
diff --git a/dlls/api-ms-win-core-file-l1-2-0/api-ms-win-core-file-l1-2-0.spec b/dlls/api-ms-win-core-file-l1-2-0/api-ms-win-core-file-l1-2-0.spec
|
||||
index ebfd52e..cddf112 100644
|
||||
--- a/dlls/api-ms-win-core-file-l1-2-0/api-ms-win-core-file-l1-2-0.spec
|
||||
+++ b/dlls/api-ms-win-core-file-l1-2-0/api-ms-win-core-file-l1-2-0.spec
|
||||
@@ -39,8 +39,8 @@
|
||||
@ stdcall GetFileSizeEx(long ptr) kernel32.GetFileSizeEx
|
||||
@ stdcall GetFileTime(long ptr ptr ptr) kernel32.GetFileTime
|
||||
@ stdcall GetFileType(long) kernel32.GetFileType
|
||||
-@ stub GetFinalPathNameByHandleA
|
||||
-@ stub GetFinalPathNameByHandleW
|
||||
+@ stdcall GetFinalPathNameByHandleA(long ptr long long) kernel32.GetFinalPathNameByHandleA
|
||||
+@ stdcall GetFinalPathNameByHandleW(long ptr long long) kernel32.GetFinalPathNameByHandleW
|
||||
@ stdcall GetFullPathNameA(str long ptr ptr) kernel32.GetFullPathNameA
|
||||
@ stdcall GetFullPathNameW(wstr long ptr ptr) kernel32.GetFullPathNameW
|
||||
@ stdcall GetLogicalDriveStringsW(long ptr) kernel32.GetLogicalDriveStringsW
|
||||
diff --git a/dlls/api-ms-win-core-file-l1-2-1/api-ms-win-core-file-l1-2-1.spec b/dlls/api-ms-win-core-file-l1-2-1/api-ms-win-core-file-l1-2-1.spec
|
||||
index c7691a4..a9acd8d 100644
|
||||
--- a/dlls/api-ms-win-core-file-l1-2-1/api-ms-win-core-file-l1-2-1.spec
|
||||
+++ b/dlls/api-ms-win-core-file-l1-2-1/api-ms-win-core-file-l1-2-1.spec
|
||||
@@ -41,8 +41,8 @@
|
||||
@ stdcall GetFileSizeEx(long ptr) kernel32.GetFileSizeEx
|
||||
@ stdcall GetFileTime(long ptr ptr ptr) kernel32.GetFileTime
|
||||
@ stdcall GetFileType(long) kernel32.GetFileType
|
||||
-@ stub GetFinalPathNameByHandleA
|
||||
-@ stub GetFinalPathNameByHandleW
|
||||
+@ stdcall GetFinalPathNameByHandleA(long ptr long long) kernel32.GetFinalPathNameByHandleA
|
||||
+@ stdcall GetFinalPathNameByHandleW(long ptr long long) kernel32.GetFinalPathNameByHandleW
|
||||
@ stdcall GetFullPathNameA(str long ptr ptr) kernel32.GetFullPathNameA
|
||||
@ stdcall GetFullPathNameW(wstr long ptr ptr) kernel32.GetFullPathNameW
|
||||
@ stdcall GetLogicalDriveStringsW(long ptr) kernel32.GetLogicalDriveStringsW
|
||||
diff --git a/dlls/kernel32/file.c b/dlls/kernel32/file.c
|
||||
index b6dba6a..690baa3 100644
|
||||
--- a/dlls/kernel32/file.c
|
||||
+++ b/dlls/kernel32/file.c
|
||||
@@ -2909,3 +2909,185 @@ DWORD WINAPI K32GetDeviceDriverFileNameW(void *image_base, LPWSTR file_name, DWO
|
||||
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+/***********************************************************************
|
||||
+ * GetFinalPathNameByHandleW (KERNEL32.@)
|
||||
+ */
|
||||
+DWORD WINAPI GetFinalPathNameByHandleW(HANDLE file, LPWSTR path, DWORD charcount, DWORD flags)
|
||||
+{
|
||||
+ WCHAR buffer[sizeof(OBJECT_NAME_INFORMATION) + MAX_PATH + 1];
|
||||
+ OBJECT_NAME_INFORMATION *info = (OBJECT_NAME_INFORMATION*)&buffer;
|
||||
+ WCHAR drive_part[MAX_PATH];
|
||||
+ DWORD drive_part_len;
|
||||
+ NTSTATUS status;
|
||||
+ DWORD result = 0;
|
||||
+ ULONG dummy;
|
||||
+ WCHAR *ptr;
|
||||
+
|
||||
+ TRACE( "(%p,%p,%d,%x)\n", file, path, charcount, flags );
|
||||
+
|
||||
+ /* check for invalid arguments */
|
||||
+ if (!path)
|
||||
+ {
|
||||
+ SetLastError( ERROR_INVALID_PARAMETER );
|
||||
+ return 0;
|
||||
+ }
|
||||
+ else if (file == INVALID_HANDLE_VALUE)
|
||||
+ {
|
||||
+ SetLastError( ERROR_INVALID_HANDLE );
|
||||
+ return 0;
|
||||
+ }
|
||||
+ else if (flags & ~(FILE_NAME_OPENED | VOLUME_NAME_GUID | VOLUME_NAME_NONE | VOLUME_NAME_NT))
|
||||
+ {
|
||||
+ WARN("Invalid or unsupported flags: %x\n", flags);
|
||||
+ SetLastError( ERROR_INVALID_PARAMETER );
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ /* get object name */
|
||||
+ status = NtQueryObject( file, ObjectNameInformation, &buffer, sizeof(buffer) - sizeof(WCHAR), &dummy );
|
||||
+ if (status != STATUS_SUCCESS)
|
||||
+ {
|
||||
+ SetLastError( RtlNtStatusToDosError( status ) );
|
||||
+ return 0;
|
||||
+ }
|
||||
+ else if (info->Name.Length < 4 * sizeof(WCHAR) || info->Name.Buffer[0] != '\\' ||
|
||||
+ info->Name.Buffer[1] != '?' || info->Name.Buffer[2] != '?' || info->Name.Buffer[3] != '\\' )
|
||||
+ {
|
||||
+ FIXME("Unexpected object name: %s\n", debugstr_wn(info->Name.Buffer, info->Name.Length / sizeof(WCHAR)));
|
||||
+ SetLastError( ERROR_GEN_FAILURE );
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ /* add terminating null character, remove "\\??\\" */
|
||||
+ info->Name.Buffer[info->Name.Length / sizeof(WCHAR)] = 0;
|
||||
+ info->Name.Length -= 4 * sizeof(WCHAR);
|
||||
+ info->Name.Buffer += 4;
|
||||
+
|
||||
+ /* FILE_NAME_OPENED is not supported yet, and would require Wineserver changes */
|
||||
+ if (flags & FILE_NAME_OPENED)
|
||||
+ {
|
||||
+ FIXME("FILE_NAME_OPENED not supported\n");
|
||||
+ flags &= ~FILE_NAME_OPENED;
|
||||
+ }
|
||||
+
|
||||
+ /* Get information required for VOLUME_NAME_NONE, VOLUME_NAME_GUID and VOLUME_NAME_NT */
|
||||
+ if (flags == VOLUME_NAME_NONE || flags == VOLUME_NAME_GUID || flags == VOLUME_NAME_NT)
|
||||
+ {
|
||||
+ if (!GetVolumePathNameW( info->Name.Buffer, drive_part, MAX_PATH ))
|
||||
+ return 0;
|
||||
+
|
||||
+ drive_part_len = strlenW(drive_part);
|
||||
+ if (!drive_part_len || drive_part_len > strlenW(info->Name.Buffer) ||
|
||||
+ drive_part[drive_part_len-1] != '\\' ||
|
||||
+ strncmpiW( info->Name.Buffer, drive_part, drive_part_len ))
|
||||
+ {
|
||||
+ FIXME("Path %s returned by GetVolumePathNameW does not match file path %s\n",
|
||||
+ debugstr_w(drive_part), debugstr_w(info->Name.Buffer));
|
||||
+ SetLastError( ERROR_GEN_FAILURE );
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (flags == VOLUME_NAME_NONE)
|
||||
+ {
|
||||
+ ptr = info->Name.Buffer + drive_part_len - 1;
|
||||
+ result = strlenW(ptr);
|
||||
+ if (result < charcount)
|
||||
+ memcpy(path, ptr, (result + 1) * sizeof(WCHAR));
|
||||
+ else result++;
|
||||
+ }
|
||||
+ else if (flags == VOLUME_NAME_GUID)
|
||||
+ {
|
||||
+ WCHAR volume_prefix[51];
|
||||
+
|
||||
+ /* GetVolumeNameForVolumeMountPointW sets error code on failure */
|
||||
+ if (!GetVolumeNameForVolumeMountPointW( drive_part, volume_prefix, 50 ))
|
||||
+ return 0;
|
||||
+
|
||||
+ ptr = info->Name.Buffer + drive_part_len;
|
||||
+ result = strlenW(volume_prefix) + strlenW(ptr);
|
||||
+ if (result < charcount)
|
||||
+ {
|
||||
+ path[0] = 0;
|
||||
+ strcatW(path, volume_prefix);
|
||||
+ strcatW(path, ptr);
|
||||
+ }
|
||||
+ else result++;
|
||||
+ }
|
||||
+ else if (flags == VOLUME_NAME_NT)
|
||||
+ {
|
||||
+ WCHAR nt_prefix[MAX_PATH];
|
||||
+
|
||||
+ /* QueryDosDeviceW sets error code on failure */
|
||||
+ drive_part[drive_part_len - 1] = 0;
|
||||
+ if (!QueryDosDeviceW( drive_part, nt_prefix, MAX_PATH ))
|
||||
+ return 0;
|
||||
+
|
||||
+ ptr = info->Name.Buffer + drive_part_len - 1;
|
||||
+ result = strlenW(nt_prefix) + strlenW(ptr);
|
||||
+ if (result < charcount)
|
||||
+ {
|
||||
+ path[0] = 0;
|
||||
+ strcatW(path, nt_prefix);
|
||||
+ strcatW(path, ptr);
|
||||
+ }
|
||||
+ else result++;
|
||||
+ }
|
||||
+ else if (flags == VOLUME_NAME_DOS)
|
||||
+ {
|
||||
+ static const WCHAR dos_prefix[] = {'\\','\\','?','\\', '\0'};
|
||||
+
|
||||
+ result = strlenW(dos_prefix) + strlenW(info->Name.Buffer);
|
||||
+ if (result < charcount)
|
||||
+ {
|
||||
+ path[0] = 0;
|
||||
+ strcatW(path, dos_prefix);
|
||||
+ strcatW(path, info->Name.Buffer);
|
||||
+ }
|
||||
+ else result++;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ /* Windows crashes here, but we prefer returning ERROR_INVALID_PARAMETER */
|
||||
+ WARN("Invalid combination of flags: %x\n", flags);
|
||||
+ SetLastError( ERROR_INVALID_PARAMETER );
|
||||
+ }
|
||||
+
|
||||
+ return result;
|
||||
+}
|
||||
+
|
||||
+/***********************************************************************
|
||||
+ * GetFinalPathNameByHandleA (KERNEL32.@)
|
||||
+ */
|
||||
+DWORD WINAPI GetFinalPathNameByHandleA(HANDLE file, LPSTR path, DWORD charcount, DWORD flags)
|
||||
+{
|
||||
+ WCHAR *str;
|
||||
+ DWORD result;
|
||||
+
|
||||
+ TRACE( "(%p,%p,%d,%x)\n", file, path, charcount, flags );
|
||||
+
|
||||
+ if (!path || !charcount)
|
||||
+ return GetFinalPathNameByHandleW(file, (LPWSTR)path, charcount, flags);
|
||||
+
|
||||
+ str = HeapAlloc( GetProcessHeap(), 0, charcount * sizeof(WCHAR) );
|
||||
+ if (!str)
|
||||
+ {
|
||||
+ SetLastError( ERROR_NOT_ENOUGH_MEMORY );
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ result = GetFinalPathNameByHandleW(file, (LPWSTR)str, charcount, flags);
|
||||
+ if (result)
|
||||
+ {
|
||||
+ if (result < charcount)
|
||||
+ {
|
||||
+ result = FILE_name_WtoA( str, result, path, charcount - 1 );
|
||||
+ path[result] = 0;
|
||||
+ }
|
||||
+ else result--; /* Why does Windows do this? */
|
||||
+ }
|
||||
+
|
||||
+ HeapFree( GetProcessHeap(), 0, str );
|
||||
+ return result;
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec
|
||||
index d606d9b..64759ca 100644
|
||||
--- a/dlls/kernel32/kernel32.spec
|
||||
+++ b/dlls/kernel32/kernel32.spec
|
||||
@@ -682,8 +682,8 @@
|
||||
@ stdcall GetFileSizeEx(long ptr)
|
||||
@ stdcall GetFileTime(long ptr ptr ptr)
|
||||
@ stdcall GetFileType(long)
|
||||
-# @ stub GetFinalPathNameByHandleA
|
||||
-# @ stub GetFinalPathNameByHandleW
|
||||
+@ stdcall GetFinalPathNameByHandleA(long ptr long long)
|
||||
+@ stdcall GetFinalPathNameByHandleW(long ptr long long)
|
||||
@ stdcall GetFirmwareEnvironmentVariableA(str str ptr long)
|
||||
@ stdcall GetFirmwareEnvironmentVariableW(wstr wstr ptr long)
|
||||
@ stdcall GetFullPathNameA(str long ptr ptr)
|
||||
diff --git a/dlls/kernelbase/kernelbase.spec b/dlls/kernelbase/kernelbase.spec
|
||||
index c06ecd9..b9e95ca 100644
|
||||
--- a/dlls/kernelbase/kernelbase.spec
|
||||
+++ b/dlls/kernelbase/kernelbase.spec
|
||||
@@ -235,8 +235,8 @@
|
||||
@ stdcall GetFileSizeEx(long ptr) kernel32.GetFileSizeEx
|
||||
@ stdcall GetFileTime(long ptr ptr ptr) kernel32.GetFileTime
|
||||
@ stdcall GetFileType(long) kernel32.GetFileType
|
||||
-@ stub GetFinalPathNameByHandleA
|
||||
-@ stub GetFinalPathNameByHandleW
|
||||
+@ stdcall GetFinalPathNameByHandleA(long ptr long long) kernel32.GetFinalPathNameByHandleA
|
||||
+@ stdcall GetFinalPathNameByHandleW(long ptr long long) kernel32.GetFinalPathNameByHandleW
|
||||
@ stdcall GetFullPathNameA(str long ptr ptr) kernel32.GetFullPathNameA
|
||||
@ stdcall GetFullPathNameW(wstr long ptr ptr) kernel32.GetFullPathNameW
|
||||
@ stdcall GetHandleInformation(long ptr) kernel32.GetHandleInformation
|
||||
--
|
||||
2.7.1
|
||||
|
@ -1 +0,0 @@
|
||||
Fixes: [34851] Support for GetFinalPathNameByHandle
|
@ -51,7 +51,7 @@ usage()
|
||||
# Get the upstream commit sha
|
||||
upstream_commit()
|
||||
{
|
||||
echo "aaddf1365a3371263827206eedf1464a83562c00"
|
||||
echo "ad7cb436571ec66ae7a5687568fca2f5318c7e76"
|
||||
}
|
||||
|
||||
# Show version information
|
||||
@ -167,7 +167,6 @@ patch_enable_all ()
|
||||
enable_kernel32_FindFirstFile="$1"
|
||||
enable_kernel32_FreeUserPhysicalPages="$1"
|
||||
enable_kernel32_GetCurrentPackageFamilyName="$1"
|
||||
enable_kernel32_GetFinalPathNameByHandle="$1"
|
||||
enable_kernel32_LocaleNameToLCID="$1"
|
||||
enable_kernel32_Named_Pipe="$1"
|
||||
enable_kernel32_NeedCurrentDirectoryForExePath="$1"
|
||||
@ -673,9 +672,6 @@ patch_enable ()
|
||||
kernel32-GetCurrentPackageFamilyName)
|
||||
enable_kernel32_GetCurrentPackageFamilyName="$2"
|
||||
;;
|
||||
kernel32-GetFinalPathNameByHandle)
|
||||
enable_kernel32_GetFinalPathNameByHandle="$2"
|
||||
;;
|
||||
kernel32-LocaleNameToLCID)
|
||||
enable_kernel32_LocaleNameToLCID="$2"
|
||||
;;
|
||||
@ -2313,13 +2309,9 @@ if test "$enable_api_ms_win_Stub_DLLs" -eq 1; then
|
||||
if test "$enable_kernel32_GetCurrentPackageFamilyName" -gt 1; then
|
||||
abort "Patchset kernel32-GetCurrentPackageFamilyName disabled, but api-ms-win-Stub_DLLs depends on that."
|
||||
fi
|
||||
if test "$enable_kernel32_GetFinalPathNameByHandle" -gt 1; then
|
||||
abort "Patchset kernel32-GetFinalPathNameByHandle disabled, but api-ms-win-Stub_DLLs depends on that."
|
||||
fi
|
||||
enable_combase_RoApi=1
|
||||
enable_kernel32_FreeUserPhysicalPages=1
|
||||
enable_kernel32_GetCurrentPackageFamilyName=1
|
||||
enable_kernel32_GetFinalPathNameByHandle=1
|
||||
fi
|
||||
|
||||
if test "$enable_advapi32_LsaLookupSids" -eq 1; then
|
||||
@ -2598,27 +2590,10 @@ if test "$enable_kernel32_GetCurrentPackageFamilyName" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset kernel32-GetFinalPathNameByHandle
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#34851] Support for GetFinalPathNameByHandle
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/api-ms-win-core-file-l1-1-0/api-ms-win-core-file-l1-1-0.spec, dlls/api-ms-win-core-file-l1-2-0/api-ms-win-core-
|
||||
# | file-l1-2-0.spec, dlls/api-ms-win-core-file-l1-2-1/api-ms-win-core-file-l1-2-1.spec, dlls/kernel32/file.c,
|
||||
# | dlls/kernel32/kernel32.spec, dlls/kernelbase/kernelbase.spec
|
||||
# |
|
||||
if test "$enable_kernel32_GetFinalPathNameByHandle" -eq 1; then
|
||||
patch_apply kernel32-GetFinalPathNameByHandle/0001-kernel32-Implement-GetFinalPathNameByHandle.patch
|
||||
(
|
||||
echo '+ { "Michael Müller", "kernel32: Implement GetFinalPathNameByHandle.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset api-ms-win-Stub_DLLs
|
||||
# |
|
||||
# | This patchset has the following (direct or indirect) dependencies:
|
||||
# | * combase-RoApi, kernel32-FreeUserPhysicalPages, kernel32-GetCurrentPackageFamilyName, kernel32-GetFinalPathNameByHandle
|
||||
# | * combase-RoApi, kernel32-FreeUserPhysicalPages, kernel32-GetCurrentPackageFamilyName
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * configure.ac, dlls/api-ms-win-appmodel-runtime-l1-1-1/Makefile.in, dlls/api-ms-win-appmodel-runtime-l1-1-1/api-ms-win-
|
||||
|
Loading…
Reference in New Issue
Block a user