Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52645 Signed-off-by: Gijs Vermeulen gijsvrm@gmail.com --- dlls/kernelbase/kernelbase.spec | 4 ++-- dlls/kernelbase/path.c | 32 ++++++++++++++++++++++++-------- dlls/shlwapi/shlwapi.spec | 2 ++ include/shlwapi.h | 8 ++++++++ 4 files changed, 36 insertions(+), 10 deletions(-)
diff --git a/dlls/kernelbase/kernelbase.spec b/dlls/kernelbase/kernelbase.spec index c1175af2f9fe..a59d8581ff04 100644 --- a/dlls/kernelbase/kernelbase.spec +++ b/dlls/kernelbase/kernelbase.spec @@ -1124,8 +1124,8 @@ @ stdcall PathIsValidCharA(long long) @ stdcall PathIsValidCharW(long long) @ stdcall PathMatchSpecA(str str) -# @ stub PathMatchSpecExA -# @ stub PathMatchSpecExW +@ stdcall PathMatchSpecExA(str str long) +@ stdcall PathMatchSpecExW(wstr wstr long) @ stdcall PathMatchSpecW(wstr wstr) @ stdcall PathParseIconLocationA(str) @ stdcall PathParseIconLocationW(wstr) diff --git a/dlls/kernelbase/path.c b/dlls/kernelbase/path.c index f83c68e14f55..d59f20adb6ef 100644 --- a/dlls/kernelbase/path.c +++ b/dlls/kernelbase/path.c @@ -2425,24 +2425,32 @@ BOOL WINAPI PathRelativePathToW(WCHAR *path, const WCHAR *from, DWORD attributes return TRUE; }
-BOOL WINAPI PathMatchSpecA(const char *path, const char *mask) +HRESULT WINAPI PathMatchSpecExA(const char *path, const char *mask, DWORD flags) { WCHAR *pathW, *maskW; - BOOL ret; + HRESULT ret;
TRACE("%s, %s\n", wine_dbgstr_a(path), wine_dbgstr_a(mask));
+ if (flags) + FIXME("Ignoring flags %#lx.", flags); + if (!lstrcmpA(mask, "*.*")) - return TRUE; /* Matches every path */ + return S_OK; /* Matches every path */
pathW = heap_strdupAtoW( path ); maskW = heap_strdupAtoW( mask ); - ret = PathMatchSpecW( pathW, maskW ); + ret = PathMatchSpecExW( pathW, maskW, flags ); heap_free( pathW ); heap_free( maskW ); return ret; }
+BOOL WINAPI PathMatchSpecA(const char *path, const char *mask) +{ + return PathMatchSpecExA(path, mask, 0) == S_OK; +} + static BOOL path_match_maskW(const WCHAR *name, const WCHAR *mask) { while (*name && *mask && *mask != ';') @@ -2475,12 +2483,15 @@ static BOOL path_match_maskW(const WCHAR *name, const WCHAR *mask) return FALSE; }
-BOOL WINAPI PathMatchSpecW(const WCHAR *path, const WCHAR *mask) +HRESULT WINAPI PathMatchSpecExW(const WCHAR *path, const WCHAR *mask, DWORD flags) { TRACE("%s, %s\n", wine_dbgstr_w(path), wine_dbgstr_w(mask));
+ if (flags) + FIXME("Ignoring flags %#lx.", flags); + if (!lstrcmpW(mask, L"*.*")) - return TRUE; /* Matches every path */ + return S_OK; /* Matches every path */
while (*mask) { @@ -2488,7 +2499,7 @@ BOOL WINAPI PathMatchSpecW(const WCHAR *path, const WCHAR *mask) mask++; /* Eat leading spaces */
if (path_match_maskW(path, mask)) - return TRUE; /* Matches the current path */ + return S_OK; /* Matches the current path */
while (*mask && *mask != ';') mask++; /* masks separated by ';' */ @@ -2497,7 +2508,12 @@ BOOL WINAPI PathMatchSpecW(const WCHAR *path, const WCHAR *mask) mask++; }
- return FALSE; + return S_FALSE; +} + +BOOL WINAPI PathMatchSpecW(const WCHAR *path, const WCHAR *mask) +{ + return PathMatchSpecExW(path, mask, 0) == S_OK; }
void WINAPI PathQuoteSpacesA(char *path) diff --git a/dlls/shlwapi/shlwapi.spec b/dlls/shlwapi/shlwapi.spec index c61e45b02705..801b2c9a8908 100644 --- a/dlls/shlwapi/shlwapi.spec +++ b/dlls/shlwapi/shlwapi.spec @@ -642,6 +642,8 @@ @ stdcall PathMakeSystemFolderA(str) @ stdcall PathMakeSystemFolderW(wstr) @ stdcall -import PathMatchSpecA(str str) +@ stdcall -import PathMatchSpecExA(str str long) +@ stdcall -import PathMatchSpecExW(wstr wstr long) @ stdcall -import PathMatchSpecW(wstr wstr) @ stdcall -import PathParseIconLocationA(str) @ stdcall -import PathParseIconLocationW(wstr) diff --git a/include/shlwapi.h b/include/shlwapi.h index 07ca0fac837f..a282ae6d9939 100644 --- a/include/shlwapi.h +++ b/include/shlwapi.h @@ -482,6 +482,14 @@ BOOL WINAPI PathMatchSpecA(LPCSTR,LPCSTR); BOOL WINAPI PathMatchSpecW(LPCWSTR,LPCWSTR); #define PathMatchSpec WINELIB_NAME_AW(PathMatchSpec)
+#define PMSF_NORMAL 0x00000000 +#define PMSF_MULTIPLE 0x00000001 +#define PMSF_DONT_STRIP_SPACES 0x00010000 + +HRESULT WINAPI PathMatchSpecExA(LPCSTR,LPCSTR,DWORD); +HRESULT WINAPI PathMatchSpecExW(LPCWSTR,LPCWSTR,DWORD); +#define PathMatchSpecEx WINELIB_NAME_AW(PathMatchSpecEx) + int WINAPI PathParseIconLocationA(LPSTR); int WINAPI PathParseIconLocationW(LPWSTR); #define PathParseIconLocation WINELIB_NAME_AW(PathParseIconLocation)