You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Returns a pointer to the function registered by [set_unexpected](set-unexpected-crt.md). If no function has been set, the return value may be used to restore the default behavior; this value may be **NULL**.
25
+
Returns a pointer to the function registered by [`set_unexpected`](set-unexpected-crt.md). If no function has been set, the return value may be used to restore the default behavior; this value may be **`NULL`**.
26
26
27
27
## Requirements
28
28
29
29
|Routine|Required header|
30
30
|-------------|---------------------|
31
-
|**_get_unexpected**|\<eh.h>|
31
+
|**`_get_unexpected`**|\<eh.h>|
32
32
33
-
For additional compatibility information, see [Compatibility](../../c-runtime-library/compatibility.md).
33
+
For more compatibility information, see [Compatibility](../../c-runtime-library/compatibility.md).
Copies bytes between buffers. More secure versions of these functions are available; see [memcpy_s, wmemcpy_s](memcpy-s-wmemcpy-s.md).
15
+
Copies bytes between buffers. More secure versions of these functions are available; see [`memcpy_s`, `wmemcpy_s`](memcpy-s-wmemcpy-s.md).
16
16
17
17
## Syntax
18
18
@@ -31,32 +31,32 @@ wchar_t *wmemcpy(
31
31
32
32
### Parameters
33
33
34
-
*dest*<br/>
34
+
*`dest`*\
35
35
New buffer.
36
36
37
-
*src*<br/>
37
+
*`src`*\
38
38
Buffer to copy from.
39
39
40
-
*count*<br/>
40
+
*`count`*\
41
41
Number of characters to copy.
42
42
43
43
## Return Value
44
44
45
-
The value of *dest*.
45
+
The value of *`dest`*.
46
46
47
47
## Remarks
48
48
49
-
**memcpy** copies *count* bytes from *src* to *dest*; **wmemcpy** copies *count* wide characters (two bytes). If the source and destination overlap, the behavior of **memcpy** is undefined. Use **memmove** to handle overlapping regions.
49
+
**`memcpy`** copies *`count`* bytes from *`src`* to *`dest`*; **`wmemcpy`** copies *`count`* wide characters (two bytes). If the source and destination overlap, the behavior of **`memcpy`** is undefined. Use **`memmove`** to handle overlapping regions.
50
50
51
51
> [!IMPORTANT]
52
52
> Make sure that the destination buffer is the same size or larger than the source buffer. For more information, see [Avoiding Buffer Overruns](/windows/win32/SecBP/avoiding-buffer-overruns).
53
53
54
54
> [!IMPORTANT]
55
-
> Because so many buffer overruns, and thus potential security exploits, have been traced to improper usage of **memcpy**, this function is listed among the "banned" functions by the Security Development Lifecycle (SDL). You may observe that some VC++ library classes continue to use **memcpy**. Furthermore, you may observe that the VC++ compiler optimizer sometimes emits calls to **memcpy**. The Visual C++ product is developed in accordance with the SDL process, and thus usage of this banned function has been closely evaluated. In the case of library use of it, the calls have been carefully scrutinized to ensure that buffer overruns will not be allowed through these calls. In the case of the compiler, sometimes certain code patterns are recognized as identical to the pattern of **memcpy**, and are thus replaced with a call to the function. In such cases, the use of **memcpy** is no more unsafe than the original instructions would have been; they have simply been optimized to a call to the performance-tuned **memcpy** function. Just as the use of "safe" CRT functions doesn’t guarantee safety (they just make it harder to be unsafe), the use of "banned" functions doesn’t guarantee danger (they just require greater scrutiny to ensure safety).
55
+
> Because so many buffer overruns, and thus potential security exploits, have been traced to improper usage of **`memcpy`**, this function is listed among the "banned" functions by the Security Development Lifecycle (SDL). You may observe that some VC++ library classes continue to use **`memcpy`**. Furthermore, you may observe that the VC++ compiler optimizer sometimes emits calls to **`memcpy`**. The Visual C++ product is developed in accordance with the SDL process, and thus usage of this banned function has been closely evaluated. In the case of library use of it, the calls have been carefully scrutinized to ensure that buffer overruns will not be allowed through these calls. In the case of the compiler, sometimes certain code patterns are recognized as identical to the pattern of **`memcpy`**, and are thus replaced with a call to the function. In such cases, the use of **`memcpy`** is no more unsafe than the original instructions would have been; they have simply been optimized to a call to the performance-tuned **`memcpy`** function. Just as the use of "safe" CRT functions doesn’t guarantee safety (they just make it harder to be unsafe), the use of "banned" functions doesn’t guarantee danger (they just require greater scrutiny to ensure safety).
56
56
>
57
-
> Because **memcpy** usage by the VC++ compiler and libraries has been so carefully scrutinized, these calls are permitted within code that is otherwise compliant with SDL. **memcpy** calls introduced in application source code are only compliant with the SDL when that use has been reviewed by security experts.
57
+
> Because **`memcpy`** usage by the VC++ compiler and libraries has been so carefully scrutinized, these calls are permitted within code that is otherwise compliant with SDL. **`memcpy`** calls introduced in application source code are only compliant with the SDL when that use has been reviewed by security experts.
58
58
59
-
The **memcpy** and **wmemcpy** functions will only be deprecated if the constant **_CRT_SECURE_DEPRECATE_MEMORY** is defined prior to the inclusion statement in order for the functions to be deprecated, such as in the example below:
59
+
The **`memcpy`** and **`wmemcpy`** functions will only be deprecated if the constant **`_CRT_SECURE_DEPRECATE_MEMORY`** is defined prior to the inclusion statement in order for the functions to be deprecated, such as in the example below:
60
60
61
61
```C
62
62
#define_CRT_SECURE_DEPRECATE_MEMORY
@@ -74,22 +74,22 @@ or
74
74
75
75
|Routine|Required header|
76
76
|-------------|---------------------|
77
-
|**memcpy**|\<memory.h> or \<string.h>|
78
-
|**wmemcpy**|\<wchar.h>|
77
+
|**`memcpy`**|`<memory.h>` or `<string.h>`|
78
+
|**`wmemcpy`**|`<wchar.h>`|
79
79
80
-
For additional compatibility information, see [Compatibility](../../c-runtime-library/compatibility.md).
80
+
For more compatibility information, see [Compatibility](../../c-runtime-library/compatibility.md).
81
81
82
82
## Example
83
83
84
-
See [memmove](memmove-wmemmove.md) for a sample of how to use **memcpy**.
84
+
See [`memmove`](memmove-wmemmove.md) for a sample of how to use **`memcpy`**.
Number of bytes (**`memmove`**) or characters (**`wmemmove`**) to copy.
42
41
43
42
## Return Value
44
43
45
-
The value of *dest*.
44
+
The value of *`dest`*.
46
45
47
46
## Remarks
48
47
49
-
Copies *count* bytes (**`memmove`**) or characters (**`wmemmove`**) from *src* to *dest*. If some regions of the source area and the destination overlap, both functions ensure that the original source bytes in the overlapping region are copied before being overwritten.
48
+
Copies *`count`* bytes (**`memmove`**) or characters (**`wmemmove`**) from *`src`* to *`dest`*. If some regions of the source area and the destination overlap, both functions ensure that the original source bytes in the overlapping region are copied before being overwritten.
50
49
51
50
**Security Note** Make sure that the destination buffer is the same size or larger than the source buffer. For more information, see [Avoiding Buffer Overruns](/windows/win32/SecBP/avoiding-buffer-overruns).
52
51
53
-
The **`memmove`** and **`wmemmove`** functions will only be deprecated if the constant **`_CRT_SECURE_DEPRECATE_MEMORY`** is defined prior to the inclusion statement in order for the functions to be deprecated, such as in the example below:
52
+
The **`memmove`** and **`wmemmove`** functions will only be deprecated if the constant **`_CRT_SECURE_DEPRECATE_MEMORY`** is defined before the inclusion statement in order for the functions to be deprecated, such as in the example below:
54
53
55
54
```C
56
55
#define_CRT_SECURE_DEPRECATE_MEMORY
@@ -68,10 +67,10 @@ or
68
67
69
68
|Routine|Required header|
70
69
|-------------|---------------------|
71
-
|**`memmove`**|\<string.h>|
72
-
|**`wmemmove`**|\<wchar.h>|
70
+
|**`memmove`**|`<string.h>`|
71
+
|**`wmemmove`**|`<wchar.h>`|
73
72
74
-
For additional compatibility information, see [Compatibility](../../c-runtime-library/compatibility.md).
73
+
For more compatibility information, see [Compatibility](../../c-runtime-library/compatibility.md).
0 commit comments