[WINMM] Load Wave/MIDI mapper drivers only after actual device drivers (#1241)

CORE-15620
This commit is contained in:
Stanislav Motylkov 2019-01-20 19:55:45 +03:00 committed by Hermès BÉLUSCA - MAÏTO
parent 20ddde0a97
commit 677edc637c

View file

@ -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;