ReactOS
0.4.16-dev-1505-g12fa72a
wmemcpy_s.cpp
Go to the documentation of this file.
1
//
2
// wmemcpy_s.cpp
3
//
4
// Copyright (c) Microsoft Corporation. All rights reserved.
5
//
6
// Defines wmemcpy_s(), which copies wide characters from a source buffer to a
7
// destination buffer. Overlapping buffers are not treated specially, so
8
// propagation may occur. If propagation must be avoided, wmemmove_s() must be
9
// used.
10
//
11
// Returns 0 if successful; an error code on failure.
12
//
13
#include <
corecrt_internal.h
>
14
#include <wchar.h>
15
16
17
18
extern
"C"
errno_t
__cdecl
wmemcpy_s
(
19
wchar_t
*
const
destination,
20
size_t
const
size_in_elements
,
21
wchar_t
const
*
const
source
,
22
size_t
const
count
23
)
24
{
25
if
(
count
== 0)
26
return
0;
27
28
_VALIDATE_RETURN_ERRCODE
(destination !=
nullptr
,
EINVAL
);
29
30
if
(
source
==
nullptr
||
size_in_elements
<
count
)
31
{
32
// Zero the destination buffer:
33
wmemset
(destination, 0,
size_in_elements
);
34
35
_VALIDATE_RETURN_ERRCODE
(
source
!=
nullptr
,
EINVAL
);
36
_VALIDATE_RETURN_ERRCODE
(
size_in_elements
>=
count
,
ERANGE
);
37
38
// Useless, but prefast is confused:
39
return
EINVAL
;
40
}
41
42
#pragma warning(suppress:__WARNING_BANNED_API_USAGEL2)
/* 28726 */
43
wmemcpy(destination,
source
,
count
);
44
return
0;
45
}
EINVAL
#define EINVAL
Definition:
acclib.h:90
ERANGE
#define ERANGE
Definition:
acclib.h:92
__cdecl
#define __cdecl
Definition:
accygwin.h:79
corecrt_internal.h
size_in_elements
size_t const size_in_elements
Definition:
corecrt_internal_string_templates.h:21
count
GLuint GLuint GLsizei count
Definition:
gl.h:1545
wmemset
wchar_t *__cdecl wmemset(_Out_writes_all_(_N) wchar_t *_S, _In_ wchar_t _C, _In_ size_t _N)
Definition:
wchar.h:2663
_VALIDATE_RETURN_ERRCODE
#define _VALIDATE_RETURN_ERRCODE(expr, errorcode)
Definition:
internal_shared.h:143
source
Definition:
pdh_main.c:174
errno_t
int errno_t
Definition:
corecrt.h:615
wmemcpy_s
errno_t __cdecl wmemcpy_s(wchar_t *const destination, size_t const size_in_elements, wchar_t const *const source, size_t const count)
Definition:
wmemcpy_s.cpp:18
sdk
lib
ucrt
string
wmemcpy_s.cpp
Generated on Fri Jul 11 2025 06:15:26 for ReactOS by
1.9.6