PATCH: hack for GetClassName

Marcus Meissner marcus at jet.franken.de
Sat Jan 18 01:57:15 CST 2003


Hi,

This is Bug 1220.

There is an older InstallShield version which does:
	GetClassName(somewindow, buffer, buflen);
with buffer already filled with a classname.

The GetClassName fails since it is not implemented cross process yet,
but the buffer is still there.

InstallShield then continues to not check the return value of
GetClassName() and strcmp()s this name against ... the value
previously there.
And it outputs:
 "There is another setup already running. You must close out of
 that setup before ..."

The hack below makes that InstallShield installer work, it should
be removed once we can do interprocess class access.

Ciao, Marcus

Changelog:
	Hack for one InstallShield version which lacks errorchecking
	after GetClassName.


Index: windows/class.c
===================================================================
RCS file: /home/wine/wine/windows/class.c,v
retrieving revision 1.56
diff -u -u -r1.56 class.c
--- windows/class.c	3 Dec 2002 23:34:53 -0000	1.56
+++ windows/class.c	18 Jan 2003 07:52:06 -0000
@@ -1081,8 +1081,19 @@
  */
 INT WINAPI GetClassNameA( HWND hwnd, LPSTR buffer, INT count )
 {
-    INT ret = GlobalGetAtomNameA( GetClassLongA( hwnd, GCW_ATOM ), buffer, count );
+    ATOM xatom = GetClassLongA( hwnd, GCW_ATOM );
+    INT ret;
 
+    if (!xatom && (GetLastError() == ERROR_INVALID_WINDOW_HANDLE)) {
+	/* FIXME: One broken InstallShield strcpys the correct id over the buffer,
+	 * then GetClassName()s and then strcmp()s this buffer against the same id
+	 * ... So we just clear the buffer a bit.
+	 */
+	if (count && buffer)
+	    buffer[0]='\0';
+	return 0;
+    }
+    ret  = GlobalGetAtomNameA( xatom, buffer, count );
     TRACE("%p %s %x\n",hwnd, debugstr_a(buffer), count);
     return ret;
 }



More information about the wine-patches mailing list