For you system memory gurus.
Let's say I have shell32.dll loaded by my application. It's very reasonable to expect that especially if manifesting for common controls.
Ok, now let's say my app wants to examine each icon within the shell32 resource. I'd do that by calling, among other APIs, the LockResource API to get a memory pointer to the data I'm querying. For sake of argument, let's say I asked for the memory address of every icon. There are over 2,000 icons.
But per MSDN, there is no "unlock resource" type of API. MSDN simply says that when process unloads that had the resources loaded, the memory will be deallocated/freed. So, if I wanted to release the memory, I could call FreeLibrary on a LoadLibraryEx call. But if the dll is already in process, then FreeLibrary won't release the dll, just decrease its count, correct?
Bottom line. Any ideas how I can access a crap load of memory related to a dll, then release that memory? Or am I way overthinking this? If I'm not overthinking it, I do have some ideas on how to access that information without an inprocess LoadLibraryEx call. And yes, LOAD_LIBRARY_AS_DATAFILE is being used.
Thanx in advance.
Edited & FYI. As an example, viewing Task Manager
Before I call a routine that scans every system32.dll icon for size, depth, etc, I marked the memory used by the project. Once the routine triggers, the memory jumps by about 7MB. After I call FreeLibrary on the LoadLibraryEx, memory doesn't decrease. However, if I use LoadLibraryEx on a dll that isn't currently in process, after the FeeLibrary call, I can see a decrease in memory right away. In the previous exercise, even after waiting several minutes, the memory didn't drop. You may say that 7MB is nothing to be concerned about, but this topic is really a question for knowledge... Looking like an out of process method may be needed?