Hi all!
PB has support for all dll attach/detach etc. events, but returning zero from AttachProcess does not work. (According to MSDN, returning 0 from a dllmain procedure when attaching to a process makes the system unload the dll immediately and return an error for the caller, or if it's called at process creation, the creation itself fails)
A nice feature would be to allow users to create their own dllmain procedure (if they want to, or just stick with PB's handler which calls AttachProcess() AttachThread(), etc.)
Ability to write a custom DllMain routine
Well honestly if you are writing a plugin for an application, its not sensible. Imagine the main app calls loadlibrary (or openlibrary()) for your dll, which then finds out that it cannot find it's configuration file, (or anything else) so it cannot function. Calling ExitProcess() here kills the whole process which is certainly worse than having the caller process get a simple failure for it's LoadLibrary() call. The latter event is mostly handled by all programs that implement plugins.srod wrote:Yes, allowing a return value from AttachProcess() would be nice; although you can use ExitProcess_() in the AttachProcess() function. I'm not sure if this is sensible, but that hasn't stopped me doing it in the past!