msi: Fix handle leak and consistancy

Aric Stewart aric at codeweavers.com
Mon May 23 08:20:52 CDT 2005


Fix a leaking handle.

Make MsiCollectUserInfo more internally consistant.

Thanks to Mike McCormack.
-------------- next part --------------
Index: dlls/msi/msi.c
===================================================================
RCS file: /home/wine/wine/dlls/msi/msi.c,v
retrieving revision 1.81
diff -u -r1.81 msi.c
--- dlls/msi/msi.c	20 May 2005 18:59:11 -0000	1.81
+++ dlls/msi/msi.c	23 May 2005 13:18:07 -0000
@@ -36,6 +36,7 @@
 #include "winver.h"
 #include "winuser.h"
 #include "wine/unicode.h"
+#include "action.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(msi);
 
@@ -1604,6 +1605,7 @@
     if (pcchSerialBuf)
         *pcchSerialBuf = sz / sizeof(WCHAR);
     
+    RegCloseKey(hkey);
     return USERINFOSTATE_PRESENT;
 }
 
@@ -1622,6 +1624,7 @@
 {
     MSIHANDLE handle;
     UINT rc;
+    MSIPACKAGE *package;
     static const WCHAR szFirstRun[] = {'F','i','r','s','t','R','u','n',0};
 
     TRACE("(%s)\n",debugstr_w(szProduct));
@@ -1630,7 +1633,10 @@
     if (rc != ERROR_SUCCESS)
         return ERROR_INVALID_PARAMETER;
 
-    rc = MsiDoActionW(handle, szFirstRun);
+    package = msihandle2msiinfo(handle, MSIHANDLETYPE_PACKAGE);
+    rc = ACTION_PerformUIAction(package, szFirstRun);
+    msiobj_release( &package->hdr );
+
     MsiCloseHandle(handle);
 
     return rc;
@@ -1640,6 +1646,7 @@
 {
     MSIHANDLE handle;
     UINT rc;
+    MSIPACKAGE *package;
     static const WCHAR szFirstRun[] = {'F','i','r','s','t','R','u','n',0};
 
     TRACE("(%s)\n",debugstr_a(szProduct));
@@ -1648,7 +1655,10 @@
     if (rc != ERROR_SUCCESS)
         return ERROR_INVALID_PARAMETER;
 
-    rc = MsiDoActionW(handle, szFirstRun);
+    package = msihandle2msiinfo(handle, MSIHANDLETYPE_PACKAGE);
+    rc = ACTION_PerformUIAction(package, szFirstRun);
+    msiobj_release( &package->hdr );
+
     MsiCloseHandle(handle);
 
     return rc;


More information about the wine-patches mailing list