Huw Davies (@huw) commented about dlls/mmdevapi/main.c:
DisableThreadLibraryCalls(hinstDLL); break; case DLL_PROCESS_DETACH:
main_loop_stop();
Doesn't this cause a deadlock? This call will block until the main loop thread terminates, but that thread is not told to terminate until the process_detach syscall, which is called later on.