Commit 205a9322 authored by Gijs Vermeulen's avatar Gijs Vermeulen Committed by Alexandre Julliard

kernelbase: Add PathMatchSpecExA/W.

parent d8671965
...@@ -1124,8 +1124,8 @@ ...@@ -1124,8 +1124,8 @@
@ stdcall PathIsValidCharA(long long) @ stdcall PathIsValidCharA(long long)
@ stdcall PathIsValidCharW(long long) @ stdcall PathIsValidCharW(long long)
@ stdcall PathMatchSpecA(str str) @ stdcall PathMatchSpecA(str str)
# @ stub PathMatchSpecExA @ stdcall PathMatchSpecExA(str str long)
# @ stub PathMatchSpecExW @ stdcall PathMatchSpecExW(wstr wstr long)
@ stdcall PathMatchSpecW(wstr wstr) @ stdcall PathMatchSpecW(wstr wstr)
@ stdcall PathParseIconLocationA(str) @ stdcall PathParseIconLocationA(str)
@ stdcall PathParseIconLocationW(wstr) @ stdcall PathParseIconLocationW(wstr)
......
...@@ -2425,24 +2425,32 @@ BOOL WINAPI PathRelativePathToW(WCHAR *path, const WCHAR *from, DWORD attributes ...@@ -2425,24 +2425,32 @@ BOOL WINAPI PathRelativePathToW(WCHAR *path, const WCHAR *from, DWORD attributes
return TRUE; 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; WCHAR *pathW, *maskW;
BOOL ret; HRESULT ret;
TRACE("%s, %s\n", wine_dbgstr_a(path), wine_dbgstr_a(mask)); TRACE("%s, %s\n", wine_dbgstr_a(path), wine_dbgstr_a(mask));
if (flags)
FIXME("Ignoring flags %#lx.", flags);
if (!lstrcmpA(mask, "*.*")) if (!lstrcmpA(mask, "*.*"))
return TRUE; /* Matches every path */ return S_OK; /* Matches every path */
pathW = heap_strdupAtoW( path ); pathW = heap_strdupAtoW( path );
maskW = heap_strdupAtoW( mask ); maskW = heap_strdupAtoW( mask );
ret = PathMatchSpecW( pathW, maskW ); ret = PathMatchSpecExW( pathW, maskW, flags );
heap_free( pathW ); heap_free( pathW );
heap_free( maskW ); heap_free( maskW );
return ret; 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) static BOOL path_match_maskW(const WCHAR *name, const WCHAR *mask)
{ {
while (*name && *mask && *mask != ';') while (*name && *mask && *mask != ';')
...@@ -2475,12 +2483,15 @@ static BOOL path_match_maskW(const WCHAR *name, const WCHAR *mask) ...@@ -2475,12 +2483,15 @@ static BOOL path_match_maskW(const WCHAR *name, const WCHAR *mask)
return FALSE; 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)); TRACE("%s, %s\n", wine_dbgstr_w(path), wine_dbgstr_w(mask));
if (flags)
FIXME("Ignoring flags %#lx.", flags);
if (!lstrcmpW(mask, L"*.*")) if (!lstrcmpW(mask, L"*.*"))
return TRUE; /* Matches every path */ return S_OK; /* Matches every path */
while (*mask) while (*mask)
{ {
...@@ -2488,7 +2499,7 @@ BOOL WINAPI PathMatchSpecW(const WCHAR *path, const WCHAR *mask) ...@@ -2488,7 +2499,7 @@ BOOL WINAPI PathMatchSpecW(const WCHAR *path, const WCHAR *mask)
mask++; /* Eat leading spaces */ mask++; /* Eat leading spaces */
if (path_match_maskW(path, mask)) if (path_match_maskW(path, mask))
return TRUE; /* Matches the current path */ return S_OK; /* Matches the current path */
while (*mask && *mask != ';') while (*mask && *mask != ';')
mask++; /* masks separated by ';' */ mask++; /* masks separated by ';' */
...@@ -2497,7 +2508,12 @@ BOOL WINAPI PathMatchSpecW(const WCHAR *path, const WCHAR *mask) ...@@ -2497,7 +2508,12 @@ BOOL WINAPI PathMatchSpecW(const WCHAR *path, const WCHAR *mask)
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) void WINAPI PathQuoteSpacesA(char *path)
......
...@@ -642,6 +642,8 @@ ...@@ -642,6 +642,8 @@
@ stdcall PathMakeSystemFolderA(str) @ stdcall PathMakeSystemFolderA(str)
@ stdcall PathMakeSystemFolderW(wstr) @ stdcall PathMakeSystemFolderW(wstr)
@ stdcall -import PathMatchSpecA(str str) @ stdcall -import PathMatchSpecA(str str)
@ stdcall -import PathMatchSpecExA(str str long)
@ stdcall -import PathMatchSpecExW(wstr wstr long)
@ stdcall -import PathMatchSpecW(wstr wstr) @ stdcall -import PathMatchSpecW(wstr wstr)
@ stdcall -import PathParseIconLocationA(str) @ stdcall -import PathParseIconLocationA(str)
@ stdcall -import PathParseIconLocationW(wstr) @ stdcall -import PathParseIconLocationW(wstr)
......
...@@ -482,6 +482,14 @@ BOOL WINAPI PathMatchSpecA(LPCSTR,LPCSTR); ...@@ -482,6 +482,14 @@ BOOL WINAPI PathMatchSpecA(LPCSTR,LPCSTR);
BOOL WINAPI PathMatchSpecW(LPCWSTR,LPCWSTR); BOOL WINAPI PathMatchSpecW(LPCWSTR,LPCWSTR);
#define PathMatchSpec WINELIB_NAME_AW(PathMatchSpec) #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 PathParseIconLocationA(LPSTR);
int WINAPI PathParseIconLocationW(LPWSTR); int WINAPI PathParseIconLocationW(LPWSTR);
#define PathParseIconLocation WINELIB_NAME_AW(PathParseIconLocation) #define PathParseIconLocation WINELIB_NAME_AW(PathParseIconLocation)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment