msi patch: Is this too hacky?

Dmitry Timoshkov dmitry at codeweavers.com
Mon Feb 5 22:15:06 CST 2007


"Misha Koshelev" <mk144210 at bcm.tmc.edu> wrote:

> 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?

Looks like that the flags are placed in the bits higher than 4, so I'd vote
for something like the following:

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

-- 
Dmitry.



More information about the wine-devel mailing list