V37.1 ExitFix: skip heavy cleanup during process termination

This commit is contained in:
Dusk-92
2026-08-29 11:46:58 +02:00
parent 2a51ab6030
commit d6c53ed634
+8 -2
View File
@@ -1048,11 +1048,17 @@ comptime {
pub export fn DllMain(
_: ?*anyopaque,
reason: u32,
_: ?*anyopaque,
reserved: ?*anyopaque,
) callconv(WINAPI) std.os.windows.BOOL {
switch (reason) {
1 => install(),
0 => uninstall(),
0 => {
// ExitFix: when lpReserved is non-null, Windows is terminating the
// whole process. Do not call into D3D9/COM or other DLLs from
// DLL_PROCESS_DETACH during global teardown; the OS will reclaim
// those resources. Keep full uninstall for explicit FreeLibrary.
if (reserved == null) uninstall();
},
else => {},
}
return @enumFromInt(1);