diff --git a/documentation/registry.sgml b/documentation/registry.sgml index cecf3eb7904d560db5f42c60ce7549d096f1f7ac..07774088cac3548f919b35d978f44191abdd2616 100644 --- a/documentation/registry.sgml +++ b/documentation/registry.sgml @@ -256,6 +256,15 @@ ln -sf /usr/local/etc/wine.userreg wine.userreg </para> <variablelist> + <varlistentry> + <term>GlobalRegistryDir</term> + <listitem> + <para> + Optional. Sets the path to look for the Global + Registry. + </para> + </listitem> + </varlistentry> <varlistentry> <term>LoadGlobalRegistryFiles</term> <listitem> diff --git a/documentation/samples/config b/documentation/samples/config index 86533015e4bd1ccc7b69cdccef03f8ac891c907d..3174b4f7531479b78143330063b780eb0b3487f8 100644 --- a/documentation/samples/config +++ b/documentation/samples/config @@ -220,6 +220,8 @@ WINE REGISTRY Version 2 [registry] ;These are all booleans. Y/y/T/t/1 are true, N/n/F/f/0 are false. ;Defaults are read all, write to Home +; Where to find the global registries +;"GlobalRegistryDir" = "/etc"; ; Global registries (stored in /etc) "LoadGlobalRegistryFiles" = "Y" ; Home registries (stored in ~user/.wine/) diff --git a/misc/registry.c b/misc/registry.c index d7e20639431424555793f5178f5bb4546f8df17e..8eae5438711c0822f34c5ee62fdd56a286da68cb 100644 --- a/misc/registry.c +++ b/misc/registry.c @@ -64,9 +64,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(reg); -/* FIXME: following defines should be configured global */ -#define SAVE_GLOBAL_REGBRANCH_USER_DEFAULT ETCDIR"/wine.userreg" -#define SAVE_GLOBAL_REGBRANCH_LOCAL_MACHINE ETCDIR"/wine.systemreg" +#define SAVE_GLOBAL_REGBRANCH_USER_DEFAULT "/wine.userreg" +#define SAVE_GLOBAL_REGBRANCH_LOCAL_MACHINE "/wine.systemreg" /* relative in ~user/.wine/ : */ #define SAVE_LOCAL_REGBRANCH_CURRENT_USER "user.reg" @@ -1651,13 +1650,32 @@ static void _load_windows_registry( HKEY hkey_local_machine, HKEY hkey_current_u /* load global registry files (stored in /etc/wine) [Internal] */ static void _load_global_registry( HKEY hkey_local_machine, HKEY hkey_users ) { + WCHAR Wglobalregistrydir[MAX_PATHNAME_LEN]; + char globalregistrydir[MAX_PATHNAME_LEN]; + char configfile[MAX_PATHNAME_LEN]; + static const WCHAR registryW[] = {'r','e','g','i','s','t','r','y',0}; + static const WCHAR GlobalRegistryDirW[] = {'G','l','o','b','a','l','R','e','g','i','s','t','r','y','D','i','r',0}; + static const WCHAR empty_strW[] = { 0 }; + TRACE("(void)\n"); + /* Override ETCDIR? */ + PROFILE_GetWineIniString( registryW, GlobalRegistryDirW, empty_strW , Wglobalregistrydir, MAX_PATHNAME_LEN); + WideCharToMultiByte(CP_ACP, 0, Wglobalregistrydir, -1, globalregistrydir, MAX_PATHNAME_LEN, NULL, NULL); + + if (globalregistrydir[0] != '/') strcpy(globalregistrydir, ETCDIR); + + TRACE("GlobalRegistryDir is '%s'.\n", globalregistrydir); + /* Load the global HKU hive directly from sysconfdir */ - load_wine_registry( hkey_users, SAVE_GLOBAL_REGBRANCH_USER_DEFAULT ); + strcpy(configfile, globalregistrydir); + strcat(configfile, SAVE_GLOBAL_REGBRANCH_USER_DEFAULT); + load_wine_registry( hkey_users, configfile ); /* Load the global machine defaults directly from sysconfdir */ - load_wine_registry( hkey_local_machine, SAVE_GLOBAL_REGBRANCH_LOCAL_MACHINE ); + strcpy(configfile, globalregistrydir); + strcat(configfile, SAVE_GLOBAL_REGBRANCH_LOCAL_MACHINE); + load_wine_registry( hkey_local_machine, configfile ); } /* load home registry files (stored in ~/.wine) [Internal] */