Commit 481a8036 authored by Dan Kegel's avatar Dan Kegel Committed by Alexandre Julliard

msvcr100: Add wmemmove_s and wmemcpy_s.

parent 7fec7678
......@@ -15483,6 +15483,7 @@ wine_fn_config_dll msvcp80 enable_msvcp80
wine_fn_config_dll msvcp90 enable_msvcp90
wine_fn_config_test dlls/msvcp90/tests msvcp90_test
wine_fn_config_dll msvcr100 enable_msvcr100
wine_fn_config_test dlls/msvcr100/tests msvcr100_test
wine_fn_config_dll msvcr70 enable_msvcr70 implib
wine_fn_config_dll msvcr71 enable_msvcr71 implib
wine_fn_config_dll msvcr80 enable_msvcr80
......
......@@ -2780,6 +2780,7 @@ WINE_CONFIG_DLL(msvcp80)
WINE_CONFIG_DLL(msvcp90)
WINE_CONFIG_TEST(dlls/msvcp90/tests)
WINE_CONFIG_DLL(msvcr100)
WINE_CONFIG_TEST(dlls/msvcr100/tests)
WINE_CONFIG_DLL(msvcr70,,[implib])
WINE_CONFIG_DLL(msvcr71,,[implib])
WINE_CONFIG_DLL(msvcr80)
......
......@@ -21,9 +21,64 @@
#include <stdarg.h>
#include "stdio.h"
#include "stdlib.h"
#include "errno.h"
#include "windef.h"
#include "winbase.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
#define INVALID_PMT(x,err) (*_errno() = (err), _invalid_parameter(NULL, NULL, NULL, 0, 0))
#define CHECK_PMT_ERR(x,err) ((x) || (INVALID_PMT( 0, (err) ), FALSE))
#define CHECK_PMT(x) CHECK_PMT_ERR((x), EINVAL)
/*********************************************************************
* wmemcpy_s (MSVCR100.@)
*/
int CDECL wmemcpy_s(wchar_t *dest, size_t numberOfElements, const wchar_t *src, size_t count)
{
TRACE("(%p %lu %p %lu)\n", dest, (unsigned long)numberOfElements, src, (unsigned long)count);
if (!count)
return 0;
if (!CHECK_PMT(dest != NULL)) return EINVAL;
if (!CHECK_PMT(src != NULL)) {
memset(dest, 0, numberOfElements*sizeof(wchar_t));
return EINVAL;
}
if (!CHECK_PMT_ERR(count <= numberOfElements, ERANGE)) {
memset(dest, 0, numberOfElements*sizeof(wchar_t));
return ERANGE;
}
memcpy(dest, src, sizeof(wchar_t)*count);
return 0;
}
/*********************************************************************
* wmemmove_s (MSVCR100.@)
*/
int CDECL wmemmove_s(wchar_t *dest, size_t numberOfElements, const wchar_t *src, size_t count)
{
TRACE("(%p %lu %p %lu)\n", dest, (unsigned long)numberOfElements, src, (unsigned long)count);
if (!count)
return 0;
/* Native does not seem to conform to 6.7.1.2.3 in
* http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1225.pdf
* in that it does not zero the output buffer on constraint violation.
*/
if (!CHECK_PMT(dest != NULL)) return EINVAL;
if (!CHECK_PMT(src != NULL)) return EINVAL;
if (!CHECK_PMT_ERR(count <= numberOfElements, ERANGE)) return ERANGE;
memmove(dest, src, sizeof(wchar_t)*count);
return 0;
}
/*********************************************************************
* DllMain (MSVCR100.@)
......
......@@ -1876,8 +1876,8 @@
@ cdecl wctob(long) msvcrt.wctob
@ cdecl wctomb(ptr long) msvcrt.wctomb
@ stub wctomb_s
@ stub wmemcpy_s
@ stub wmemmove_s
@ cdecl wmemcpy_s(ptr long ptr long)
@ cdecl wmemmove_s(ptr long ptr long)
@ varargs wprintf(wstr) msvcrt.wprintf
@ varargs wprintf_s(wstr) msvcrt.wprintf_s
@ varargs wscanf(wstr) msvcrt.wscanf
......
TESTDLL = msvcr100.dll
APPMODE = -mno-cygwin
MODCFLAGS = @BUILTINFLAG@
EXTRAINCL = -I$(top_srcdir)/include/msvcrt
C_SRCS = \
msvcr100.c
@MAKE_TEST_RULES@
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment