汗。。实在不明白你怎么会找不到CopyMemory这个API的[
]
CopyMemory
The CopyMemory function copies a block of memory from one location to another.
void CopyMemory(
PVOID Destination,
const VOID* Source,
SIZE_T Length
);
Parameters
Destination
[in] Pointer to the starting address of the copied block's destination.
Source
[in] Pointer to the starting address of the block of memory to copy.
Length
[in] Size of the block of memory to copy, in bytes.
Return Values
This function has no return value.
Remarks
This function is defined as the RtlCopyMemory function. For more information, see Winbase.h and Winnt.h.
If the source and destination blocks overlap, the results are undefined. For overlapped blocks, use the MoveMemory function.
Warning The first parameter, Destination, must be large enough to hold Length bytes of Source;
otherwise, a buffer overrun may occur. This may lead to a denial of service attack against the application if an access violation occurs or, in the worst case, allow an attacker to inject executable code into your process. This is especially true if Destination is a stack-based buffer. Be aware that the last parameter, Length, is the number of bytes to copy into Destination, not the size of the Destination.
The following code example shows a safe way to use CopyMemory:
void test(char *pbData, unsigned int cbData) {
char buf[BUFFER_SIZE];
CopyMemory(buf, pbData, min(cbData,BUFFER_SIZE));
}