opengl32: Enable per-app override for HKLM\Software\Wine\OpenGL:
HKLM\Software\Wine\AppDefaults\app.exe\OpenGL.
Ken Thomases
ken at codeweavers.com
Mon Aug 28 22:26:51 CDT 2006
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index 178cb6b..e63e5d1 100644
--- a/dlls/opengl32/wgl.c
+++ b/dlls/opengl32/wgl.c
@@ -189,6 +189,19 @@ inline static Font get_font( HDC hdc )
}
+/*
+ * Get a config key from either the app-specific or the default config
+ */
+
+inline static DWORD get_config_key( HKEY defkey, HKEY appkey, const
char *name,
+ char *buffer, DWORD size )
+{
+ if (appkey && !RegQueryValueExA( appkey, name, 0, NULL, (LPBYTE)
buffer, &size )) return 0;
+ if (defkey && !RegQueryValueExA( defkey, name, 0, NULL, (LPBYTE)
buffer, &size )) return 0;
+ return ERROR_FILE_NOT_FOUND;
+}
+
+
/
***********************************************************************
* wglCreateContext (OPENGL32.@)
*/
@@ -1259,6 +1272,9 @@ static BOOL process_attach(void)
void *opengl_handle;
DWORD size = sizeof(internal_gl_disabled_extensions);
HKEY hkey = 0;
+ HKEY appkey = 0;
+ char buffer[MAX_PATH+10];
+ DWORD len;
if (!root || !mod)
{
@@ -1312,11 +1328,36 @@ static BOOL process_attach(void)
}
internal_gl_disabled_extensions[0] = 0;
- if (!RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\\OpenGL",
&hkey)) {
- if (!RegQueryValueExA( hkey, "DisabledExtensions", 0, NULL,
(LPBYTE)internal_gl_disabled_extensions, &size)) {
+
+ /* @@ Wine registry key: HKLM\Software\Wine\OpenGL */
+ if ( RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\\OpenGL",
&hkey) ) hkey = 0;
+
+ len = GetModuleFileNameA( 0, buffer, MAX_PATH );
+ if (len && len < MAX_PATH)
+ {
+ HKEY tmpkey;
+ /* @@ Wine registry key: HKLM\Software\Wine\AppDefaults\app.exe
\OpenGL */
+ if (!RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\
\AppDefaults", &tmpkey ))
+ {
+ char *p, *appname = buffer;
+ if ((p = strrchr( appname, '/' ))) appname = p + 1;
+ if ((p = strrchr( appname, '\\' ))) appname = p + 1;
+ strcat( appname, "\\OpenGL" );
+ TRACE("appname = [%s]\n", appname);
+ if (RegOpenKeyA( tmpkey, appname, &appkey )) appkey = 0;
+ RegCloseKey( tmpkey );
+ }
+ }
+
+ if ( 0 != hkey || 0 != appkey ) {
+ if ( !get_config_key( hkey, appkey, "DisabledExtensions",
internal_gl_disabled_extensions, size) ) {
TRACE("found DisabledExtensions=\"%s\"\n",
internal_gl_disabled_extensions);
}
- RegCloseKey(hkey);
+
+ if (appkey)
+ RegCloseKey( appkey );
+ if (hkey)
+ RegCloseKey( hkey );
}
if (default_cx == NULL) {
More information about the wine-patches
mailing list