> For the complete documentation index, see [llms.txt](https://www.pentestwiki.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.pentestwiki.com/defense-evasion/windows-api/rtlmovememory.md).

# RtlMoveMemory

RtlMoveMemory는 원하는 데이터를 목적지 메모리에 복사하는 함수입니다.

```cpp
VOID RtlMoveMemory(
  _Out_       VOID UNALIGNED *Destination,
  _In_  const VOID UNALIGNED *Source,
  _In_        SIZE_T         Length
);
```

| 인자          | 설명         |
| ----------- | ---------- |
| Destination | 목적지 메모리 주소 |
| Source      | 데이터        |
| Length      | 데이터 크기     |

## Example

```cpp
#include <windows.h>
#include <iostream>
#include <cstring>   // memcmp

int main() {
    // 1. 소스 데이터
    unsigned char source[] = { 0x41, 0x42, 0x43, 0x44 }; // 'A', 'B', 'C', 'D'
    SIZE_T size = sizeof(source);

    // 2. 목적지 버퍼 (초기화)
    unsigned char destination[sizeof(source)] = { 0 };

    // 3. 메모리 복사
    RtlMoveMemory(destination, source, size);

    // 4. 복사 결과 검증
    if (memcmp(source, destination, size)) std::cout << "[-] Memory copy failed" << std::endl;

    // 5. 실제 값 출력
    std::cout << "Source:      ";
    for (unsigned char c : source)
        printf("%02X ", c);
    std::cout << "\n";

    std::cout << "Destination: ";
    for (unsigned char c : destination)
        printf("%02X ", c);
    std::cout << "\n";

    return 0;
}

```

## References

{% embed url="<https://learn.microsoft.com/ko-kr/windows/win32/devnotes/rtlmovememory>" %}
