PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

So there's definitely no UnlockResource?

I'm doing this in my code:

Code:

// Get a pointer to the binary resource
Inst=GetModuleHandle(NULL);
hr=FindResource(Inst,MAKEINTRESOURCE(Id),RT_RCDATA);
if (hr==NULL) return NULL;

hg=LoadResource(Inst,hr);
if (hg==NULL) return NULL;

Data=(unsigned char *)LockResource(hg);

if (pLen) *pLen=(int)SizeofResource(Inst,hr);



I just want to make absolutely doubly-doubly certain that you don't need to do any clean-up after these calls when you are done with the resource, because I just find it hard to believe (no offense Mr Gates) that Windows really doesn't to deallocate these loaded resources.

What happens if it runs out of pages to map the resources to memory?
There is no UnlockResource, nor is there a FreeResource.

LockResource is a nop and returns the passed HGLOBAL parameter cast as a void pointer. See definition in kfuncs.h

If you run out of free memory, the DLL or EXE containing the resource will have failed to load.