Do not fallback to defaults if a driver, mapper, or midi is specified

in the registry; consolidate MMDRV_Init() into a single function.
This commit is contained in:
Jeremy White 2005-03-17 10:25:25 +00:00 committed by Alexandre Julliard
parent ac24801db0
commit 40df53aae2
2 changed files with 36 additions and 51 deletions

View File

@ -715,73 +715,54 @@ static BOOL MMDRV_Install(LPCSTR drvRegName, LPCSTR drvFileName, BOOL bIsMapper)
}
/**************************************************************************
* MMDRV_InitFromRegistry [internal]
* MMDRV_Init
*/
static BOOL MMDRV_InitFromRegistry(void)
BOOL MMDRV_Init(void)
{
HKEY hKey;
char buffer[256];
char driver_buffer[256];
char mapper_buffer[256];
char midi_buffer[256];
char* p1;
char* p2;
DWORD type, size;
BOOL ret = FALSE;
TRACE("()\n");
if (RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\WinMM", &hKey)) {
TRACE("Cannot open WinMM config key\n");
return FALSE;
strcpy(driver_buffer, WINE_DEFAULT_WINMM_DRIVER);
strcpy(mapper_buffer, WINE_DEFAULT_WINMM_MAPPER);
strcpy(midi_buffer, WINE_DEFAULT_WINMM_MIDI);
if (! RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\WinMM", &hKey)) {
size = sizeof(driver_buffer);
if (RegQueryValueExA(hKey, "Drivers", 0, &type, (LPVOID)driver_buffer, &size))
strcpy(driver_buffer, WINE_DEFAULT_WINMM_DRIVER);
/* finish with mappers */
size = sizeof(mapper_buffer);
if (RegQueryValueExA(hKey, "WaveMapper", 0, &type, (LPVOID)mapper_buffer, &size))
strcpy(mapper_buffer, WINE_DEFAULT_WINMM_MAPPER);
size = sizeof(midi_buffer);
if (RegQueryValueExA(hKey, "MidiMapper", 0, &type, (LPVOID)midi_buffer, &size))
strcpy(midi_buffer, WINE_DEFAULT_WINMM_MIDI);
RegCloseKey(hKey);
}
size = sizeof(buffer);
if (!RegQueryValueExA(hKey, "Drivers", 0, &type, (LPVOID)buffer, &size)) {
p1 = buffer;
while (p1) {
p2 = strchr(p1, ';');
if (p2) *p2++ = '\0';
ret |= MMDRV_Install(p1, p1, FALSE);
p1 = p2;
}
p1 = driver_buffer;
while (p1) {
p2 = strchr(p1, ';');
if (p2) *p2++ = '\0';
ret |= MMDRV_Install(p1, p1, FALSE);
p1 = p2;
}
/* finish with mappers */
size = sizeof(buffer);
if (!RegQueryValueExA(hKey, "WaveMapper", 0, &type, (LPVOID)buffer, &size))
ret |= MMDRV_Install("wavemapper", buffer, TRUE);
size = sizeof(buffer);
if (!RegQueryValueExA(hKey, "MidiMapper", 0, &type, (LPVOID)buffer, &size))
ret |= MMDRV_Install("midimapper", buffer, TRUE);
RegCloseKey(hKey);
ret |= MMDRV_Install("wavemapper", mapper_buffer, TRUE);
ret |= MMDRV_Install("midimapper", midi_buffer, TRUE);
return ret;
}
/**************************************************************************
* MMDRV_InitHardcoded [internal]
*/
static BOOL MMDRV_InitHardcoded(void)
{
TRACE("()\n");
/* first load hardware drivers */
MMDRV_Install("wineoss.drv", "wineoss.drv", FALSE);
/* finish with mappers */
MMDRV_Install("wavemapper", "msacm.drv", TRUE);
MMDRV_Install("midimapper", "midimap.drv", TRUE);
return TRUE;
}
/**************************************************************************
* MMDRV_Init [internal]
*/
BOOL MMDRV_Init(void)
{
TRACE("()\n");
/* FIXME: MMDRV_InitFromRegistry shall be MMDRV_Init in a near future */
return MMDRV_InitFromRegistry() || MMDRV_InitHardcoded();
}
/******************************************************************
* ExitPerType
*

View File

@ -28,6 +28,10 @@
#include "winbase.h"
#include "mmddk.h"
#define WINE_DEFAULT_WINMM_DRIVER "wineoss.drv"
#define WINE_DEFAULT_WINMM_MAPPER "msacm.drv"
#define WINE_DEFAULT_WINMM_MIDI "midimap.drv"
typedef DWORD (WINAPI *MessageProc16)(UINT16 wDevID, UINT16 wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
typedef DWORD (WINAPI *MessageProc32)(UINT wDevID, UINT wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);