In the old days (for example, Windows 3.1 and earlier), resources were copied to memory at boot time, and you just got a handle from them. A memory manager could do things like transferring a copy in memory to defragment space or even secretly unload a resource until you need it. When you needed a resource, the second step was taken to "block" it in memory. This gave you a pointer to the copy and convinced that the resource manager does not move it until you unlock it again.
On 32-bit versions of Windows, resources are not copied. The executable (or DLL) is mapped to memory, and if you touch the resource, the virtual memory manager will make sure that it is there for you.
APIs (FindResource, LoadResource, LockResource) reflect old days, with handles to resources and locking of handles, etc. But the implementation is much simpler now, because the descriptor is just a pointer to the beginning of the resource and the lock does not actually work, throws the descriptor into the type of the pointer and returns it.
Adrian mccarthy
source share