msi patch: Is this too hacky?

Misha Koshelev mk144210 at bcm.tmc.edu
Mon Feb 5 20:33:15 CST 2007


Hi, I submitted the following patch to wine-patches but was thinking
about it some more. The problem is that you have the following UI levels
and flags:
    INSTALLUILEVEL_NOCHANGE = 0,
    INSTALLUILEVEL_DEFAULT = 1,
    INSTALLUILEVEL_NONE = 2,
    INSTALLUILEVEL_BASIC = 3,
    INSTALLUILEVEL_REDUCED = 4,
    INSTALLUILEVEL_FULL = 5,
    INSTALLUILEVEL_HIDECANCEL = 0x20,
    INSTALLUILEVEL_PROGRESSONLY = 0x40,
    INSTALLUILEVEL_ENDDIALOG = 0x80,
    INSTALLUILEVEL_SOURCERESONLY = 0x100
and the code to check for the level was:

if ( msi_get_property_int(package, szUILevel, 0) >=
INSTALLUILEVEL_REDUCED)

but the problem is that if any of the flags are set, then immediately
this would assume full UI install even though this is not the case for
some installers (see bug #6992). I proposed this change:

if ( (msi_get_property_int(package, szUILevel, 0) & INSTALLUILEVEL_FULL)
>=
 INSTALLUILEVEL_REDUCED )

It will work because INSTALLUILEVEL_FULL is 4+1 and so doing an AND operation with
INSTALLUI_LEVEL FULL will be 4+1 and with INSTALLUILEVEL_REDUCED will be 4, both
of which are greater than or equal to four. However, if for some reason these UI
levels were to change in the future, or if someone decided to further modify
this code and say, try to check for INSTALLUILEVEL_BASIC (3) they would actually
be getting a 1 instead by doing INSTALLUILEVEL_BASIC & INSTALLUILEVEL_FULL. So
is this too hacky? Is there a simple, better way to do this?

Thanks
Misha

-------------- next part --------------
From 0e3caffc0ca5e5617ee6d494d28a2c180227c09a Mon Sep 17 00:00:00 2001
From: Misha Koshelev <mk144210 at bcm.tmc.edu>
Date: Sun, 4 Feb 2007 01:07:15 -0600
Subject: msi: InstallPackage check for UI level must not disregard INSTALLUILEVEL flags.
---
 dlls/msi/action.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index 0c8ac79..89bf1dd 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -642,7 +642,7 @@ UINT MSI_InstallPackage( MSIPACKAGE *pac
     msi_apply_transforms( package );
     msi_apply_patches( package );
 
-    if ( msi_get_property_int(package, szUILevel, 0) >= INSTALLUILEVEL_REDUCED )
+    if ( (msi_get_property_int(package, szUILevel, 0) & INSTALLUILEVEL_FULL) >= INSTALLUILEVEL_REDUCED )
     {
         package->script->InWhatSequence |= SEQUENCE_UI;
         rc = ACTION_ProcessUISequence(package);
-- 
1.4.1



More information about the wine-devel mailing list