From 677edc637c76abd45d6d9b1afcb266ce1cfe4dfc Mon Sep 17 00:00:00 2001 From: Stanislav Motylkov Date: Sun, 20 Jan 2019 19:55:45 +0300 Subject: [PATCH] [WINMM] Load Wave/MIDI mapper drivers only after actual device drivers (#1241) CORE-15620 --- dll/win32/winmm/registry.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/dll/win32/winmm/registry.c b/dll/win32/winmm/registry.c index 57f6605b321..563c63f84bb 100644 --- a/dll/win32/winmm/registry.c +++ b/dll/win32/winmm/registry.c @@ -32,6 +32,9 @@ BOOL LoadRegistryMMEDrivers(char* key) DWORD value_data_length = 256; char value_data[256]; + char wavemapper[256] = { 0 }; + char midimapper[256] = { 0 }; + DWORD value_type; if ( RegOpenKeyA(HKEY_LOCAL_MACHINE, key, &drivers_key) != ERROR_SUCCESS ) @@ -60,14 +63,16 @@ BOOL LoadRegistryMMEDrivers(char* key) if ( ! stricmp("wavemapper", value_name) ) { TRACE("Found a Wave-mapper: %s\n", value_data); - valid_driver = TRUE; + /* Delay loading Wave mapper driver */ + strcpy(wavemapper, value_data); is_mapper = TRUE; driver_count ++; } else if ( ! stricmp("midimapper", value_name) ) { TRACE("Found a MIDI-mapper: %s\n", value_data); - valid_driver = TRUE; + /* Delay loading MIDI mapper driver */ + strcpy(midimapper, value_data); is_mapper = TRUE; driver_count ++; } @@ -125,6 +130,23 @@ BOOL LoadRegistryMMEDrivers(char* key) driver_index ++; } + /* Finally load mapper drivers, since they expect device drivers already loaded */ + if (*wavemapper) + { + if (!MMDRV_Install("wavemapper", wavemapper, TRUE)) + { + TRACE("FAILED when initializing %s\n", wavemapper); + } + } + + if (*midimapper) + { + if (!MMDRV_Install("midimapper", midimapper, TRUE)) + { + TRACE("FAILED when initializing %s\n", midimapper); + } + } + TRACE("Found a total of %d drivers\n", driver_count); return driver_count;