msi makehash fix and others

Aric Stewart aric at codeweavers.com
Thu Jul 29 09:16:36 CDT 2004


	make sure the calling convention for the custom action handlers is right
	
	also make the msistring_makehash return something other than just 1 or 
0. Also handle the case where the string or stored string is null to 
prevent a crash when adding the string
-------------- next part --------------
Index: dlls/msi/action.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/action.c,v
retrieving revision 1.32
diff -u -w -r1.32 action.c
--- dlls/msi/action.c	20 Jul 2004 01:22:37 -0000	1.32
+++ dlls/msi/action.c	29 Jul 2004 14:13:39 -0000
@@ -1102,7 +1102,7 @@
 }
 
 
-typedef UINT CustomEntry(MSIHANDLE);
+typedef UINT __stdcall CustomEntry(MSIHANDLE);
 typedef struct 
 {
         MSIPACKAGE *package;
Index: dlls/msi/string.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/string.c,v
retrieving revision 1.10
diff -u -w -r1.10 string.c
--- dlls/msi/string.c	30 Jun 2004 18:42:02 -0000	1.10
+++ dlls/msi/string.c	29 Jul 2004 14:13:39 -0000
@@ -56,11 +56,15 @@
 {
     int hash = 0;
 
-    while( *str )
+    if (str==NULL)
+        return hash;
+
+    while( *str != '\0' )
     {
-        hash ^= *str++;
+        hash ^= *str;
         hash *= 53;
-        hash = (hash<<5) || (hash>>27);
+/*        hash = (hash<<5) || (hash>>27); */
+        str++;
     }
     return hash;
 }
@@ -354,8 +358,9 @@
     hash = msistring_makehash( str );
     for( i=0; i<st->maxcount; i++ )
     {
-        if( ( st->strings[i].hash == hash ) &&
-            !strcmpW( st->strings[i].str, str ) )
+        if ( (str == NULL && st->strings[i].str == NULL) || 
+            ( ( st->strings[i].hash == hash ) &&
+            !strcmpW( st->strings[i].str, str ) ))
         {
             r = ERROR_SUCCESS;
             *id = i;


More information about the wine-patches mailing list