2 * msvcr100 specific functions
4 * Copyright 2010 Detlef Riekenberg
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
32 #define INVALID_PMT(x,err) (*_errno() = (err), _invalid_parameter(NULL, NULL, NULL, 0, 0))
33 #define CHECK_PMT_ERR(x,err) ((x) || (INVALID_PMT( 0, (err) ), FALSE))
34 #define CHECK_PMT(x) CHECK_PMT_ERR((x), EINVAL)
36 /*********************************************************************
37 * wmemcpy_s (MSVCR100.@)
39 int CDECL wmemcpy_s(wchar_t *dest, size_t numberOfElements, const wchar_t *src, size_t count)
41 TRACE("(%p %lu %p %lu)\n", dest, (unsigned long)numberOfElements, src, (unsigned long)count);
46 if (!CHECK_PMT(dest != NULL)) return EINVAL;
48 if (!CHECK_PMT(src != NULL)) {
49 memset(dest, 0, numberOfElements*sizeof(wchar_t));
52 if (!CHECK_PMT_ERR(count <= numberOfElements, ERANGE)) {
53 memset(dest, 0, numberOfElements*sizeof(wchar_t));
57 memcpy(dest, src, sizeof(wchar_t)*count);
61 /*********************************************************************
62 * wmemmove_s (MSVCR100.@)
64 int CDECL wmemmove_s(wchar_t *dest, size_t numberOfElements, const wchar_t *src, size_t count)
66 TRACE("(%p %lu %p %lu)\n", dest, (unsigned long)numberOfElements, src, (unsigned long)count);
71 /* Native does not seem to conform to 6.7.1.2.3 in
72 * http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1225.pdf
73 * in that it does not zero the output buffer on constraint violation.
75 if (!CHECK_PMT(dest != NULL)) return EINVAL;
76 if (!CHECK_PMT(src != NULL)) return EINVAL;
77 if (!CHECK_PMT_ERR(count <= numberOfElements, ERANGE)) return ERANGE;
79 memmove(dest, src, sizeof(wchar_t)*count);
83 /*********************************************************************
84 * DllMain (MSVCR100.@)
86 BOOL WINAPI DllMain(HINSTANCE hdll, DWORD reason, LPVOID reserved)
90 case DLL_WINE_PREATTACH:
91 return FALSE; /* prefer native version */
93 case DLL_PROCESS_ATTACH:
94 DisableThreadLibraryCalls(hdll);
95 _set_printf_count_output(0);