You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-12-15 08:03:15 -08:00
Removed various patches (accepted upstream).
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
From ea5ae1b1a3c8654b83f7bcdccfd29fc644e7560e Mon Sep 17 00:00:00 2001
|
||||
From 849837db444c4fedb35f176c08db46f018adba28 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.
|
||||
@@ -7,8 +7,7 @@ Subject: kernel32: Implement GetFinalPathNameByHandle.
|
||||
.../api-ms-win-core-file-l1-2-0.spec | 4 +-
|
||||
dlls/kernel32/file.c | 182 +++++++++++++++++++++
|
||||
dlls/kernel32/kernel32.spec | 4 +-
|
||||
include/fileapi.h | 8 +
|
||||
4 files changed, 194 insertions(+), 4 deletions(-)
|
||||
3 files changed, 186 insertions(+), 4 deletions(-)
|
||||
|
||||
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
|
||||
@@ -217,7 +216,7 @@ index 006db1c..b3cc8c3 100644
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec
|
||||
index 3719505..a272535 100644
|
||||
index 1179af2..90207e0 100644
|
||||
--- a/dlls/kernel32/kernel32.spec
|
||||
+++ b/dlls/kernel32/kernel32.spec
|
||||
@@ -682,8 +682,8 @@
|
||||
@@ -231,25 +230,6 @@ index 3719505..a272535 100644
|
||||
@ stdcall GetFirmwareEnvironmentVariableA(str str ptr long)
|
||||
@ stdcall GetFirmwareEnvironmentVariableW(wstr wstr ptr long)
|
||||
@ stdcall GetFullPathNameA(str long ptr ptr)
|
||||
diff --git a/include/fileapi.h b/include/fileapi.h
|
||||
index 02bbbd4..0ccf9e9 100644
|
||||
--- a/include/fileapi.h
|
||||
+++ b/include/fileapi.h
|
||||
@@ -34,6 +34,14 @@ typedef struct _CREATEFILE2_EXTENDED_PARAMETERS {
|
||||
|
||||
WINBASEAPI HANDLE WINAPI CreateFile2(LPCWSTR,DWORD,DWORD,DWORD,LPCREATEFILE2_EXTENDED_PARAMETERS);
|
||||
|
||||
+#define FILE_NAME_NORMALIZED 0x0
|
||||
+#define FILE_NAME_OPENED 0x8
|
||||
+
|
||||
+#define VOLUME_NAME_DOS 0x0
|
||||
+#define VOLUME_NAME_GUID 0x1
|
||||
+#define VOLUME_NAME_NT 0x2
|
||||
+#define VOLUME_NAME_NONE 0x4
|
||||
+
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
--
|
||||
2.2.1
|
||||
2.3.3
|
||||
|
||||
|
||||
@@ -1,253 +0,0 @@
|
||||
From 1186a3a107bd3476248f396ba23f46cf35a9286d 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:25:18 +0200
|
||||
Subject: kernel32/tests: Add tests for GetFinalPathNameByHandle
|
||||
|
||||
---
|
||||
dlls/kernel32/tests/file.c | 204 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 204 insertions(+)
|
||||
|
||||
diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
|
||||
index 8849eb3..3a94b8d 100644
|
||||
--- a/dlls/kernel32/tests/file.c
|
||||
+++ b/dlls/kernel32/tests/file.c
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "winerror.h"
|
||||
#include "winnls.h"
|
||||
#include "fileapi.h"
|
||||
+#include "ntsecapi.h"
|
||||
|
||||
static HANDLE (WINAPI *pFindFirstFileExA)(LPCSTR,FINDEX_INFO_LEVELS,LPVOID,FINDEX_SEARCH_OPS,LPVOID,DWORD);
|
||||
static BOOL (WINAPI *pReplaceFileA)(LPCSTR, LPCSTR, LPCSTR, DWORD, LPVOID, LPVOID);
|
||||
@@ -46,6 +47,8 @@ static HANDLE (WINAPI *pOpenFileById)(HANDLE, LPFILE_ID_DESCRIPTOR, DWORD, DWORD
|
||||
static BOOL (WINAPI *pSetFileValidData)(HANDLE, LONGLONG);
|
||||
static HRESULT (WINAPI *pCopyFile2)(PCWSTR,PCWSTR,COPYFILE2_EXTENDED_PARAMETERS*);
|
||||
static HANDLE (WINAPI *pCreateFile2)(LPCWSTR, DWORD, DWORD, DWORD, CREATEFILE2_EXTENDED_PARAMETERS*);
|
||||
+static DWORD (WINAPI* pGetFinalPathNameByHandleA)(HANDLE, LPSTR, DWORD, DWORD);
|
||||
+static DWORD (WINAPI* pGetFinalPathNameByHandleW)(HANDLE, LPWSTR, DWORD, DWORD);
|
||||
|
||||
static const char filename[] = "testfile.xxx";
|
||||
static const char sillytext[] =
|
||||
@@ -83,6 +86,8 @@ static void InitFunctionPointers(void)
|
||||
pSetFileValidData = (void *) GetProcAddress(hkernel32, "SetFileValidData");
|
||||
pCopyFile2 = (void *) GetProcAddress(hkernel32, "CopyFile2");
|
||||
pCreateFile2 = (void *) GetProcAddress(hkernel32, "CreateFile2");
|
||||
+ pGetFinalPathNameByHandleA = (void *) GetProcAddress(hkernel32, "GetFinalPathNameByHandleA");
|
||||
+ pGetFinalPathNameByHandleW = (void *) GetProcAddress(hkernel32, "GetFinalPathNameByHandleW");
|
||||
}
|
||||
|
||||
static void test__hread( void )
|
||||
@@ -4182,6 +4187,203 @@ todo_wine
|
||||
}
|
||||
}
|
||||
|
||||
+
|
||||
+static void test_GetFinalPathNameByHandleA(void)
|
||||
+{
|
||||
+ static char prefix[] = "GetFinalPathNameByHandleA";
|
||||
+ static char dos_prefix[] = "\\\\?\\";
|
||||
+ char temp_path[MAX_PATH], test_path[MAX_PATH];
|
||||
+ char long_path[MAX_PATH], result_path[MAX_PATH];
|
||||
+ char dos_path[sizeof(dos_prefix) + MAX_PATH];
|
||||
+ HANDLE hFile;
|
||||
+ DWORD count;
|
||||
+ UINT ret;
|
||||
+
|
||||
+ if (!pGetFinalPathNameByHandleA)
|
||||
+ {
|
||||
+ win_skip("GetFinalPathNameByHandleA is missing\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /* Test calling with INVALID_HANDLE_VALUE */
|
||||
+ SetLastError(0xdeadbeaf);
|
||||
+ count = pGetFinalPathNameByHandleA(INVALID_HANDLE_VALUE, result_path, MAX_PATH, FILE_NAME_NORMALIZED | VOLUME_NAME_DOS);
|
||||
+ ok(count == 0, "Expected length 0, got %d\n", count);
|
||||
+ ok(GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %x\n", GetLastError());
|
||||
+
|
||||
+ count = GetTempPathA(MAX_PATH, temp_path);
|
||||
+ ok(count, "Failed to get temp path, error %x\n", GetLastError());
|
||||
+ if (!count) return;
|
||||
+
|
||||
+ ret = GetTempFileNameA(temp_path, prefix, 0, test_path);
|
||||
+ ok(ret != 0, "GetTempFileNameA error %x\n", GetLastError());
|
||||
+ if (!ret) return;
|
||||
+
|
||||
+ ret = GetLongPathNameA(test_path, long_path, MAX_PATH);
|
||||
+ ok(ret != 0, "GetLongPathNameA error %x\n", GetLastError());
|
||||
+ if (!ret) return;
|
||||
+
|
||||
+ hFile = CreateFileA(test_path, GENERIC_READ | GENERIC_WRITE, 0, NULL,
|
||||
+ CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, 0);
|
||||
+ ok(hFile != INVALID_HANDLE_VALUE, "CreateFileA error %x\n", GetLastError());
|
||||
+ if (hFile == INVALID_HANDLE_VALUE) return;
|
||||
+
|
||||
+ dos_path[0] = 0;
|
||||
+ strcat(dos_path, dos_prefix);
|
||||
+ strcat(dos_path, long_path);
|
||||
+
|
||||
+ /* Test VOLUME_NAME_DOS with sufficient buffer size */
|
||||
+ memset(result_path, 0x11, sizeof(result_path));
|
||||
+ count = pGetFinalPathNameByHandleA(hFile, result_path, MAX_PATH, FILE_NAME_NORMALIZED | VOLUME_NAME_DOS);
|
||||
+ ok(count == strlen(dos_path), "Expected length %u, got %u\n", (DWORD)strlen(dos_path), count);
|
||||
+ if (count && count <= MAX_PATH)
|
||||
+ ok(lstrcmpiA(dos_path, result_path) == 0, "Expected %s, got %s\n", dos_path, result_path);
|
||||
+
|
||||
+ /* Test VOLUME_NAME_DOS with insufficient buffer size */
|
||||
+ memset(result_path, 0x11, sizeof(result_path));
|
||||
+ count = pGetFinalPathNameByHandleA(hFile, result_path, strlen(dos_path)-2, FILE_NAME_NORMALIZED | VOLUME_NAME_DOS);
|
||||
+ ok(count == strlen(dos_path), "Expected length %u, got %u\n", (DWORD)strlen(dos_path), count);
|
||||
+ ok(result_path[0] == 0x11, "Result path was modified\n");
|
||||
+
|
||||
+ memset(result_path, 0x11, sizeof(result_path));
|
||||
+ count = pGetFinalPathNameByHandleA(hFile, result_path, strlen(dos_path)-1, FILE_NAME_NORMALIZED | VOLUME_NAME_DOS);
|
||||
+ ok(count == strlen(dos_path), "Expected length %u, got %u\n", (DWORD)strlen(dos_path), count);
|
||||
+ ok(result_path[0] == 0x11, "Result path was modified\n");
|
||||
+
|
||||
+ memset(result_path, 0x11, sizeof(result_path));
|
||||
+ count = pGetFinalPathNameByHandleA(hFile, result_path, strlen(dos_path), FILE_NAME_NORMALIZED | VOLUME_NAME_DOS);
|
||||
+ ok(count == strlen(dos_path), "Expected length %u, got %u\n", (DWORD)strlen(dos_path), count);
|
||||
+ ok(result_path[0] == 0x11, "Result path was modified\n");
|
||||
+
|
||||
+ memset(result_path, 0x11, sizeof(result_path));
|
||||
+ count = pGetFinalPathNameByHandleA(hFile, result_path, strlen(dos_path)+1, FILE_NAME_NORMALIZED | VOLUME_NAME_DOS);
|
||||
+ ok(count == strlen(dos_path), "Expected length %u, got %u\n", (DWORD)strlen(dos_path), count);
|
||||
+ ok(result_path[0] != 0x11, "Result path was not modified\n");
|
||||
+ ok(result_path[strlen(dos_path)+1] == 0x11, "Buffer overflow\n");
|
||||
+
|
||||
+ CloseHandle(hFile);
|
||||
+}
|
||||
+
|
||||
+static void test_GetFinalPathNameByHandleW(void)
|
||||
+{
|
||||
+ static WCHAR prefix[] = {'G','e','t','F','i','n','a','l','P','a','t','h','N','a','m','e','B','y','H','a','n','d','l','e','W','\0'};
|
||||
+ static WCHAR dos_prefix[] = {'\\','\\','?','\\','\0'};
|
||||
+ WCHAR temp_path[MAX_PATH], test_path[MAX_PATH];
|
||||
+ WCHAR long_path[MAX_PATH], result_path[MAX_PATH];
|
||||
+ WCHAR dos_path[MAX_PATH + sizeof(dos_prefix)];
|
||||
+ WCHAR drive_part[MAX_PATH];
|
||||
+ WCHAR *file_part;
|
||||
+ WCHAR volume_path[MAX_PATH+50];
|
||||
+ WCHAR nt_path[2*MAX_PATH];
|
||||
+ HANDLE hFile;
|
||||
+ DWORD count;
|
||||
+ UINT ret;
|
||||
+
|
||||
+ if (!pGetFinalPathNameByHandleW)
|
||||
+ {
|
||||
+ win_skip("GetFinalPathNameByHandleW is missing\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /* Test calling with INVALID_HANDLE_VALUE */
|
||||
+ SetLastError(0xdeadbeaf);
|
||||
+ count = pGetFinalPathNameByHandleW(INVALID_HANDLE_VALUE, result_path, MAX_PATH, FILE_NAME_NORMALIZED | VOLUME_NAME_DOS);
|
||||
+ ok(count == 0, "Expected length 0, got %d\n", count);
|
||||
+ ok(GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
|
||||
+
|
||||
+ count = GetTempPathW(MAX_PATH, temp_path);
|
||||
+ ok(count, "Failed to get temp path, error %d\n", GetLastError());
|
||||
+ if (!count) return;
|
||||
+
|
||||
+ ret = GetTempFileNameW(temp_path, prefix, 0, test_path);
|
||||
+ ok(ret != 0, "GetTempFileNameW error %d\n", GetLastError());
|
||||
+ if (!ret) return;
|
||||
+
|
||||
+ ret = GetLongPathNameW(test_path, long_path, MAX_PATH);
|
||||
+ ok(ret != 0, "GetLongPathNameW error %d\n", GetLastError());
|
||||
+ if (!ret) return;
|
||||
+
|
||||
+ hFile = CreateFileW(test_path, GENERIC_READ | GENERIC_WRITE, 0, NULL,
|
||||
+ CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, 0);
|
||||
+ ok(hFile != INVALID_HANDLE_VALUE, "CreateFileW error %d\n", GetLastError());
|
||||
+ if (hFile == INVALID_HANDLE_VALUE) return;
|
||||
+
|
||||
+ dos_path[0] = 0;
|
||||
+ lstrcatW(dos_path, dos_prefix);
|
||||
+ lstrcatW(dos_path, long_path);
|
||||
+
|
||||
+ /* Test VOLUME_NAME_DOS with sufficient buffer size */
|
||||
+ memset(result_path, 0x11, sizeof(result_path));
|
||||
+ count = pGetFinalPathNameByHandleW(hFile, result_path, MAX_PATH, FILE_NAME_NORMALIZED | VOLUME_NAME_DOS);
|
||||
+ ok(count == lstrlenW(dos_path), "Expected length %d, got %d\n", lstrlenW(dos_path), count);
|
||||
+ if (count && count <= MAX_PATH)
|
||||
+ ok(lstrcmpiW(dos_path, result_path) == 0, "Expected %s, got %s\n", wine_dbgstr_w(dos_path), wine_dbgstr_w(result_path));
|
||||
+
|
||||
+ /* Test VOLUME_NAME_DOS with insufficient buffer size */
|
||||
+ memset(result_path, 0x11, sizeof(result_path));
|
||||
+ count = pGetFinalPathNameByHandleW(hFile, result_path, lstrlenW(dos_path)-1, FILE_NAME_NORMALIZED | VOLUME_NAME_DOS);
|
||||
+ ok(count == lstrlenW(dos_path) + 1, "Expected length %d, got %d\n", lstrlenW(dos_path) + 1, count);
|
||||
+ ok(result_path[0] == 0x1111, "Result path was modified\n");
|
||||
+
|
||||
+ memset(result_path, 0x11, sizeof(result_path));
|
||||
+ count = pGetFinalPathNameByHandleW(hFile, result_path, lstrlenW(dos_path), FILE_NAME_NORMALIZED | VOLUME_NAME_DOS);
|
||||
+ ok(count == lstrlenW(dos_path) + 1, "Expected length %d, got %d\n", lstrlenW(dos_path) + 1, count);
|
||||
+ ok(result_path[0] == 0x1111, "Result path was modified\n");
|
||||
+
|
||||
+ memset(result_path, 0x11, sizeof(result_path));
|
||||
+ count = pGetFinalPathNameByHandleW(hFile, result_path, lstrlenW(dos_path)+1, FILE_NAME_NORMALIZED | VOLUME_NAME_DOS);
|
||||
+ ok(count == lstrlenW(dos_path), "Expected length %d, got %d\n", lstrlenW(dos_path), count);
|
||||
+ ok(result_path[0] != 0x1111, "Result path was not modified\n");
|
||||
+ ok(result_path[lstrlenW(dos_path)+1] == 0x1111, "Buffer overflow\n");
|
||||
+
|
||||
+ if (!GetVolumePathNameW(long_path, drive_part, MAX_PATH))
|
||||
+ {
|
||||
+ ok(0, "Failed to get drive part, error: %d\n", GetLastError());
|
||||
+ CloseHandle(hFile);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (!GetVolumeNameForVolumeMountPointW(drive_part, volume_path, sizeof(volume_path) / sizeof(WCHAR)))
|
||||
+ ok(0, "GetVolumeNameForVolumeMountPointW failed, error: %d\n", GetLastError());
|
||||
+ else
|
||||
+ {
|
||||
+ /* Test for VOLUME_NAME_GUID */
|
||||
+ lstrcatW(volume_path, long_path + lstrlenW(drive_part));
|
||||
+ memset(result_path, 0x11, sizeof(result_path));
|
||||
+ count = pGetFinalPathNameByHandleW(hFile, result_path, MAX_PATH, FILE_NAME_NORMALIZED | VOLUME_NAME_GUID);
|
||||
+ ok(count == lstrlenW(volume_path), "Expected length %d, got %d\n", lstrlenW(volume_path), count);
|
||||
+ if (count && count <= MAX_PATH)
|
||||
+ ok(lstrcmpiW(volume_path, result_path) == 0, "Expected %s, got %s\n",
|
||||
+ wine_dbgstr_w(volume_path), wine_dbgstr_w(result_path));
|
||||
+ }
|
||||
+
|
||||
+ /* Test for VOLUME_NAME_NONE */
|
||||
+ file_part = long_path + lstrlenW(drive_part) - 1;
|
||||
+ memset(result_path, 0x11, sizeof(result_path));
|
||||
+ count = pGetFinalPathNameByHandleW(hFile, result_path, MAX_PATH, FILE_NAME_NORMALIZED | VOLUME_NAME_NONE);
|
||||
+ ok(count == lstrlenW(file_part), "Expected length %d, got %d\n", lstrlenW(file_part), count);
|
||||
+ if (count && count <= MAX_PATH)
|
||||
+ ok(lstrcmpiW(file_part, result_path) == 0, "Expected %s, got %s\n",
|
||||
+ wine_dbgstr_w(file_part), wine_dbgstr_w(result_path));
|
||||
+
|
||||
+ drive_part[lstrlenW(drive_part)-1] = 0;
|
||||
+ if (!QueryDosDeviceW(drive_part, nt_path, sizeof(nt_path) / sizeof(WCHAR)))
|
||||
+ ok(0, "QueryDosDeviceW failed, error: %d\n", GetLastError());
|
||||
+ else
|
||||
+ {
|
||||
+ /* Test for VOLUME_NAME_NT */
|
||||
+ lstrcatW(nt_path, file_part);
|
||||
+ memset(result_path, 0x11, sizeof(result_path));
|
||||
+ count = pGetFinalPathNameByHandleW(hFile, result_path, MAX_PATH, FILE_NAME_NORMALIZED | VOLUME_NAME_NT);
|
||||
+ ok(count == lstrlenW(nt_path), "Expected length %d, got %d\n", lstrlenW(nt_path), count);
|
||||
+ if (count && count <= MAX_PATH)
|
||||
+ ok(lstrcmpiW(nt_path, result_path) == 0, "Expected %s, got %s\n",
|
||||
+ wine_dbgstr_w(nt_path), wine_dbgstr_w(result_path));
|
||||
+ }
|
||||
+
|
||||
+ CloseHandle(hFile);
|
||||
+}
|
||||
+
|
||||
START_TEST(file)
|
||||
{
|
||||
InitFunctionPointers();
|
||||
@@ -4234,4 +4436,6 @@ START_TEST(file)
|
||||
test_SetFileValidData();
|
||||
test_WriteFileGather();
|
||||
test_file_access();
|
||||
+ test_GetFinalPathNameByHandleA();
|
||||
+ test_GetFinalPathNameByHandleW();
|
||||
}
|
||||
--
|
||||
2.2.1
|
||||
|
||||
Reference in New Issue
Block a user