[1/2] msi: Don't try to install or remove ODBC drivers if the component is disabled.

Hans Leidekker hans at codeweavers.com
Thu Dec 9 03:27:56 CST 2010


Fixes http://bugs.winehq.org/show_bug.cgi?id=25452
---
 dlls/msi/action.c |   84 +++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 78 insertions(+), 6 deletions(-)

diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index 15c04c9..2cccdc9 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -5953,8 +5953,9 @@ static UINT ITERATE_InstallODBCDriver( MSIRECORD *rec, LPVOID param )
     LPWSTR driver, driver_path, ptr;
     WCHAR outpath[MAX_PATH];
     MSIFILE *driver_file = NULL, *setup_file = NULL;
+    MSICOMPONENT *comp;
     MSIRECORD *uirow;
-    LPCWSTR desc, file_key;
+    LPCWSTR desc, file_key, component;
     DWORD len, usage;
     UINT r = ERROR_SUCCESS;
 
@@ -5965,6 +5966,17 @@ static UINT ITERATE_InstallODBCDriver( MSIRECORD *rec, LPVOID param )
     static const WCHAR usage_fmt[] = {
         'F','i','l','e','U','s','a','g','e','=','1',0};
 
+    component = MSI_RecordGetString( rec, 2 );
+    comp = get_loaded_component( package, component );
+    if (!comp)
+        return ERROR_SUCCESS;
+
+    if (!comp->Enabled)
+    {
+        TRACE("component is disabled\n");
+        return ERROR_SUCCESS;
+    }
+
     desc = MSI_RecordGetString(rec, 3);
 
     file_key = MSI_RecordGetString( rec, 4 );
@@ -6035,8 +6047,9 @@ static UINT ITERATE_InstallODBCTranslator( MSIRECORD *rec, LPVOID param )
     LPWSTR translator, translator_path, ptr;
     WCHAR outpath[MAX_PATH];
     MSIFILE *translator_file = NULL, *setup_file = NULL;
+    MSICOMPONENT *comp;
     MSIRECORD *uirow;
-    LPCWSTR desc, file_key;
+    LPCWSTR desc, file_key, component;
     DWORD len, usage;
     UINT r = ERROR_SUCCESS;
 
@@ -6045,6 +6058,17 @@ static UINT ITERATE_InstallODBCTranslator( MSIRECORD *rec, LPVOID param )
     static const WCHAR setup_fmt[] = {
         'S','e','t','u','p','=','%','s',0};
 
+    component = MSI_RecordGetString( rec, 2 );
+    comp = get_loaded_component( package, component );
+    if (!comp)
+        return ERROR_SUCCESS;
+
+    if (!comp->Enabled)
+    {
+        TRACE("component is disabled\n");
+        return ERROR_SUCCESS;
+    }
+
     desc = MSI_RecordGetString(rec, 3);
 
     file_key = MSI_RecordGetString( rec, 4 );
@@ -6108,8 +6132,9 @@ static UINT ITERATE_InstallODBCTranslator( MSIRECORD *rec, LPVOID param )
 static UINT ITERATE_InstallODBCDataSource( MSIRECORD *rec, LPVOID param )
 {
     MSIPACKAGE *package = param;
+    MSICOMPONENT *comp;
     LPWSTR attrs;
-    LPCWSTR desc, driver;
+    LPCWSTR desc, driver, component;
     WORD request = ODBC_ADD_SYS_DSN;
     INT registration;
     DWORD len;
@@ -6119,6 +6144,17 @@ static UINT ITERATE_InstallODBCDataSource( MSIRECORD *rec, LPVOID param )
     static const WCHAR attrs_fmt[] = {
         'D','S','N','=','%','s',0 };
 
+    component = MSI_RecordGetString( rec, 2 );
+    comp = get_loaded_component( package, component );
+    if (!comp)
+        return ERROR_SUCCESS;
+
+    if (!comp->Enabled)
+    {
+        TRACE("component is disabled\n");
+        return ERROR_SUCCESS;
+    }
+
     desc = MSI_RecordGetString(rec, 3);
     driver = MSI_RecordGetString(rec, 4);
     registration = MSI_RecordGetInteger(rec, 5);
@@ -6196,9 +6232,21 @@ static UINT ACTION_InstallODBC( MSIPACKAGE *package )
 static UINT ITERATE_RemoveODBCDriver( MSIRECORD *rec, LPVOID param )
 {
     MSIPACKAGE *package = param;
+    MSICOMPONENT *comp;
     MSIRECORD *uirow;
     DWORD usage;
-    LPCWSTR desc;
+    LPCWSTR desc, component;
+
+    component = MSI_RecordGetString( rec, 2 );
+    comp = get_loaded_component( package, component );
+    if (!comp)
+        return ERROR_SUCCESS;
+
+    if (!comp->Enabled)
+    {
+        TRACE("component is disabled\n");
+        return ERROR_SUCCESS;
+    }
 
     desc = MSI_RecordGetString( rec, 3 );
     if (!SQLRemoveDriverW( desc, FALSE, &usage ))
@@ -6222,9 +6270,21 @@ static UINT ITERATE_RemoveODBCDriver( MSIRECORD *rec, LPVOID param )
 static UINT ITERATE_RemoveODBCTranslator( MSIRECORD *rec, LPVOID param )
 {
     MSIPACKAGE *package = param;
+    MSICOMPONENT *comp;
     MSIRECORD *uirow;
     DWORD usage;
-    LPCWSTR desc;
+    LPCWSTR desc, component;
+
+    component = MSI_RecordGetString( rec, 2 );
+    comp = get_loaded_component( package, component );
+    if (!comp)
+        return ERROR_SUCCESS;
+
+    if (!comp->Enabled)
+    {
+        TRACE("component is disabled\n");
+        return ERROR_SUCCESS;
+    }
 
     desc = MSI_RecordGetString( rec, 3 );
     if (!SQLRemoveTranslatorW( desc, &usage ))
@@ -6248,9 +6308,10 @@ static UINT ITERATE_RemoveODBCTranslator( MSIRECORD *rec, LPVOID param )
 static UINT ITERATE_RemoveODBCDataSource( MSIRECORD *rec, LPVOID param )
 {
     MSIPACKAGE *package = param;
+    MSICOMPONENT *comp;
     MSIRECORD *uirow;
     LPWSTR attrs;
-    LPCWSTR desc, driver;
+    LPCWSTR desc, driver, component;
     WORD request = ODBC_REMOVE_SYS_DSN;
     INT registration;
     DWORD len;
@@ -6258,6 +6319,17 @@ static UINT ITERATE_RemoveODBCDataSource( MSIRECORD *rec, LPVOID param )
     static const WCHAR attrs_fmt[] = {
         'D','S','N','=','%','s',0 };
 
+    component = MSI_RecordGetString( rec, 2 );
+    comp = get_loaded_component( package, component );
+    if (!comp)
+        return ERROR_SUCCESS;
+
+    if (!comp->Enabled)
+    {
+        TRACE("component is disabled\n");
+        return ERROR_SUCCESS;
+    }
+
     desc = MSI_RecordGetString( rec, 3 );
     driver = MSI_RecordGetString( rec, 4 );
     registration = MSI_RecordGetInteger( rec, 5 );
-- 
1.7.1






More information about the wine-patches mailing list