2 * PROJECT: ReactOS CRT library
3 * LICENSE: LGPL - See COPYING in the top level directory
4 * FILE: lib/sdk/crt/string/wcs.c
5 * PURPOSE: wcs* CRT functions
6 * PROGRAMMERS: Wine team
7 * Ported to ReactOS by Aleksey Bragin (aleksey@reactos.org)
11 * msvcrt.dll wide-char functions
13 * Copyright 1999 Alexandre Julliard
14 * Copyright 2000 Jon Griffiths
16 * This library is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License as published by the Free Software Foundation; either
19 * version 2.1 of the License, or (at your option) any later version.
21 * This library is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
26 * You should have received a copy of the GNU Lesser General Public
27 * License along with this library; if not, write to the Free Software
28 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
34 #include <internal/wine/msvcrt.h>
37 #include "wine/unicode.h"
38 //#include "wine/debug.h"
41 //WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
51 /*********************************************************************
54 wchar_t* CDECL
_wcsdup( const wchar_t* str
)
59 int size
= (strlenW(str
) + 1) * sizeof(wchar_t);
61 if (ret
) memcpy( ret
, str
, size
);
65 /*********************************************************************
66 * _wcsicoll (MSVCRT.@)
68 INT CDECL
_wcsicoll( const wchar_t* str1
, const wchar_t* str2
)
70 /* FIXME: handle collates */
71 return strcmpiW( str1
, str2
);
75 /*********************************************************************
78 wchar_t* CDECL
_wcsnset( wchar_t* str
, wchar_t c
, size_t n
)
81 while ((n
-- > 0) && *str
) *str
++ = c
;
85 /*********************************************************************
88 wchar_t* CDECL
_wcsrev( wchar_t* str
)
91 wchar_t* end
= str
+ strlenW(str
) - 1;
102 /*********************************************************************
105 wchar_t* CDECL
_wcsset( wchar_t* str
, wchar_t c
)
108 while (*str
) *str
++ = c
;
112 /*********************************************************************
115 double CDECL
wcstod(const wchar_t* lpszStr
, wchar_t** end
)
117 const wchar_t* str
= lpszStr
;
119 double ret
= 0, divisor
= 10.0;
121 TRACE("(%s,%p) semi-stub\n", debugstr_w(lpszStr
), end
);
124 * - Should set errno on failure
125 * - Should fail on overflow
126 * - Need to check which input formats are allowed
128 while (isspaceW(*str
))
137 while (isdigitW(*str
))
139 ret
= ret
* 10.0 + (*str
- '0');
144 while (isdigitW(*str
))
146 ret
= ret
+ (*str
- '0') / divisor
;
151 if (*str
== 'E' || *str
== 'e' || *str
== 'D' || *str
== 'd')
153 int negativeExponent
= 0;
157 negativeExponent
= 1;
160 while (isdigitW(*str
))
162 exponent
= exponent
* 10 + (*str
- '0');
167 if (negativeExponent
)
168 ret
= ret
/ pow(10.0, exponent
);
170 ret
= ret
* pow(10.0, exponent
);
178 *end
= (wchar_t*)str
;
180 TRACE("returning %g\n", ret
);
184 typedef struct pf_output_t
195 typedef struct pf_flags_t
197 char Sign
, LeftAlign
, Alternate
, PadZero
;
198 int FieldLength
, Precision
;
199 char IntegerLength
, IntegerDouble
;
205 * writes a string of characters to the output
206 * returns -1 if the string doesn't fit in the output buffer
207 * return the length of the string if all characters were written
209 static inline int pf_output_stringW( pf_output
*out
, LPCWSTR str
, int len
)
211 int space
= out
->len
- out
->used
;
214 len
= strlenW( str
);
217 LPWSTR p
= out
->buf
.W
+ out
->used
;
221 memcpy( p
, str
, len
*sizeof(WCHAR
) );
226 memcpy( p
, str
, space
*sizeof(WCHAR
) );
231 int n
= WideCharToMultiByte( CP_ACP
, 0, str
, len
, NULL
, 0, NULL
, NULL
);
232 LPSTR p
= out
->buf
.A
+ out
->used
;
236 WideCharToMultiByte( CP_ACP
, 0, str
, len
, p
, n
, NULL
, NULL
);
241 WideCharToMultiByte( CP_ACP
, 0, str
, len
, p
, space
, NULL
, NULL
);
247 static inline int pf_output_stringA( pf_output
*out
, LPCSTR str
, int len
)
249 int space
= out
->len
- out
->used
;
255 LPSTR p
= out
->buf
.A
+ out
->used
;
259 memcpy( p
, str
, len
);
264 memcpy( p
, str
, space
);
269 int n
= MultiByteToWideChar( CP_ACP
, 0, str
, len
, NULL
, 0 );
270 LPWSTR p
= out
->buf
.W
+ out
->used
;
274 MultiByteToWideChar( CP_ACP
, 0, str
, len
, p
, n
);
279 MultiByteToWideChar( CP_ACP
, 0, str
, len
, p
, space
);
285 /* pf_fill: takes care of signs, alignment, zero and field padding */
286 static inline int pf_fill( pf_output
*out
, int len
, pf_flags
*flags
, char left
)
290 if( flags
->Sign
&& !( flags
->Format
== 'd' || flags
->Format
== 'i' ) )
293 if( left
&& flags
->Sign
)
295 flags
->FieldLength
--;
297 r
= pf_output_stringA( out
, &flags
->Sign
, 1 );
300 if( ( !left
&& flags
->LeftAlign
) ||
301 ( left
&& !flags
->LeftAlign
))
303 for( i
=0; (i
<(flags
->FieldLength
-len
)) && (r
>=0); i
++ )
305 if( left
&& flags
->PadZero
)
306 r
= pf_output_stringA( out
, "0", 1 );
308 r
= pf_output_stringA( out
, " ", 1 );
312 if( left
&& flags
->Sign
&& !flags
->PadZero
)
313 r
= pf_output_stringA( out
, &flags
->Sign
, 1 );
318 static inline int pf_output_format_W( pf_output
*out
, LPCWSTR str
,
319 int len
, pf_flags
*flags
)
324 len
= strlenW( str
);
326 if (flags
->Precision
>= 0 && flags
->Precision
< len
)
327 len
= flags
->Precision
;
329 r
= pf_fill( out
, len
, flags
, 1 );
332 r
= pf_output_stringW( out
, str
, len
);
335 r
= pf_fill( out
, len
, flags
, 0 );
340 static inline int pf_output_format_A( pf_output
*out
, LPCSTR str
,
341 int len
, pf_flags
*flags
)
348 if (flags
->Precision
>= 0 && flags
->Precision
< len
)
349 len
= flags
->Precision
;
351 r
= pf_fill( out
, len
, flags
, 1 );
354 r
= pf_output_stringA( out
, str
, len
);
357 r
= pf_fill( out
, len
, flags
, 0 );
362 static int pf_handle_string_format( pf_output
*out
, const void* str
, int len
,
363 pf_flags
*flags
, BOOL capital_letter
)
365 if(str
== NULL
) /* catch NULL pointer */
366 return pf_output_format_A( out
, "(null)", -1, flags
);
368 /* prefixes take priority over %c,%s vs. %C,%S, so we handle them first */
369 if(flags
->WideString
|| flags
->IntegerLength
== 'l')
370 return pf_output_format_W( out
, str
, len
, flags
);
371 if(flags
->IntegerLength
== 'h')
372 return pf_output_format_A( out
, str
, len
, flags
);
374 /* %s,%c -> chars in ansi functions & wchars in unicode
375 * %S,%C -> wchars in ansi functions & chars in unicode */
376 if( capital_letter
== out
->unicode
) /* either both TRUE or both FALSE */
377 return pf_output_format_A( out
, str
, len
, flags
);
379 return pf_output_format_W( out
, str
, len
, flags
);
382 static inline BOOL
pf_is_integer_format( char fmt
)
384 static const char float_fmts
[] = "diouxX";
387 return strchr( float_fmts
, fmt
) ? TRUE
: FALSE
;
390 static inline BOOL
pf_is_double_format( char fmt
)
392 static const char float_fmts
[] = "aeEfgG";
395 return strchr( float_fmts
, fmt
) ? TRUE
: FALSE
;
398 static inline BOOL
pf_is_valid_format( char fmt
)
400 static const char float_fmts
[] = "acCdeEfgGinouxX";
403 return strchr( float_fmts
, fmt
) ? TRUE
: FALSE
;
406 static void pf_rebuild_format_string( char *p
, pf_flags
*flags
)
411 if( flags
->LeftAlign
)
412 *p
++ = flags
->LeftAlign
;
413 if( flags
->Alternate
)
414 *p
++ = flags
->Alternate
;
416 *p
++ = flags
->PadZero
;
417 if( flags
->FieldLength
)
419 lnx_sprintf(p
, "%d", flags
->FieldLength
);
422 if( flags
->Precision
>= 0 )
424 lnx_sprintf(p
, ".%d", flags
->Precision
);
427 *p
++ = flags
->Format
;
431 /* pf_integer_conv: prints x to buf, including alternate formats and
432 additional precision digits, but not field characters or the sign */
433 static void pf_integer_conv( char *buf
, int buf_len
, pf_flags
*flags
,
440 char number
[40], *tmp
= number
;
442 if( buf_len
> sizeof number
)
443 tmp
= HeapAlloc( GetProcessHeap(), 0, buf_len
);
446 if( flags
->Format
== 'o' )
448 else if( flags
->Format
== 'x' || flags
->Format
== 'X' )
451 if( flags
->Format
== 'X' )
452 digits
= "0123456789ABCDEFX";
454 digits
= "0123456789abcdefx";
456 if( x
< 0 && ( flags
->Format
== 'd' || flags
->Format
== 'i' ) )
462 /* Do conversion (backwards) */
464 if( x
== 0 && flags
->Precision
)
469 j
= (ULONGLONG
) x
% base
;
470 x
= (ULONGLONG
) x
/ base
;
471 tmp
[i
++] = digits
[j
];
473 k
= flags
->Precision
- i
;
476 if( flags
->Alternate
)
480 tmp
[i
++] = digits
[16];
483 else if( base
== 8 && tmp
[i
-1] != '0' )
487 /* Reverse for buf */
493 /* Adjust precision so pf_fill won't truncate the number later */
494 flags
->Precision
= strlen( buf
);
497 HeapFree( GetProcessHeap(), 0, tmp
);
502 /*********************************************************************
503 * pf_vsnprintf (INTERNAL)
505 * implements both A and W vsnprintf functions
507 static int pf_vsnprintf( pf_output
*out
, const WCHAR
*format
, va_list valist
)
510 LPCWSTR q
, p
= format
;
513 TRACE("format is %s\n",debugstr_w(format
));
516 q
= strchrW( p
, '%' );
518 /* there's no % characters left, output the rest of the string */
521 r
= pf_output_stringW(out
, p
, -1);
528 /* there's characters before the %, output them */
531 r
= pf_output_stringW(out
, p
, q
- p
);
537 /* we must be at a % now, skip over it */
541 /* output a single % character */
544 r
= pf_output_stringW(out
, p
++, 1);
550 /* parse the flags */
551 memset( &flags
, 0, sizeof flags
);
554 if( *p
== '+' || *p
== ' ' )
556 if ( flags
.Sign
!= '+' )
560 flags
.LeftAlign
= *p
;
564 flags
.Alternate
= *p
;
570 /* deal with the field width specifier */
571 flags
.FieldLength
= 0;
574 flags
.FieldLength
= va_arg( valist
, int );
575 if (flags
.FieldLength
< 0)
577 flags
.LeftAlign
= '-';
578 flags
.FieldLength
= -flags
.FieldLength
;
582 else while( isdigit(*p
) )
584 flags
.FieldLength
*= 10;
585 flags
.FieldLength
+= *p
++ - '0';
588 /* deal with precision */
589 flags
.Precision
= -1;
596 flags
.Precision
= va_arg( valist
, int );
599 else while( isdigit(*p
) )
601 flags
.Precision
*= 10;
602 flags
.Precision
+= *p
++ - '0';
606 /* deal with integer width modifier */
609 if( *p
== 'h' || *p
== 'l' || *p
== 'L' )
611 flags
.IntegerLength
= *p
;
616 if( *(p
+1) == '6' && *(p
+2) == '4' )
618 flags
.IntegerDouble
++;
621 else if( *(p
+1) == '3' && *(p
+2) == '2' )
623 else if( isdigit(*(p
+1)) || *(p
+1) == 0 )
629 flags
.WideString
= *p
++;
639 /* output a string */
640 if( flags
.Format
== 's' || flags
.Format
== 'S' )
641 r
= pf_handle_string_format( out
, va_arg(valist
, const void*), -1,
642 &flags
, (flags
.Format
== 'S') );
644 /* output a single character */
645 else if( flags
.Format
== 'c' || flags
.Format
== 'C' )
647 INT ch
= va_arg( valist
, int );
649 r
= pf_handle_string_format( out
, &ch
, 1, &flags
, (flags
.Format
== 'C') );
652 /* output a pointer */
653 else if( flags
.Format
== 'p' )
658 if( flags
.Alternate
)
659 lnx_sprintf(pointer
, "0X%08lX", va_arg(valist
, long));
661 lnx_sprintf(pointer
, "%08lX", va_arg(valist
, long));
662 r
= pf_output_format_A( out
, pointer
, -1, &flags
);
666 else if( flags
.Format
== 'n' )
668 int *x
= va_arg(valist
, int *);
672 /* deal with 64-bit integers */
673 else if( pf_is_integer_format( flags
.Format
) && flags
.IntegerDouble
)
675 char number
[40], *x
= number
;
677 /* Estimate largest possible required buffer size:
678 * Chooses the larger of the field or precision
679 * Includes extra bytes: 1 byte for null, 1 byte for sign,
680 4 bytes for exponent, 2 bytes for alternate formats, 1 byte
681 for a decimal, and 1 byte for an additional float digit. */
682 int x_len
= ((flags
.FieldLength
> flags
.Precision
) ?
683 flags
.FieldLength
: flags
.Precision
) + 10;
685 if( x_len
>= sizeof number
)
686 x
= HeapAlloc( GetProcessHeap(), 0, x_len
);
688 pf_integer_conv( x
, x_len
, &flags
, va_arg(valist
, LONGLONG
) );
690 r
= pf_output_format_A( out
, x
, -1, &flags
);
692 HeapFree( GetProcessHeap(), 0, x
);
695 /* deal with integers and floats using libc's printf */
696 else if( pf_is_valid_format( flags
.Format
) )
698 char fmt
[20], number
[40], *x
= number
;
700 /* Estimate largest possible required buffer size:
701 * Chooses the larger of the field or precision
702 * Includes extra bytes: 1 byte for null, 1 byte for sign,
703 4 bytes for exponent, 2 bytes for alternate formats, 1 byte
704 for a decimal, and 1 byte for an additional float digit. */
705 int x_len
= ((flags
.FieldLength
> flags
.Precision
) ?
706 flags
.FieldLength
: flags
.Precision
) + 10;
708 if( x_len
>= sizeof number
)
709 x
= HeapAlloc( GetProcessHeap(), 0, x_len
);
711 pf_rebuild_format_string( fmt
, &flags
);
713 if( pf_is_double_format( flags
.Format
) )
714 lnx_sprintf( x
, fmt
, va_arg(valist
, double) );
716 lnx_sprintf( x
, fmt
, va_arg(valist
, int) );
718 r
= pf_output_stringA( out
, x
, -1 );
720 HeapFree( GetProcessHeap(), 0, x
);
730 /* check we reached the end, and null terminate the string */
732 pf_output_stringW( out
, p
, 1 );
734 return out
->used
- 1;
737 /*********************************************************************
738 * _vsnprintf (MSVCRT.@)
740 int CDECL
_vsnprintf( char *str
, size_t len
,
741 const char *format
, va_list valist
)
744 LPWSTR formatW
= NULL
;
755 sz
= MultiByteToWideChar( CP_ACP
, 0, format
, -1, NULL
, 0 );
756 formatW
= HeapAlloc( GetProcessHeap(), 0, sz
*sizeof(WCHAR
) );
757 MultiByteToWideChar( CP_ACP
, 0, format
, -1, formatW
, sz
);
760 r
= pf_vsnprintf( &out
, formatW
, valist
);
762 HeapFree( GetProcessHeap(), 0, formatW
);
767 /*********************************************************************
768 * vsprintf (MSVCRT.@)
770 int CDECL
vsprintf( char *str
, const char *format
, va_list valist
)
772 return _vsnprintf(str
, INT_MAX
, format
, valist
);
775 /*********************************************************************
776 * _snprintf (MSVCRT.@)
778 int CDECL
_snprintf(char *str
, size_t len
, const char *format
, ...)
782 va_start(valist
, format
);
783 retval
= _vsnprintf(str
, len
, format
, valist
);
788 /*********************************************************************
789 * _vsnwsprintf (MSVCRT.@)
791 int CDECL
_vsnwprintf( wchar_t *str
, size_t len
,
792 const wchar_t *format
, va_list valist
)
801 return pf_vsnprintf( &out
, format
, valist
);
804 /*********************************************************************
805 * _snwprintf (MSVCRT.@)
807 int CDECL
_snwprintf( wchar_t *str
, size_t len
, const wchar_t *format
, ...)
811 va_start(valist
, format
);
812 retval
= _vsnwprintf(str
, len
, format
, valist
);
817 /*********************************************************************
820 int CDECL
sprintf( char *str
, const char *format
, ... )
825 va_start( ap
, format
);
826 r
= _vsnprintf( str
, INT_MAX
, format
, ap
);
831 /*********************************************************************
832 * swprintf (MSVCRT.@)
834 int CDECL
swprintf( wchar_t *str
, const wchar_t *format
, ... )
839 va_start( ap
, format
);
840 r
= _vsnwprintf( str
, INT_MAX
, format
, ap
);
845 /*********************************************************************
846 * vswprintf (MSVCRT.@)
848 int CDECL
vswprintf( wchar_t* str
, const wchar_t* format
, va_list args
)
850 return _vsnwprintf( str
, INT_MAX
, format
, args
);
854 /*********************************************************************
857 int CDECL
wcscoll( const wchar_t* str1
, const wchar_t* str2
)
859 /* FIXME: handle collates */
860 return strcmpW( str1
, str2
);
863 /*********************************************************************
866 wchar_t* CDECL
wcspbrk( const wchar_t* str
, const wchar_t* accept
)
871 for (p
= accept
; *p
; p
++) if (*p
== *str
) return (wchar_t*)str
;
878 /*********************************************************************
881 wchar_t * CDECL
wcstok( wchar_t *str
, const wchar_t *delim
)
883 MSVCRT_thread_data
*data
= msvcrt_get_thread_data();
887 if (!(str
= data
->wcstok_next
)) return NULL
;
889 while (*str
&& strchrW( delim
, *str
)) str
++;
890 if (!*str
) return NULL
;
892 while (*str
&& !strchrW( delim
, *str
)) str
++;
893 if (*str
) *str
++ = 0;
894 data
->wcstok_next
= str
;
898 /*********************************************************************
901 INT CDECL
wctomb(char *mbchar
, wchar_t wchar
)
903 BOOL bUsedDefaultChar
;
904 char chMultiByte
[MB_LEN_MAX
];
907 /* At least one parameter needs to be given, the length of a null character cannot be queried (verified by tests under WinXP SP2) */
908 if(!mbchar
&& !wchar
)
911 /* Use WideCharToMultiByte for doing the conversion using the codepage currently set with setlocale() */
912 nBytes
= WideCharToMultiByte(MSVCRT___lc_codepage
, 0, &wchar
, 1, chMultiByte
, MB_LEN_MAX
, NULL
, &bUsedDefaultChar
);
914 /* Only copy the character if an 'mbchar' pointer was given.
916 The "C" locale is emulated with codepage 1252 here. This codepage has a default character "?", but the "C" locale doesn't have one.
917 Therefore don't copy the character in this case. */
918 if(mbchar
&& !(MSVCRT_current_lc_all
[0] == 'C' && !MSVCRT_current_lc_all
[1] && bUsedDefaultChar
))
919 memcpy(mbchar
, chMultiByte
, nBytes
);
921 /* If the default character was used, set errno to EILSEQ and return -1. */
928 /* Otherwise return the number of bytes this character occupies. */
932 size_t CDECL
wcstombs(char *mbstr
, const wchar_t *wcstr
, size_t count
)
934 BOOL bUsedDefaultChar
;
938 /* Does the caller query for output buffer size? */
943 /* If we currently use the "C" locale, the length of the input string is returned (verified by tests under WinXP SP2) */
944 if(MSVCRT_current_lc_all
[0] == 'C' && !MSVCRT_current_lc_all
[1])
945 return wcslen(wcstr
);
947 /* Otherwise check the length each character needs and build a final return value out of this */
948 count
= wcslen(wcstr
);
951 while((int)(--count
) >= 0 && *wcstr
)
953 /* Get the length of this character */
954 nResult
= wctomb(NULL
, *wcstr
++);
956 /* If this character is not convertible in the current locale, the end result will be -1 */
963 /* Return the final length */
967 /* Convert the string then */
968 bUsedDefaultChar
= FALSE
;
972 char chMultiByte
[MB_LEN_MAX
];
975 /* Are we at the terminating null character? */
978 /* Set the null character, but don't increment the pointer as the returned length never includes the terminating null character */
983 /* Convert this character into the temporary chMultiByte variable */
984 ZeroMemory(chMultiByte
, MB_LEN_MAX
);
985 nResult
= wctomb(chMultiByte
, *wcstr
++);
987 /* Check if this was an invalid character */
989 bUsedDefaultChar
= TRUE
;
991 /* If we got no character, stop the conversion process here */
995 /* Determine whether this is a double-byte or a single-byte character */
1001 /* Decrease 'count' by the character length and check if the buffer can still hold the full character */
1007 /* It can, so copy it and move the pointer forward */
1008 memcpy(p
, chMultiByte
, uLength
);
1012 if(bUsedDefaultChar
)
1015 /* Return the length in bytes of the copied characters (without the terminating null character) */
1021 /*********************************************************************
1022 * iswalnum (MSVCRT.@)
1024 INT CDECL
iswalnum( wchar_t wc
)
1026 return isalnumW( wc
);
1029 /*********************************************************************
1030 * iswalpha (MSVCRT.@)
1032 INT CDECL
iswalpha( wchar_t wc
)
1034 return isalphaW( wc
);
1037 /*********************************************************************
1038 * iswcntrl (MSVCRT.@)
1040 INT CDECL
iswcntrl( wchar_t wc
)
1042 return iscntrlW( wc
);
1045 /*********************************************************************
1046 * iswdigit (MSVCRT.@)
1048 INT CDECL
iswdigit( wchar_t wc
)
1050 return isdigitW( wc
);
1053 /*********************************************************************
1054 * iswgraph (MSVCRT.@)
1056 INT CDECL
iswgraph( wchar_t wc
)
1058 return isgraphW( wc
);
1061 /*********************************************************************
1062 * iswlower (MSVCRT.@)
1064 INT CDECL
iswlower( wchar_t wc
)
1066 return islowerW( wc
);
1069 /*********************************************************************
1070 * iswprint (MSVCRT.@)
1072 INT CDECL
iswprint( wchar_t wc
)
1074 return isprintW( wc
);
1077 /*********************************************************************
1078 * iswpunct (MSVCRT.@)
1080 INT CDECL
iswpunct( wchar_t wc
)
1082 return ispunctW( wc
);
1085 /*********************************************************************
1086 * iswspace (MSVCRT.@)
1088 INT CDECL
iswspace( wchar_t wc
)
1090 return isspaceW( wc
);
1093 /*********************************************************************
1094 * iswupper (MSVCRT.@)
1096 INT CDECL
iswupper( wchar_t wc
)
1098 return isupperW( wc
);
1101 /*********************************************************************
1102 * iswxdigit (MSVCRT.@)
1104 INT CDECL
iswxdigit( wchar_t wc
)
1106 return isxdigitW( wc
);
1109 /*********************************************************************
1110 * wcscpy_s (MSVCRT.@)
1112 INT CDECL
wcscpy_s( wchar_t* wcDest
, size_t numElement
, const wchar_t *wcSrc
)
1116 if(!wcDest
|| !numElement
)
1126 size
= strlenW(wcSrc
) + 1;
1128 if(size
> numElement
)
1133 if(size
> numElement
)
1136 memcpy( wcDest
, wcSrc
, size
*sizeof(WCHAR
) );