Why does MAKEINTRESOURCE() work?

This works because Windows doesn’t allow mapping pages for the first 64 KB of the address space. To catch null pointer references. But I think also to catch pointer bugs in programs that were converted from the 16-bit version of Windows.

A side-effect is that this allows to reliably distinguish resource IDs packed into a pointer value since they’ll always point to non-mappable memory.

Leave a Comment