Author: akhaldi
Date: Fri Dec 19 13:20:42 2014
New Revision: 65749

URL: http://svn.reactos.org/svn/reactos?rev=65749&view=rev
Log:
[SHLWAPI] Import Wine commit 4b33a33 by Sebastian Lackner: Add implementation 
for StrCatChainW. Based on a patch by Huw Campbell.
CORE-7556

Modified:
    trunk/reactos/dll/win32/shlwapi/shlwapi.spec
    trunk/reactos/dll/win32/shlwapi/string.c

Modified: trunk/reactos/dll/win32/shlwapi/shlwapi.spec
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/shlwapi.spec?rev=65749&r1=65748&r2=65749&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shlwapi/shlwapi.spec        [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shlwapi/shlwapi.spec        [iso-8859-1] Fri Dec 19 
13:20:42 2014
@@ -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)

Modified: trunk/reactos/dll/win32/shlwapi/string.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/string.c?rev=65749&r1=65748&r2=65749&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shlwapi/string.c    [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shlwapi/string.c    [iso-8859-1] Fri Dec 19 
13:20:42 2014
@@ -435,6 +435,47 @@
   if (lpszStr && lpszSrc)
     strcatW(lpszStr, 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;
 }
 
 /*************************************************************************


Reply via email to