Alexandre's modification to profile.c (loading of wine's config file inside the registry) in a HKLM has some impact on the code since now, the PROFILE_GetWineIniString (and some other functions) use the global var wine_profile_key (misc/profile.c): hence code calling PROFILE_Get... will fail if it's not run within the "initial" process' context (initial means here the one which created the key) there are two ways to fix it: 1/ make wine_profile_key a global handle 2/ no longer use PROFILE_Get.... functions when they could fail, and use the RegXXXX API instead. I don't favor option 1 (because code using PROFILE_GetXXX from another process is broken, and tweaking PROFILE_GetXXX will not fix this very broken code) So option 2 is my favorite, but implies that HKLM\Software\Wine\Wine\Config is *really* specified as the Config key name (this sounds obvious, but I'd rather want this to be clear to anyone), and won't change in a near future attached is a patch to winmm DLL to fix loading of MCI options using option 2 grep:ing for PROFILE_Get... shows that there's at least another broken DLL winaspi 16&32 which requires the same fix (any volunteer ?) dlls/winmm/mci.c: got rid of PROFILE_ functions, now accessing Wine config options through registry A+ -- --------------- Eric Pouech (http://perso.wanadoo.fr/eric.pouech/) "The future will be better tomorrow", Vice President Dan Quayle
Index: dlls/winmm/mci.c =================================================================== RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/mci.c,v retrieving revision 1.7 diff -u -r1.7 mci.c --- dlls/winmm/mci.c 2000/02/16 22:47:25 1.7 +++ dlls/winmm/mci.c 2000/02/20 10:04:59 @@ -11,7 +11,6 @@ #include <string.h> #include "winbase.h" -#include "windef.h" #include "wingdi.h" #include "winuser.h" #include "heap.h" @@ -19,9 +18,9 @@ #include "winemm.h" #include "selectors.h" #include "digitalv.h" -#include "options.h" #include "wine/winbase16.h" -#include "debugtools.h" +#include "debugtools.h" +#include "winreg.h" DEFAULT_DEBUG_CHANNEL(mci); @@ -2474,15 +2473,26 @@ BOOL MULTIMEDIA_MciInit(void) { LPSTR ptr1, ptr2; + HKEY hWineConf; + HKEY hkey; + DWORD err; + DWORD type; + DWORD count = 2048; MCI_InstalledCount = 0; - ptr1 = MCI_lpInstallNames = HeapAlloc(GetProcessHeap(), 0, 2048); + ptr1 = MCI_lpInstallNames = HeapAlloc(GetProcessHeap(), 0, count); if (!MCI_lpInstallNames) return FALSE; /* FIXME: should do also some registry diving here ? */ - if (PROFILE_GetWineIniString("options", "mci", "", MCI_lpInstallNames, 2048) > 0) { + if (!(err = RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config", +&hWineConf)) && + !(err = RegOpenKeyA(hWineConf, "options", &hkey))) { + err = RegQueryValueExA(hkey, "mci", 0, &type, MCI_lpInstallNames, &count); + RegCloseKey(hkey); + + } + if (!err) { TRACE("Wine => '%s' \n", ptr1); while ((ptr2 = strchr(ptr1, ':')) != 0) { *ptr2++ = 0; @@ -2494,13 +2504,14 @@ TRACE("---> '%s' \n", ptr1); ptr1 += strlen(ptr1) + 1; } else { - GetPrivateProfileStringA("mci", NULL, "", MCI_lpInstallNames, 2048, "SYSTEM.INI"); + GetPrivateProfileStringA("mci", NULL, "", MCI_lpInstallNames, count, +"SYSTEM.INI"); while (strlen(ptr1) > 0) { TRACE("---> '%s' \n", ptr1); ptr1 += strlen(ptr1) + 1; MCI_InstalledCount++; } } + RegCloseKey(hWineConf); return TRUE; }