Piotr Caban : shlwapi: Fix PathIsContentTypeA implementation.
Alexandre Julliard
julliard at winehq.org
Thu Apr 4 15:38:09 CDT 2019
Module: wine
Branch: master
Commit: 28f7e4615d9a02b6f556434e51568aab68edc35e
URL: https://source.winehq.org/git/wine.git/?a=commit;h=28f7e4615d9a02b6f556434e51568aab68edc35e
Author: Piotr Caban <piotr at codeweavers.com>
Date: Thu Apr 4 16:01:03 2019 +0200
shlwapi: Fix PathIsContentTypeA implementation.
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/shlwapi/path.c | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/dlls/shlwapi/path.c b/dlls/shlwapi/path.c
index ad78c5d..1c4af7e 100644
--- a/dlls/shlwapi/path.c
+++ b/dlls/shlwapi/path.c
@@ -2027,22 +2027,18 @@ BOOL WINAPI PathIsSameRootW(LPCWSTR lpszPath1, LPCWSTR lpszPath2)
* a content type is registered, it is compared (case insensitively) to
* lpszContentType. Only if this matches does the function succeed.
*/
-BOOL WINAPI PathIsContentTypeA(LPCSTR lpszPath, LPCSTR lpszContentType)
+BOOL WINAPI PathIsContentTypeA(LPCSTR path, LPCSTR content_type)
{
- LPCSTR szExt;
- DWORD dwDummy;
- char szBuff[MAX_PATH];
+ char buf[MAX_PATH];
+ DWORD size = sizeof(buf);
+ LPCSTR ext;
- TRACE("(%s,%s)\n", debugstr_a(lpszPath), debugstr_a(lpszContentType));
+ TRACE("(%s,%s)\n", debugstr_a(path), debugstr_a(content_type));
- if (lpszPath && (szExt = PathFindExtensionA(lpszPath)) && *szExt &&
- !SHGetValueA(HKEY_CLASSES_ROOT, szExt, "Content Type",
- REG_NONE, szBuff, &dwDummy) &&
- !strcasecmp(lpszContentType, szBuff))
- {
- return TRUE;
- }
- return FALSE;
+ if(!path) return FALSE;
+ if(!(ext = PathFindExtensionA(path)) || !*ext) return FALSE;
+ if(SHGetValueA(HKEY_CLASSES_ROOT, ext, "Content Type", NULL, buf, &size)) return FALSE;
+ return !lstrcmpiA(content_type, buf);
}
/*************************************************************************
More information about the wine-cvs
mailing list