Been working on a problem for a customer of ours for the last couple weeks (off and on). On one specific configuration of Dell computers, with a certain disk image on it, they're getting system lockups when the client application does an FreeLibrary. Same image on different computers, no problem. The new computer without this image on it, no problem. Unfortunately this customer has purchased over 600 of these PC's, they *have* to use this image, and are in the process of rolling them out to their end users. So this is an issue that must be resolved, we can't punt on it. The real bitch of this issue is that we can't duplicate the issue here on any computer I've used, no other customer sees the problem, and due to security reasons they won't ship us one of their PC's so I can debug it, nor will they let come onto their site and do it there.
So I'm debugging remotely, old school style. Make up test cases, put in lots of outputdebug strings and ship it to their tech guy to try out, and he emails me the results back. After 40+ hrs of research and test cases I'm no closer to the solution, but I am certain it happens somewhere after the FreeLibrary - something is hanging.
Research led me to a couple articles that I want to make note of for the future, I know I'll be needing this info again one day.
Quick overview of how processes exit on Windows XP
LoadLibraryEx(DONT_RESOLVE_DLL_REFERENCES) is fundamentally flawed
Some reasons not to do anything scary in your DLLMiain
Why are DLLs unloaded in the "wrong" order?
We're using a bunch of packages (BPL's) in our client & dll, but compiling without packages the error still happens. I've got a suspicion the problem is in the finalization code that happens, so I've built up another test case and added outputdebugstrings into all of the finalizations that occur. There's no critical sections in these apps, so that shouldn't be an issue. Ok, back to banging my head on the desk for a while.