diff --git a/patches/kernelbase-PathCchCombineEx/0001-kernelbase-Add-semi-stub-for-PathCchCombineEx.patch b/patches/kernelbase-PathCchCombineEx/0001-kernelbase-Add-semi-stub-for-PathCchCombineEx.patch new file mode 100644 index 00000000..01a15f37 --- /dev/null +++ b/patches/kernelbase-PathCchCombineEx/0001-kernelbase-Add-semi-stub-for-PathCchCombineEx.patch @@ -0,0 +1,294 @@ +From 8cd69f6811475c6ba3ecf28588193bfd9fb91e34 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Wed, 16 Aug 2017 02:45:23 +0200 +Subject: kernelbase: Add semi-stub for PathCchCombineEx. + +--- + configure.ac | 3 +- + .../api-ms-win-core-path-l1-1-0.spec | 2 +- + dlls/kernelbase/Makefile.in | 4 +- + dlls/kernelbase/kernelbase.spec | 2 +- + dlls/kernelbase/main.c | 29 ++++++ + dlls/kernelbase/tests/Makefile.in | 5 + + dlls/kernelbase/tests/path.c | 113 +++++++++++++++++++++ + include/Makefile.in | 1 + + include/pathcch.h | 26 +++++ + 9 files changed, 181 insertions(+), 4 deletions(-) + create mode 100644 dlls/kernelbase/tests/Makefile.in + create mode 100644 dlls/kernelbase/tests/path.c + create mode 100644 include/pathcch.h + +diff --git a/configure.ac b/configure.ac +index 5979934047d..fd05212057f 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3323,7 +3323,8 @@ WINE_CONFIG_DLL(jsproxy,,[implib]) + WINE_CONFIG_TEST(dlls/jsproxy/tests) + WINE_CONFIG_DLL(kernel32,,[clean,implib]) + WINE_CONFIG_TEST(dlls/kernel32/tests) +-WINE_CONFIG_DLL(kernelbase) ++WINE_CONFIG_DLL(kernelbase,,[implib]) ++WINE_CONFIG_TEST(dlls/kernelbase/tests) + WINE_CONFIG_DLL(keyboard.drv16,enable_win16) + WINE_CONFIG_DLL(krnl386.exe16,enable_win16,[implib],[kernel]) + WINE_CONFIG_DLL(ksuser) +diff --git a/dlls/api-ms-win-core-path-l1-1-0/api-ms-win-core-path-l1-1-0.spec b/dlls/api-ms-win-core-path-l1-1-0/api-ms-win-core-path-l1-1-0.spec +index cb10d89773c..4df147e6611 100644 +--- a/dlls/api-ms-win-core-path-l1-1-0/api-ms-win-core-path-l1-1-0.spec ++++ b/dlls/api-ms-win-core-path-l1-1-0/api-ms-win-core-path-l1-1-0.spec +@@ -8,7 +8,7 @@ + @ stub PathCchCanonicalize + @ stub PathCchCanonicalizeEx + @ stub PathCchCombine +-@ stub PathCchCombineEx ++@ stdcall PathCchCombineEx(ptr long ptr ptr long) kernelbase.PathCchCombineEx + @ stub PathCchFindExtension + @ stub PathCchIsRoot + @ stub PathCchRemoveBackslash +diff --git a/dlls/kernelbase/Makefile.in b/dlls/kernelbase/Makefile.in +index 74df98ce2d5..247c6bf392a 100644 +--- a/dlls/kernelbase/Makefile.in ++++ b/dlls/kernelbase/Makefile.in +@@ -1,4 +1,6 @@ +-MODULE = kernelbase.dll ++MODULE = kernelbase.dll ++IMPORTLIB = kernelbase ++IMPORTS = shlwapi + + C_SRCS = \ + main.c +diff --git a/dlls/kernelbase/kernelbase.spec b/dlls/kernelbase/kernelbase.spec +index 4523c6a0b6f..05cafa377bd 100644 +--- a/dlls/kernelbase/kernelbase.spec ++++ b/dlls/kernelbase/kernelbase.spec +@@ -1037,7 +1037,7 @@ + # @ stub PathCchCanonicalize + # @ stub PathCchCanonicalizeEx + # @ stub PathCchCombine +-# @ stub PathCchCombineEx ++@ stdcall PathCchCombineEx(ptr long ptr ptr long) + # @ stub PathCchFindExtension + # @ stub PathCchIsRoot + # @ stub PathCchRemoveBackslash +diff --git a/dlls/kernelbase/main.c b/dlls/kernelbase/main.c +index 6673f9b63e0..00dacfe28c1 100644 +--- a/dlls/kernelbase/main.c ++++ b/dlls/kernelbase/main.c +@@ -17,7 +17,11 @@ + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + ++#include "shlwapi.h" ++#include "strsafe.h" ++ + #include "wine/debug.h" ++#include "wine/unicode.h" + + WINE_DEFAULT_DEBUG_CHANNEL(kernelbase); + +@@ -38,3 +42,28 @@ BOOL WINAPI QuirkIsEnabled3(void *unk1, void *unk2) + FIXME("(%p, %p) stub!\n", unk1, unk2); + return FALSE; + } ++ ++/*********************************************************************** ++ * PathCchCombineEx (KERNELBASE.@) ++ */ ++HRESULT WINAPI PathCchCombineEx(WCHAR *out, SIZE_T size, const WCHAR *path1, const WCHAR *path2, DWORD flags) ++{ ++ WCHAR result[MAX_PATH]; ++ ++ FIXME("(%p, %lu, %s, %s, %x): semi-stub\n", out, size, wine_dbgstr_w(path1), wine_dbgstr_w(path2), flags); ++ ++ if (!out || !size) return E_INVALIDARG; ++ if (flags) FIXME("Flags %x not supported\n", flags); ++ ++ if (!PathCombineW(result, path1, path2)) ++ return E_INVALIDARG; ++ ++ if (strlenW(result) + 1 > size) ++ { ++ out[0] = 0; ++ return STRSAFE_E_INSUFFICIENT_BUFFER; ++ } ++ ++ strcpyW(out, result); ++ return S_OK; ++} +diff --git a/dlls/kernelbase/tests/Makefile.in b/dlls/kernelbase/tests/Makefile.in +new file mode 100644 +index 00000000000..92f5ca57131 +--- /dev/null ++++ b/dlls/kernelbase/tests/Makefile.in +@@ -0,0 +1,5 @@ ++TESTDLL = kernelbase.dll ++IMPORTS = kernelbase ++ ++C_SRCS = \ ++ path.c +diff --git a/dlls/kernelbase/tests/path.c b/dlls/kernelbase/tests/path.c +new file mode 100644 +index 00000000000..c848640a030 +--- /dev/null ++++ b/dlls/kernelbase/tests/path.c +@@ -0,0 +1,113 @@ ++/* ++ * Path tests for kernelbase.dll ++ * ++ * Copyright 2017 Michael Müller ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "wine/test.h" ++ ++static const struct ++{ ++ const char *path1; ++ const char *path2; ++ const char *result; ++ BOOL todo; ++} ++combine_test[] = ++{ ++ /* nomal paths */ ++ {"C:\\", "a", "C:\\a", FALSE}, ++ {"C:\\b", "..\\a", "C:\\a", FALSE}, ++ {"C:", "a", "C:\\a", FALSE}, ++ {"C:\\", ".", "C:\\", TRUE}, ++ {"C:\\", "..", "C:\\", FALSE}, ++ {"\\a", "b", "\\a\\b", FALSE}, ++ ++ /* normal UNC paths */ ++ {"\\\\192.168.1.1\\test", "a", "\\\\192.168.1.1\\test\\a", FALSE}, ++ {"\\\\192.168.1.1\\test", "..", "\\\\192.168.1.1", FALSE}, ++ ++ /* NT paths */ ++ {"\\\\?\\C:\\", "a", "C:\\a", TRUE}, ++ {"\\\\?\\C:\\", "..", "C:\\", TRUE}, ++ ++ /* NT UNC path */ ++ {"\\\\?\\UNC\\192.168.1.1\\test", "a", "\\\\192.168.1.1\\test\\a", TRUE}, ++ {"\\\\?\\UNC\\192.168.1.1\\test", "..", "\\\\192.168.1.1", TRUE}, ++}; ++ ++static void test_PathCchCombineEx(void) ++{ ++ WCHAR expected[MAX_PATH] = {'C',':','\\','a',0}; ++ WCHAR p1[MAX_PATH] = {'C',':','\\',0}; ++ WCHAR p2[MAX_PATH] = {'a',0}; ++ WCHAR output[MAX_PATH]; ++ HRESULT hr; ++ int i; ++ ++ hr = PathCchCombineEx(NULL, 2, p1, p2, 0); ++ ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr); ++ ++ memset(output, 0xff, sizeof(output)); ++ hr = PathCchCombineEx(output, 0, p1, p2, 0); ++ ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr); ++ ok(output[0] == 0xffff, "Expected output buffer to be unchanged\n"); ++ ++ memset(output, 0xff, sizeof(output)); ++ hr = PathCchCombineEx(output, 1, p1, p2, 0); ++ ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "Expected STRSAFE_E_INSUFFICIENT_BUFFER, got %08x\n", hr); ++ ok(output[0] == 0, "Expected output buffer to contain NULL string\n"); ++ ++ memset(output, 0xff, sizeof(output)); ++ hr = PathCchCombineEx(output, 4, p1, p2, 0); ++ ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "Expected STRSAFE_E_INSUFFICIENT_BUFFER, got %08x\n", hr); ++ ok(output[0] == 0x0, "Expected output buffer to contain NULL string\n"); ++ ++ memset(output, 0xff, sizeof(output)); ++ hr = PathCchCombineEx(output, 5, p1, p2, 0); ++ ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ++ ok(!lstrcmpW(output, expected), ++ "Combination of %s + %s returned %s, expected %s\n", ++ wine_dbgstr_w(p1), wine_dbgstr_w(p2), wine_dbgstr_w(output), wine_dbgstr_w(expected)); ++ ++ for (i = 0; i < sizeof(combine_test)/sizeof(combine_test[0]); i++) ++ { ++ MultiByteToWideChar(CP_ACP, 0, combine_test[i].path1, -1, p1, MAX_PATH); ++ MultiByteToWideChar(CP_ACP, 0, combine_test[i].path2, -1, p2, MAX_PATH); ++ MultiByteToWideChar(CP_ACP, 0, combine_test[i].result, -1, expected, MAX_PATH); ++ ++ hr = PathCchCombineEx(output, MAX_PATH, p1, p2, 0); ++ ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ++ todo_wine_if(combine_test[i].todo) ok(!lstrcmpW(output, expected), ++ "Combination of %s + %s returned %s, expected %s\n", ++ wine_dbgstr_w(p1), wine_dbgstr_w(p2), wine_dbgstr_w(output), wine_dbgstr_w(expected)); ++ } ++} ++ ++START_TEST(path) ++{ ++ test_PathCchCombineEx(); ++} +diff --git a/include/Makefile.in b/include/Makefile.in +index 982a087d531..15f42c4ff3c 100644 +--- a/include/Makefile.in ++++ b/include/Makefile.in +@@ -559,6 +559,7 @@ HEADER_SRCS = \ + oledberr.h \ + oledlg.h \ + patchapi.h \ ++ pathcch.h \ + pdh.h \ + pdhmsg.h \ + physicalmonitorenumerationapi.h \ +diff --git a/include/pathcch.h b/include/pathcch.h +new file mode 100644 +index 00000000000..8831c5238d2 +--- /dev/null ++++ b/include/pathcch.h +@@ -0,0 +1,26 @@ ++/* ++ * Copyright 2017 Michael Müller ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA ++ */ ++ ++#define PATHCCH_NONE 0x00 ++#define PATHCCH_ALLOW_LONG_PATHS 0x01 ++#define PATHCCH_FORCE_ENABLE_LONG_NAME_PROCESS 0x02 ++#define PATHCCH_FORCE_DISABLE_LONG_NAME_PROCESS 0x04 ++#define PATHCCH_DO_NOT_NORMALIZE_SEGMENTS 0x08 ++#define PATHCCH_ENSURE_IS_EXTENDED_LENGTH_PATH 0x10 ++ ++HRESULT WINAPI PathCchCombineEx(WCHAR *out, SIZE_T size, const WCHAR *path1, const WCHAR *path2, DWORD flags); +-- +2.13.1 + diff --git a/patches/kernelbase-PathCchCombineEx/definition b/patches/kernelbase-PathCchCombineEx/definition new file mode 100644 index 00000000..22110c1b --- /dev/null +++ b/patches/kernelbase-PathCchCombineEx/definition @@ -0,0 +1 @@ +Fixes: [42474] Implement kernelbase.PathCchCombineEx diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index ddb932cb..b82f696f 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -209,6 +209,7 @@ patch_enable_all () enable_kernel32_TimezoneInformation_Registry="$1" enable_kernel32_UmsStubs="$1" enable_kernel32_VerifyVersionInfo="$1" + enable_kernelbase_PathCchCombineEx="$1" enable_krnl386_exe16_GDT_LDT_Emulation="$1" enable_krnl386_exe16_Invalid_Console_Handles="$1" enable_krnl386_exe16__lclose16="$1" @@ -897,6 +898,9 @@ patch_enable () kernel32-VerifyVersionInfo) enable_kernel32_VerifyVersionInfo="$2" ;; + kernelbase-PathCchCombineEx) + enable_kernelbase_PathCchCombineEx="$2" + ;; krnl386.exe16-GDT_LDT_Emulation) enable_krnl386_exe16_GDT_LDT_Emulation="$2" ;; @@ -5498,6 +5502,23 @@ if test "$enable_kernel32_VerifyVersionInfo" -eq 1; then ) >> "$patchlist" fi +# Patchset kernelbase-PathCchCombineEx +# | +# | This patchset fixes the following Wine bugs: +# | * [#42474] Implement kernelbase.PathCchCombineEx +# | +# | Modified files: +# | * configure.ac, dlls/api-ms-win-core-path-l1-1-0/api-ms-win-core-path-l1-1-0.spec, dlls/kernelbase/Makefile.in, +# | dlls/kernelbase/kernelbase.spec, dlls/kernelbase/main.c, dlls/kernelbase/tests/Makefile.in, +# | dlls/kernelbase/tests/path.c, include/Makefile.in, include/pathcch.h +# | +if test "$enable_kernelbase_PathCchCombineEx" -eq 1; then + patch_apply kernelbase-PathCchCombineEx/0001-kernelbase-Add-semi-stub-for-PathCchCombineEx.patch + ( + printf '%s\n' '+ { "Michael Müller", "kernelbase: Add semi-stub for PathCchCombineEx.", 1 },'; + ) >> "$patchlist" +fi + # Patchset krnl386.exe16-GDT_LDT_Emulation # | # | This patchset fixes the following Wine bugs: