"Anton Rudnev" mibori@etersoft.ru wrote:
RtlAddVectoredHandler is never fail. vectored_handler_added store adress of handler for DLL_PROCESS_DETACH-case. If vectored_handler_added is null then handler is not been added at DLL_PROCESS_ATTACH-case.
This shouldn't happen.
If handler not has been removed in DLL_PROCESS_DETACH-case, then called it after FreeLibrary (at raise exception).
Then what you need is just add a DLL_PROCESS_DETACH handler. There is no need to check vectored_handler_added for NULL in this case. Also make sure to declare vectored_handler_added with a proper type.