When DLL_PROCESS_DETACH tells you that the process is exiting, your best bet is just to return without doing anything
When the function receives a reason code of , the increasingly-inaccurately-named parameter to is used to indicate whether the process is exiting. And if the process is exiting, then you should just return without doing anything. No, really. Don't worry about freeing memory; it will all go away when the process address space is destroyed. Don...