headers/stralign{,_s}: Fix implementations of `ua_wcs{cpy_s,chr,rchr}`

Old code checked for `_WConst_Return` which is never defined; it is
`_WConst_return` that is defined in corecrt.h, so these definitions were
never compiled.

And these definitions turn out to be incorrect: `ua_wcscpy_s` references
non-existent parameters, and `ua_wcschr` calls `wcscpy`. These have to be
re-implemented.

It's worth noting that Microsoft stralign.h has also been having these typos
since more than twenty years ago.

Signed-off-by: LIU Hao <lh_mouse@126.com>
diff --git a/mingw-w64-headers/include/stralign.h b/mingw-w64-headers/include/stralign.h
index 3e86b8e..ae3e161 100644
--- a/mingw-w64-headers/include/stralign.h
+++ b/mingw-w64-headers/include/stralign.h
@@ -109,9 +109,11 @@
 
   PUWSTR_C ua_wcschr(PCUWSTR String,WCHAR Character);
   PUWSTR_C ua_wcsrchr(PCUWSTR String,WCHAR Character);
-#if defined(__cplusplus) && defined(_WConst_Return)
+#if defined(__cplusplus) && defined(_WConst_return)
+extern "C++" {
   PUWSTR ua_wcschr(PUWSTR String,WCHAR Character);
   PUWSTR ua_wcsrchr(PUWSTR String,WCHAR Character);
+}
 #endif
   PUWSTR ua_wcscpy(PUWSTR Destination,PCUWSTR Source);
   size_t ua_wcslen(PCUWSTR String);
@@ -125,15 +127,17 @@
     if(WSTR_ALIGNED(String)) return (PUWSTR_C)wcsrchr((PCWSTR)String,Character);
     return (PUWSTR_C)uaw_wcsrchr(String,Character);
   }
-#if defined(__cplusplus) && defined(_WConst_Return)
+#if defined(__cplusplus) && defined(_WConst_return)
+extern "C++" {
   __CRT_INLINE PUWSTR ua_wcschr(PUWSTR String,WCHAR Character) {
-    if(WSTR_ALIGNED(String)) return wcscpy((PWSTR)Destination,(PCWSTR)Source);
-    return uaw_wcscpy(Destination,Source);
+    if(WSTR_ALIGNED(String)) return (PUWSTR)wcschr((PCWSTR)String,Character);
+    return (PUWSTR)uaw_wcschr(String,Character);
   }
   __CRT_INLINE PUWSTR ua_wcsrchr(PUWSTR String,WCHAR Character) {
-    if(WSTR_ALIGNED(String)) return wcsrchr(String,Character);
-    return uaw_wcsrchr((PCUWSTR)String,Character);
+    if(WSTR_ALIGNED(String)) return (PUWSTR)wcsrchr((PCWSTR)String,Character);
+    return (PUWSTR)uaw_wcsrchr(String,Character);
   }
+}
 #endif
 
   __CRT_INLINE PUWSTR ua_wcscpy(PUWSTR Destination,PCUWSTR Source) {
@@ -199,10 +203,10 @@
 #endif
 
 #if !defined(_X86_) && defined(_WSTRING_S_DEFINED)
-#if defined(__cplusplus) && defined(_WConst_Return)
+#if defined(__cplusplus) && defined(_WConst_return)
   static __inline PUWSTR ua_wcscpy_s(PUWSTR Destination,size_t DestinationSize,PCUWSTR Source) {
     if(WSTR_ALIGNED(Source) && WSTR_ALIGNED(Destination)) return (wcscpy_s((PWSTR)Destination,DestinationSize,(PCWSTR)Source)==0 ? Destination : NULL);
-    return uaw_wcscpy((PCUWSTR)String,Character);
+    return uaw_wcscpy((PWSTR)Destination,(PCWSTR)Source);
   }
 #endif
 #endif