Moved config parameters to HKCU\Software\Wine\DirectSound.

This commit is contained in:
Alexandre Julliard 2005-06-14 12:34:00 +00:00
parent 9ad3a97acb
commit 2e5cc85dcf
1 changed files with 15 additions and 23 deletions

View File

@ -116,7 +116,8 @@ inline static DWORD get_config_key( HKEY defkey, HKEY appkey, const char *name,
char *buffer, DWORD size ) char *buffer, DWORD size )
{ {
if (appkey && !RegQueryValueExA( appkey, name, 0, NULL, buffer, &size )) return 0; if (appkey && !RegQueryValueExA( appkey, name, 0, NULL, buffer, &size )) return 0;
return RegQueryValueExA( defkey, name, 0, NULL, buffer, &size ); if (defkey && !RegQueryValueExA( defkey, name, 0, NULL, buffer, &size )) return 0;
return ERROR_FILE_NOT_FOUND;
} }
@ -126,38 +127,29 @@ inline static DWORD get_config_key( HKEY defkey, HKEY appkey, const char *name,
void setup_dsound_options(void) void setup_dsound_options(void)
{ {
char buffer[MAX_PATH+1]; char buffer[MAX_PATH+16];
HKEY hkey, appkey = 0; HKEY hkey, appkey = 0;
DWORD len; DWORD len;
buffer[MAX_PATH]='\0'; buffer[MAX_PATH]='\0';
/* @@ Wine registry key: HKLM\Software\Wine\Wine\Config\dsound */ /* @@ Wine registry key: HKCU\Software\Wine\DirectSound */
if (RegCreateKeyExA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\dsound", 0, NULL, if (RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\DirectSound", &hkey )) hkey = 0;
REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL ))
{
ERR("Cannot create config registry key\n" );
ExitProcess(1);
}
len = GetModuleFileNameA( 0, buffer, MAX_PATH ); len = GetModuleFileNameA( 0, buffer, MAX_PATH );
if (len && len < MAX_PATH) if (len && len < MAX_PATH)
{ {
HKEY tmpkey; HKEY tmpkey;
/* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe\DirectSound */
/* @@ Wine registry key: HKLM\Software\Wine\Wine\Config\AppDefaults\app.exe\dsound */ if (!RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\AppDefaults", &tmpkey ))
if (!RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\AppDefaults", &tmpkey ))
{ {
char appname[MAX_PATH+16]; char *p, *appname = buffer;
char *p = strrchr( buffer, '\\' ); if ((p = strrchr( appname, '/' ))) appname = p + 1;
if (p!=NULL) { if ((p = strrchr( appname, '\\' ))) appname = p + 1;
lstrcpynA(appname,p+1,MAX_PATH); strcat( appname, "\\DirectSound" );
strcat(appname,"\\dsound"); TRACE("appname = [%s] \n",appname);
TRACE("appname = [%s] \n",appname); if (RegOpenKeyA( tmpkey, appname, &appkey )) appkey = 0;
if (RegOpenKeyA( tmpkey, appname, &appkey )) RegCloseKey( tmpkey );
appkey = 0;
RegCloseKey( tmpkey );
}
} }
} }
@ -196,7 +188,7 @@ void setup_dsound_options(void)
ds_default_capture = atoi(buffer); ds_default_capture = atoi(buffer);
if (appkey) RegCloseKey( appkey ); if (appkey) RegCloseKey( appkey );
RegCloseKey( hkey ); if (hkey) RegCloseKey( hkey );
if (ds_emuldriver != DS_EMULDRIVER ) if (ds_emuldriver != DS_EMULDRIVER )
WARN("ds_emuldriver = %d (default=%d)\n",ds_emuldriver, DS_EMULDRIVER); WARN("ds_emuldriver = %d (default=%d)\n",ds_emuldriver, DS_EMULDRIVER);