diff --git a/dlls/shell32/shellstring.c b/dlls/shell32/shellstring.c index 6258c42e8d1..735a27c5aca 100644 --- a/dlls/shell32/shellstring.c +++ b/dlls/shell32/shellstring.c @@ -25,6 +25,13 @@ DEFAULT_DEBUG_CHANNEL(shell); * * NOTES * the pidl is for STRRET OFFSET + * + * ***** NOTE ***** + * This routine is identical to StrRetToBufA in dlls/shlwapi/string.c. + * It was duplicated here because not every version of Shlwapi.dll exports + * StrRetToBufA. If you change one routine, change them both. YOU HAVE BEEN + * WARNED. + * ***** NOTE ***** */ HRESULT WINAPI StrRetToStrNA (LPVOID dest, DWORD len, LPSTRRET src, const ITEMIDLIST *pidl) { @@ -56,7 +63,21 @@ HRESULT WINAPI StrRetToStrNA (LPVOID dest, DWORD len, LPSTRRET src, const ITEMID return S_OK; } -/*************************************************************************/ +/************************************************************************* + * StrRetToStrNW [SHELL32.] + * + * converts a STRRET to a normal string + * + * NOTES + * the pidl is for STRRET OFFSET + * + * ***** NOTE ***** + * This routine is identical to StrRetToBufW in dlls/shlwapi/string.c. + * It was duplicated here because not every version of Shlwapi.dll exports + * StrRetToBufW. If you change one routine, change them both. YOU HAVE BEEN + * WARNED. + * ***** NOTE ***** + */ HRESULT WINAPI StrRetToStrNW (LPVOID dest1, DWORD len, LPSTRRET src, const ITEMIDLIST *pidl) { diff --git a/dlls/shlwapi/shlwapi.spec b/dlls/shlwapi/shlwapi.spec index 36758f5a508..2050a3d60be 100644 --- a/dlls/shlwapi/shlwapi.spec +++ b/dlls/shlwapi/shlwapi.spec @@ -644,8 +644,8 @@ debug_channels (shell) @ stub StrPBrkA @ stub StrPBrkW @ stdcall StrRChrA (str str long) StrRChrA -@ stub StrRChrIA -@ stub StrRChrIW +@ stdcall StrRChrIA (str str long) StrRChrIA +@ stdcall StrRChrIW (str str long) StrRChrIW @ stdcall StrRChrW (wstr wstr long) StrRChrW @ stub StrRStrIA @ stub StrRStrIW diff --git a/dlls/shlwapi/string.c b/dlls/shlwapi/string.c index b22b6b38bb5..ccc017381f8 100644 --- a/dlls/shlwapi/string.c +++ b/dlls/shlwapi/string.c @@ -2,6 +2,7 @@ #include #include #include +#include #include "winerror.h" #include "windef.h" @@ -334,6 +335,53 @@ LPWSTR WINAPI StrRChrW( LPCWSTR lpStart, LPCWSTR lpEnd, WORD wMatch) } +/************************************************************************** + * StrRChrIA [SHLWAPI.@] + * + */ +LPSTR WINAPI StrRChrIA( LPCSTR lpStart, LPCSTR lpEnd, WORD wMatch ) +{ + LPCSTR lpGotIt = NULL; + BOOL dbcs = IsDBCSLeadByte( LOBYTE(wMatch) ); + + TRACE("(%p, %p, %x)\n", lpStart, lpEnd, wMatch); + + if (!lpEnd) lpEnd = lpStart + strlen(lpStart); + + for(; lpStart < lpEnd; lpStart = CharNextA(lpStart)) + { + if (dbcs) { + /* + if (_mbctoupper(*lpStart) == _mbctoupper(wMatch)) + lpGotIt = lpStart; + */ + if (toupper(*lpStart) == toupper(wMatch)) lpGotIt = lpStart; + } else { + if (toupper(*lpStart) == toupper(wMatch)) lpGotIt = lpStart; + } + } + return (LPSTR)lpGotIt; +} + + +/************************************************************************** + * StrRChrIW [SHLWAPI.@] + * + */ +LPWSTR WINAPI StrRChrIW( LPCWSTR lpStart, LPCWSTR lpEnd, WORD wMatch) +{ + LPCWSTR lpGotIt = NULL; + + TRACE("(%p, %p, %x)\n", lpStart, lpEnd, wMatch); + if (!lpEnd) lpEnd = lpStart + strlenW(lpStart); + + for(; lpStart < lpEnd; lpStart = CharNextW(lpStart)) + if (towupper(*lpStart) == towupper(wMatch)) lpGotIt = lpStart; + + return (LPWSTR)lpGotIt; +} + + /************************************************************************* * StrCatBuffA [SHLWAPI.@] * @@ -377,6 +425,13 @@ LPWSTR WINAPI StrCatBuffW(LPWSTR front, LPCWSTR back, INT size) * * NOTES * the pidl is for STRRET OFFSET + * + * ***** NOTE ***** + * This routine is identical to StrRetToStrNA in dlls/shell32/shellstring.c. + * It was duplicated there because not every version of Shlwapi.dll exports + * StrRetToBufA. If you change one routine, change them both. YOU HAVE BEEN + * WARNED. + * ***** NOTE ***** */ HRESULT WINAPI StrRetToBufA (LPSTRRET src, const ITEMIDLIST *pidl, LPSTR dest, DWORD len) { @@ -415,6 +470,13 @@ HRESULT WINAPI StrRetToBufA (LPSTRRET src, const ITEMIDLIST *pidl, LPSTR dest, D * * NOTES * the pidl is for STRRET OFFSET + * + * ***** NOTE ***** + * This routine is identical to StrRetToStrNW in dlls/shell32/shellstring.c. + * It was duplicated there because not every version of Shlwapi.dll exports + * StrRetToBufW. If you change one routine, change them both. YOU HAVE BEEN + * WARNED. + * ***** NOTE ***** */ HRESULT WINAPI StrRetToBufW (LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, DWORD len) {