kernelbase: Add PathMatchSpecExA/W.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52645
Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gijs Vermeulen 2022-03-13 01:27:34 +01:00 committed by Alexandre Julliard
parent d867196553
commit 205a9322f1
4 changed files with 36 additions and 10 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)