diff --git a/reactos/dll/win32/shlwapi/shlwapi.spec b/reactos/dll/win32/shlwapi/shlwapi.spec index 1a9e205e033..805e47c2dab 100644 --- a/reactos/dll/win32/shlwapi/shlwapi.spec +++ b/reactos/dll/win32/shlwapi/shlwapi.spec @@ -767,7 +767,7 @@ 767 stdcall StrCSpnW(wstr wstr) 768 stdcall StrCatBuffA(str str long) 769 stdcall StrCatBuffW(wstr wstr long) -#770 StrCatChainW +770 stdcall StrCatChainW (ptr long long wstr) 771 stdcall StrCatW(ptr wstr) 772 stdcall StrChrA(str long) 773 stdcall StrChrIA(str long) diff --git a/reactos/dll/win32/shlwapi/string.c b/reactos/dll/win32/shlwapi/string.c index db7c353041d..eae52dcbea2 100644 --- a/reactos/dll/win32/shlwapi/string.c +++ b/reactos/dll/win32/shlwapi/string.c @@ -437,6 +437,47 @@ LPWSTR WINAPI StrCatW(LPWSTR lpszStr, LPCWSTR lpszSrc) return lpszStr; } +/************************************************************************* + * StrCatChainW [SHLWAPI.@] + * + * Concatenates two unicode strings. + * + * PARAMS + * lpszStr [O] Initial string + * cchMax [I] Length of destination buffer + * ichAt [I] Offset from the destination buffer to begin concatenation + * lpszCat [I] String to concatenate + * + * RETURNS + * The offset from the beginning of pszDst to the terminating NULL. + */ +DWORD WINAPI StrCatChainW(LPWSTR lpszStr, DWORD cchMax, DWORD ichAt, LPCWSTR lpszCat) +{ + TRACE("(%s,%u,%d,%s)\n", debugstr_w(lpszStr), cchMax, ichAt, debugstr_w(lpszCat)); + + if (ichAt == -1) + ichAt = strlenW(lpszStr); + + if (!cchMax) + return ichAt; + + if (ichAt == cchMax) + ichAt--; + + if (lpszCat && ichAt < cchMax) + { + lpszStr += ichAt; + while (ichAt < cchMax - 1 && *lpszCat) + { + *lpszStr++ = *lpszCat++; + ichAt++; + } + *lpszStr = 0; + } + + return ichAt; +} + /************************************************************************* * StrCpyW [SHLWAPI.@] *