Researching crash in bug 637

Mehmet YASAR myasar at free.fr
Tue May 21 14:57:10 CDT 2002


Hi,

I've a small patch that allows me to get "Font Explorer Light" go
further, both app are relying on a Windows bug.

For example take the following code (see the log) :

int main(int argc, char* argv[])
{
int i;
char buffer[20];

buffer[0] = buffer[1] = buffer[2] = 77;
i = GetLocaleInfoA(0x409, LOCALE_IFIRSTDAYOFWEEK, buffer, 1);

printf("%d:%d ret=%d\n", buffer[0], buffer[1], i);
return 0;
}

On Win2K we have <54:77 ret=0>
On Wine I have   <0 :77 ret=1>

We see that MS returns 0 as failure but modifies buffer[0] !
The following patch should fix this.

Mehmet




-------------- next part --------------
--- /home/mehmet/CVS/wine/ole/ole2nls.c	Sun Apr 28 15:42:21 2002
+++ ole2nls.c	Tue May 21 21:33:58 2002
@@ -574,6 +574,12 @@
     }
     /* if len=0 return only the length, don't touch the buffer*/
     if (len) {
+	/* We behave like Windows when len == 1 */
+	if (len == 1)
+	{
+            buf[0] = retString[0];
+            return 0;
+	}
 	lstrcpynA(buf,retString,len);
 	return strlen(buf) + 1;
     }







More information about the wine-devel mailing list