Markus Amsler : opengl: Allocate DisabledExtensions buffer.

Alexandre Julliard julliard at winehq.org
Mon Mar 24 07:55:04 CDT 2008


Module: wine
Branch: master
Commit: f34efcb83902e9e0cc0cbc548a99464cd5d9bc3e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f34efcb83902e9e0cc0cbc548a99464cd5d9bc3e

Author: Markus Amsler <markus.amsler at oribi.org>
Date:   Mon Mar 24 01:15:31 2008 +0100

opengl: Allocate DisabledExtensions buffer.

---

 dlls/opengl32/wgl.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index d157488..df15b5b 100644
--- a/dlls/opengl32/wgl.c
+++ b/dlls/opengl32/wgl.c
@@ -77,7 +77,7 @@ void (*wine_tsx11_unlock_ptr)(void) = NULL;
 
 static HMODULE opengl32_handle;
 
-static char  internal_gl_disabled_extensions[512];
+static char* internal_gl_disabled_extensions = NULL;
 static char* internal_gl_extensions = NULL;
 
 typedef struct wine_glcontext {
@@ -609,7 +609,7 @@ const GLubyte * WINAPI wine_glGetString( GLenum name )
 	TRACE("- %s:", ThisExtn);
 	
 	/* test if supported API is disabled by config */
-	if (NULL == strstr(internal_gl_disabled_extensions, ThisExtn)) {
+	if (!internal_gl_disabled_extensions || !strstr(internal_gl_disabled_extensions, ThisExtn)) {
 	  strcat(internal_gl_extensions, " ");
 	  strcat(internal_gl_extensions, ThisExtn);
 	  TRACE(" active\n");
@@ -639,7 +639,7 @@ void WINAPI wine_glGetIntegerv( GLenum pname, GLint* params )
 static BOOL process_attach(void)
 {
   HMODULE mod_x11, mod_gdi32;
-  DWORD size = sizeof(internal_gl_disabled_extensions);
+  DWORD size;
   HKEY hkey = 0;
 
   GetDesktopWindow();  /* make sure winex11 is loaded (FIXME) */
@@ -662,10 +662,11 @@ static BOOL process_attach(void)
   wine_wgl.p_wglFinish = (void *)wine_wgl.p_wglGetProcAddress("wglFinish");
   wine_wgl.p_wglFlush = (void *)wine_wgl.p_wglGetProcAddress("wglFlush");
 
-  internal_gl_disabled_extensions[0] = 0;
   if (!RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\OpenGL", &hkey)) {
-    if (!RegQueryValueExA( hkey, "DisabledExtensions", 0, NULL, (LPBYTE)internal_gl_disabled_extensions, &size)) {
-      TRACE("found DisabledExtensions=\"%s\"\n", internal_gl_disabled_extensions);
+    if (!RegQueryValueExA( hkey, "DisabledExtensions", 0, NULL, NULL, &size)) {
+      internal_gl_disabled_extensions = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
+      RegQueryValueExA( hkey, "DisabledExtensions", 0, NULL, (LPBYTE)internal_gl_disabled_extensions, &size);
+      TRACE("found DisabledExtensions=%s\n", debugstr_a(internal_gl_disabled_extensions));
     }
     RegCloseKey(hkey);
   }
@@ -679,6 +680,7 @@ static BOOL process_attach(void)
 static void process_detach(void)
 {
   HeapFree(GetProcessHeap(), 0, internal_gl_extensions);
+  HeapFree(GetProcessHeap(), 0, internal_gl_disabled_extensions);
 }
 
 /***********************************************************************




More information about the wine-cvs mailing list