amstream: Render source file in IAMMultiMediaStreamImpl_OpenFile.
[wine.git] / dlls / msvcr100 / msvcr100.c
blob6f6875c20b03b8150cd97719643994522c059287
1 /*
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
21 #include <stdarg.h>
23 #include "stdio.h"
24 #include "stdlib.h"
25 #include "errno.h"
26 #include "windef.h"
27 #include "winbase.h"
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);
43 if (!count)
44 return 0;
46 if (!CHECK_PMT(dest != NULL)) return EINVAL;
48 if (!CHECK_PMT(src != NULL)) {
49 memset(dest, 0, numberOfElements*sizeof(wchar_t));
50 return EINVAL;
52 if (!CHECK_PMT_ERR(count <= numberOfElements, ERANGE)) {
53 memset(dest, 0, numberOfElements*sizeof(wchar_t));
54 return ERANGE;
57 memcpy(dest, src, sizeof(wchar_t)*count);
58 return 0;
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);
68 if (!count)
69 return 0;
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);
80 return 0;
83 /*********************************************************************
84 * DllMain (MSVCR100.@)
86 BOOL WINAPI DllMain(HINSTANCE hdll, DWORD reason, LPVOID reserved)
88 switch (reason)
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);
97 return TRUE;