fix string value lookups in MSI

Mike McCormack mike at codeweavers.com
Wed Oct 29 14:54:51 CST 2003


ChangeLog:
* fix string value lookups in MSI
-------------- next part --------------
Index: dlls/msi/table.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/table.c,v
retrieving revision 1.3
diff -u -r1.3 table.c
--- dlls/msi/table.c	8 Sep 2003 19:38:46 -0000	1.3
+++ dlls/msi/table.c	28 Oct 2003 07:19:39 -0000
@@ -427,15 +427,21 @@
     TRACE("Finding string %s in %ld strings\n", debugstr_w(buffer), count);
 
     sz = WideCharToMultiByte( CP_ACP, 0, buffer, -1, NULL, 0, NULL, NULL );
+    if( sz <= 0 )
+        return r;
     str = HeapAlloc( GetProcessHeap(), 0, sz );
+    if( !str )
+        return ERROR_NOT_ENOUGH_MEMORY;
     WideCharToMultiByte( CP_ACP, 0, buffer, -1, str, sz, NULL, NULL );
 
     offset = 0;
+    sz--;  /* nul terminated */
     for(i=0; i<count; i++)
     {
         len = st->pool.data[i*2];
         if ( ( sz == len ) && !memcmp( str, st->info.data+offset, sz ) )
         {
+            TRACE("%ld <- %s\n",i,debugstr_an(st->info.data+offset, len) );
             *id = i;
             r = ERROR_SUCCESS;
             break;


More information about the wine-patches mailing list