#pragma once
#include <corecrt.h>
#include <errno.h>
#include <vcruntime_string.h>
_CRT_BEGIN_C_HEADER
__pragma
(pack(push,
8
))
extern
"C"
{
#ifndef _CRT_MEMCPY_S_INLINE
#define _CRT_MEMCPY_S_INLINE static __inline
#endif
#define _CRT_MEMCPY_S_VALIDATE_RETURN_ERRCODE(expr, errorcode) \
{ \
int _Expr_val=!!(expr); \
if (!(_Expr_val)) \
{ \
errno = errorcode; \
_invalid_parameter_noinfo(); \
return errorcode; \
} \
}
#if !defined RC_INVOKED && !defined __midl && __STDC_WANT_SECURE_LIB__
_Success_(return == 0)
_Check_return_opt_
_CRT_MEMCPY_S_INLINE errno_t __CRTDECL memcpy_s(
static
__inline
__cdecl
(
_Out_writes_bytes_to_opt_(_DestinationSize, _SourceSize) void* const _Destination,
_In_ rsize_t const _DestinationSize,
_In_reads_bytes_opt_(_SourceSize) void const* const _Source,
_In_ rsize_t const _SourceSize
)
{
if
(
==
0
)
{
return
0
;
}
_CRT_MEMCPY_S_VALIDATE_RETURN_ERRCODE(_Destination != NULL, EINVAL);
{
int
=!!(
!=
0
);
if
(!(
_Expr_val
)) { (*
()) =
22
;
_invalid_parameter_noinfo
();
return
22
; } };
if (_Source == NULL || _DestinationSize < _SourceSize)
{
(
,
0
,
);
_CRT_MEMCPY_S_VALIDATE_RETURN_ERRCODE(_Source != NULL, EINVAL);
{
int
=!!(
!=
0
);
if
(!(
_Expr_val
)) { (*
()) =
22
;
_invalid_parameter_noinfo
();
return
22
; } };
_CRT_MEMCPY_S_VALIDATE_RETURN_ERRCODE(_DestinationSize >= _SourceSize, ERANGE);
{
int
=!!(
>=
);
if
(!(
_Expr_val
)) { (*
()) =
34
;
_invalid_parameter_noinfo
();
return
34
; } };
}
#pragma warning(suppress:4996) // Deprecation
#pragma warning(suppress:
4996
)
(
,
,
);
return
0
;
}
_Check_return_wat_
_CRT_MEMCPY_S_INLINE errno_t __CRTDECL memmove_s(
static
__inline
__cdecl
(
_Out_writes_bytes_to_opt_(_DestinationSize, _SourceSize) void* const _Destination,
_In_ rsize_t const _DestinationSize,
_In_reads_bytes_opt_(_SourceSize) void const* const _Source,
_In_ rsize_t const _SourceSize
)
{
if
(
==
0
)
{
return
0
;
}
_CRT_MEMCPY_S_VALIDATE_RETURN_ERRCODE(_Destination != NULL, EINVAL);
{
int
=!!(
!=
0
);
if
(!(
_Expr_val
)) { (*
()) =
22
;
_invalid_parameter_noinfo
();
return
22
; } };
_CRT_MEMCPY_S_VALIDATE_RETURN_ERRCODE(_Source != NULL, EINVAL);
{
int
=!!(
!=
0
);
if
(!(
_Expr_val
)) { (*
()) =
22
;
_invalid_parameter_noinfo
();
return
22
; } };
_CRT_MEMCPY_S_VALIDATE_RETURN_ERRCODE(_DestinationSize >= _SourceSize, ERANGE);
{
int
=!!(
>=
);
if
(!(
_Expr_val
)) { (*
()) =
34
;
_invalid_parameter_noinfo
();
return
34
; } };
#pragma warning(suppress:4996) // Deprecation
#pragma warning(suppress:
4996
)
(
,
,
);
return
0
;
}
#endif
#undef _CRT_MEMCPY_S_VALIDATE_RETURN_ERRCODE