> For the complete documentation index, see [llms.txt](https://pwnsec-notes.gitbook.io/ctf-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pwnsec-notes.gitbook.io/ctf-notes/malware-analysis/memory-mapping.md).

# Memory Mapping

Memory-mapping is **a mechanism that maps a portion of a file, or an entire file, on disk to a range of addresses within an application's address space**. The application can then access files on disk in the same way it accesses dynamic memory.

## Unmaping **mechanism**&#x20;

To unmap the PE file manually we must make Raw Addr =  Virtual Addr and Raw Size = Virtual size

PE-bear used to unmap the PE file

<figure><img src="https://1504879363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F40QKoxlr9Mj1ke1fMHsL%2Fuploads%2FfLJzLRhy3Qz4wgkLmczE%2FMapped.PNG?alt=media&amp;token=b0705323-bdc3-40dc-8ddb-fe40b2ba7d4b" alt=""><figcaption><p>mapped</p></figcaption></figure>

<figure><img src="https://1504879363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F40QKoxlr9Mj1ke1fMHsL%2Fuploads%2FktiZCbjyCDsKnzzBgfcp%2Funmapped.PNG?alt=media&amp;token=4aacf190-4a6e-49fc-9bc6-352df2cec142" alt=""><figcaption><p>unmapped</p></figcaption></figure>
