From 10b77a99721bcc019bb44ad846363848e4ef5101 Mon Sep 17 00:00:00 2001 From: "Guy L. Albertelli" Date: Sat, 1 Dec 2001 00:37:12 +0000 Subject: [PATCH] - Fixed PathIsURL{A|W}. - Implemented PathRenameExtension{A|W}, SHRegDuplicateHKey, ChrCmpI{A|W}. - Added forwards to DrawTextW, CreateDialogParamA, CreateFontW, TracePopupMenuEx. --- dlls/shlwapi/path.c | 76 ++++++++++++++++----------------------- dlls/shlwapi/reg.c | 12 +++++++ dlls/shlwapi/shlwapi.spec | 58 +++++++++++++++--------------- dlls/shlwapi/string.c | 22 ++++++++++++ 4 files changed, 94 insertions(+), 74 deletions(-) diff --git a/dlls/shlwapi/path.c b/dlls/shlwapi/path.c index 50817cffda..20ed42bad3 100644 --- a/dlls/shlwapi/path.c +++ b/dlls/shlwapi/path.c @@ -13,7 +13,7 @@ #include "winreg.h" #include "shlwapi.h" #include "debugtools.h" - +#include "ordinal.h" DEFAULT_DEBUG_CHANNEL(shell); @@ -1152,27 +1152,15 @@ BOOL WINAPI PathIsSameRootW(LPCWSTR lpszPath1, LPCWSTR lpszPath2) */ BOOL WINAPI PathIsURLA(LPCSTR lpstrPath) { - LPSTR lpstrRes; - int iSize, i=0; - static LPSTR SupportedProtocol[] = - {"http","https","ftp","gopher","file","mailto",NULL}; + UNKNOWN_SHLWAPI_1 base; + DWORD res1; - if(!lpstrPath) return FALSE; + if(!lpstrPath) return FALSE; - /* get protocol */ - lpstrRes = strchr(lpstrPath,':'); - if(!lpstrRes) return FALSE; - iSize = lpstrRes - lpstrPath; - - while(SupportedProtocol[i]) - { - if (iSize == strlen(SupportedProtocol[i])) - if(!strncasecmp(lpstrPath, SupportedProtocol[i], iSize)) - return TRUE; - i++; - } - - return FALSE; + /* get protocol */ + base.size = 24; + res1 = SHLWAPI_1(lpstrPath, &base); + return (base.fcncde) ? TRUE : FALSE; } /************************************************************************* @@ -1180,29 +1168,15 @@ BOOL WINAPI PathIsURLA(LPCSTR lpstrPath) */ BOOL WINAPI PathIsURLW(LPCWSTR lpstrPath) { - LPWSTR lpstrRes; - int iSize, i=0; - static WCHAR SupportedProtocol[7][7] = - {{'h','t','t','p','\0'},{'h','t','t','p','s','\0'},{'f','t','p','\0'}, - {'g','o','p','h','e','r','\0'},{'f','i','l','e','\0'}, - {'m','a','i','l','t','o','\0'},{0}}; + UNKNOWN_SHLWAPI_2 base; + DWORD res1; - if(!lpstrPath) return FALSE; + if(!lpstrPath) return FALSE; - /* get protocol */ - lpstrRes = strchrW(lpstrPath,':'); - if(!lpstrRes) return FALSE; - iSize = lpstrRes - lpstrPath; - - while(SupportedProtocol[i]) - { - if (iSize == strlenW(SupportedProtocol[i])) - if(!strncmpiW(lpstrPath, SupportedProtocol[i], iSize)) - return TRUE; - i++; - } - - return FALSE; + /* get protocol */ + base.size = 24; + res1 = SHLWAPI_2(lpstrPath, &base); + return (base.fcncde) ? TRUE : FALSE; } @@ -1721,8 +1695,14 @@ BOOL WINAPI PathMakeSystemFolderW(LPCWSTR pszPath) */ BOOL WINAPI PathRenameExtensionA(LPSTR pszPath, LPCSTR pszExt) { - FIXME("%s %s\n", pszPath, pszExt); - return FALSE; + LPSTR pszExtension = PathFindExtensionA(pszPath); + + if (!pszExtension) return FALSE; + if (pszExtension-pszPath + strlen(pszExt) > MAX_PATH) return FALSE; + + strcpy(pszExtension, pszExt); + TRACE("%s\n", pszPath); + return TRUE; } /************************************************************************* @@ -1730,8 +1710,14 @@ BOOL WINAPI PathRenameExtensionA(LPSTR pszPath, LPCSTR pszExt) */ BOOL WINAPI PathRenameExtensionW(LPWSTR pszPath, LPCWSTR pszExt) { - FIXME("%s %s\n", debugstr_w(pszPath), debugstr_w(pszExt)); - return FALSE; + LPWSTR pszExtension = PathFindExtensionW(pszPath); + + if (!pszExtension) return FALSE; + if (pszExtension-pszPath + strlenW(pszExt) > MAX_PATH) return FALSE; + + strcpyW(pszExtension, pszExt); + TRACE("%s\n", debugstr_w(pszPath)); + return TRUE; } /************************************************************************* diff --git a/dlls/shlwapi/reg.c b/dlls/shlwapi/reg.c index c6592502f5..f66c72b8e9 100644 --- a/dlls/shlwapi/reg.c +++ b/dlls/shlwapi/reg.c @@ -1046,3 +1046,15 @@ BOOL WINAPI SHLWAPI_323(LPCWSTR lpszSubKey) return ret ? FALSE : TRUE; } + +/************************************************************************* + * SHRegDuplicateHKey [SHLWAPI.@] + */ +HKEY WINAPI SHRegDuplicateHKey(HKEY hKey) +{ + HKEY newKey = 0; + + RegOpenKeyExA(hKey, 0, 0, MAXIMUM_ALLOWED, &newKey); + TRACE("new key is %08x\n", newKey); + return newKey; +} diff --git a/dlls/shlwapi/shlwapi.spec b/dlls/shlwapi/shlwapi.spec index 0a03fe067b..b8a79b30b7 100644 --- a/dlls/shlwapi/shlwapi.spec +++ b/dlls/shlwapi/shlwapi.spec @@ -58,7 +58,7 @@ debug_channels (shell) 46 forward @ user32.CopyAcceleratorTableW 47 forward @ user32.CreateAcceleratorTableW 48 forward @ gdi32.CreateDCW -49 stub @ +49 forward @ user32.CreateDialogParamA 50 forward @ kernel32.CreateDirectoryW 51 forward @ kernel32.CreateEventW 52 forward @ kernel32.CreateFileW @@ -70,7 +70,7 @@ debug_channels (shell) 58 stub @ 59 stub @ 60 forward @ user32.DispatchMessageW -61 stub @ +61 forward @ user32.DrawTextW 62 forward @ gdi32.EnumFontFamiliesW 63 forward @ gdi32.EnumFontFamiliesExW 64 forward @ kernel32.EnumResourceNamesW @@ -173,7 +173,7 @@ debug_channels (shell) 161 stub @ 162 stdcall @(str long) SHLWAPI_162 163 stub @ -164 stub @ +164 stdcall @(ptr ptr ptr ptr ptr ptr) SHLWAPI_164 165 stdcall @(long long long long) SHLWAPI_165 166 stub @ 167 stub @ @@ -181,11 +181,11 @@ debug_channels (shell) 169 stdcall @(long) SHLWAPI_169 170 stdcall @(str) SHLWAPI_170 171 stub @ -172 stub @ +172 stdcall @(ptr ptr) SHLWAPI_172 173 stub @ -174 stub @ +174 stdcall @(ptr ptr) SHLWAPI_174 175 stub @ -176 stub @ +176 stdcall @(ptr ptr ptr ptr) SHLWAPI_176 177 stub @ 178 stub @ 179 stub @ @@ -208,7 +208,7 @@ debug_channels (shell) 196 stub @ 197 stub @ 198 stub @ -199 stub @ +199 stdcall @(ptr ptr) SHLWAPI_199 200 stub @ 201 stub @ 202 stub @ @@ -217,10 +217,10 @@ debug_channels (shell) 205 stdcall @(long str str ptr ptr ptr) SHLWAPI_205 206 stdcall @(long wstr wstr ptr ptr ptr) SHLWAPI_206 207 stub @ -208 stub @ +208 stdcall @(long long ptr ptr long) SHLWAPI_208 209 stub @ -210 stub @ -211 stub @ +210 stdcall @(ptr long ptr) SHLWAPI_210 +211 stdcall @(ptr long) SHLWAPI_211 212 stub @ 213 stub @ 214 stub @ @@ -245,10 +245,10 @@ debug_channels (shell) 233 stub @ 234 stub @ 235 stub @ -236 stub @ +236 stdcall @(ptr) SHLWAPI_236 237 stdcall @(ptr) SHLWAPI_237 238 stub @ -239 stub @ +239 stdcall @(long str long) SHLWAPI_239 240 stdcall @(long long long long) SHLWAPI_240 241 stdcall @() SHLWAPI_241 242 stub @ @@ -309,8 +309,8 @@ debug_channels (shell) 297 stub @ 298 forward @ kernel32.WritePrivateProfileStringW 299 stub @ -300 stub @ -301 forward @ gdi32.DrawTextExW # FIXME CreateFontW +300 forward @ gdi32.CreateFontW +301 forward @ user32.DrawTextExW 302 forward @ user32.GetMenuItemInfoW 303 forward @ user32.InsertMenuItemW 304 forward @ gdi32.CreateMetaFileW @@ -351,7 +351,7 @@ debug_channels (shell) 339 forward @ kernel32.GetNumberFormatW 340 forward @ user32.MessageBoxW 341 forward @ kernel32.FindNextFileW -342 stdcall @(long long long long) SHLWAPI_342 +342 stdcall @(long long long) SHLWAPI_342 343 stub @ 344 stub @ 345 stub @ @@ -365,7 +365,7 @@ debug_channels (shell) 353 stub @ 354 stub @ 355 stub @ -356 stub @ +356 stdcall @(long long long) SHLWAPI_356 357 stdcall @(wstr wstr wstr long long) SHLWAPI_357 358 stdcall @(ptr ptr ptr ptr ptr ptr) SHLWAPI_358 359 forward @ kernel32.OpenEventW @@ -385,17 +385,17 @@ debug_channels (shell) 373 stub @ 374 stub @ 375 stub @ -376 stdcall @(long) SHLWAPI_376 # kernel32.GetUserDefaultUILanguage -377 stdcall @(long long long) SHLWAPI_377 -378 stdcall @(long long long) SHLWAPI_378 +376 stdcall @() SHLWAPI_376 # kernel32.GetUserDefaultUILanguage +377 stdcall @(str long long) SHLWAPI_377 +378 stdcall @(wstr long long) SHLWAPI_378 379 stub @ 380 stub @ 381 stub AssocQueryStringA 382 stub AssocQueryStringByKeyA 383 stub AssocQueryStringByKeyW 384 stub AssocQueryStringW -385 stub ChrCmpIA -386 stub ChrCmpIW +385 stdcall ChrCmpIA(long long) ChrCmpIA +386 stdcall ChrCmpIW(long long) ChrCmpIW 387 stub ColorAdjustLuma 388 stub @ 389 stdcall @(ptr) SHLWAPI_389 @@ -422,7 +422,7 @@ debug_channels (shell) 410 stub @ 411 stub @ 412 stub @ -413 stub @ +413 stdcall @(long) SHLWAPI_413 414 stub @ 415 stub @ 416 stub @ @@ -437,7 +437,7 @@ debug_channels (shell) 425 stub @ 426 stub @ 427 stub @ -428 stub @ +428 forward @ user32.TrackPopupMenuEx 429 stub @ 430 stub @ 431 stdcall @(long) SHLWAPI_431 @@ -454,7 +454,7 @@ debug_channels (shell) 442 forward @ kernel32.GetEnvironmentVariableW 443 forward @ kernel32.GetSystemWindowsDirectoryA 444 forward @ kernel32.GetSystemWindowsDirectoryW -445 stub ColorRGBToHLS +445 stdcall ColorRGBToHLS(long ptr ptr ptr) ColorRGBToHLS 446 stub @ @ stdcall DllGetVersion (ptr) SHLWAPI_DllGetVersion @@ -661,14 +661,14 @@ debug_channels (shell) @ stdcall StrToIntW(wstr)StrToIntW @ stdcall StrTrimA(str str) StrTrimA @ stub StrTrimW -@ stub UrlApplySchemeA -@ stdcall UrlApplySchemeW(str ptr ptr long) UrlApplySchemeW +@ stdcall UrlApplySchemeA(str ptr ptr long) UrlApplySchemeA +@ stdcall UrlApplySchemeW(wstr ptr ptr long) UrlApplySchemeW @ stdcall UrlCanonicalizeA(str ptr ptr long) UrlCanonicalizeA @ stdcall UrlCanonicalizeW(wstr ptr ptr long) UrlCanonicalizeW @ stdcall UrlCombineA(str str str ptr long) UrlCombineA @ stdcall UrlCombineW(wstr wstr wstr ptr long) UrlCombineW -@ stub UrlCompareA -@ stub UrlCompareW +@ stdcall UrlCompareA(str str long) UrlCompareA +@ stdcall UrlCompareW(wstr wstr long) UrlCompareW @ stub UrlCreateFromPathA @ stub UrlCreateFromPathW @ stdcall UrlEscapeA(str ptr ptr long)UrlEscapeA @@ -721,7 +721,7 @@ debug_channels (shell) @ stub SHCreateStreamWrapper @ stub SHCreateThread @ stub SHGetThreadRef -@ stub SHRegDuplicateHKey +@ stdcall SHRegDuplicateHKey (long) SHRegDuplicateHKey @ stub SHRegSetPathA @ stub SHRegSetPathW @ stub SHRegisterValidateTemplate diff --git a/dlls/shlwapi/string.c b/dlls/shlwapi/string.c index c7f57c41bc..e05f2478f7 100644 --- a/dlls/shlwapi/string.c +++ b/dlls/shlwapi/string.c @@ -16,6 +16,28 @@ DEFAULT_DEBUG_CHANNEL(shell); +/************************************************************************* + * ChrCmpIA [SHLWAPI.385] + * + * Note: Returns 0 (FALSE) if characters are equal (insensitive). + */ +BOOL WINAPI ChrCmpIA (WORD w1, WORD w2) +{ + TRACE("%c ? %c\n", w1, w2); + return (toupper(w1) != toupper(w2)); +} + +/************************************************************************* + * ChrCmpIW [SHLWAPI.386] + * + * Note: Returns 0 (FALSE) if characters are equal (insensitive). + */ +BOOL WINAPI ChrCmpIW (WCHAR w1, WCHAR w2) +{ + TRACE("%c ? %c\n", w1, w2); + return (toupperW(w1) != toupperW(w2)); +} + /************************************************************************* * StrChrA [SHLWAPI.@] */