Extreme care should be taken when using SetUnhandledExceptionFilter in a DLL. If you use this API to set the UnhandledExceptionFilter to an address in a DLL, it is possible that the filter pointer will eventually point into arbitrary code if the DLL unloads. And if you are using this API to reset the pointer to the previous value after use, you may inadvertantly set the pointer into unmapped or remapped memory if the original address had been in a DLL that was unloaded during your use. Since it is extremely difficult for user code to control DLL loading and unloading order (or to predict what will occur with future development), it is best to not use this API within a DLL.