1

In the Zabbix Agent MSI, there is the following line, when one opens MSI:

<Condition Message="Please enter the name or IP address in the Zabbix server IP/DNS field !">NOT (NOT (Installed OR WIX_UPGRADE_DETECTED OR WIX_DOWNGRADE_DETECTED)) OR ((NOT (Installed OR WIX_UPGRADE_DETECTED OR WIX_DOWNGRADE_DETECTED)) AND ((UILevel<5 AND SERVER) OR UILevel=5))</Condition>

Can someone explain the logic? When one rewrites the condition in a more sensible way:

NOT (
    NOT (Installed OR WIX_UPGRADE_DETECTED OR WIX_DOWNGRADE_DETECTED)
) OR (
    (NOT (Installed OR WIX_UPGRADE_DETECTED OR WIX_DOWNGRADE_DETECTED))
    AND ((UILevel<5 AND SERVER) OR UILevel=5)
)

So if Installed=1 then the condition is satisfied due to the double NOT (which it should not be, since the message should only appear if the software is not installed and thus, there is an error in the MSI). The double NOT makes no sense.

Or is there some other interpretation of the condition above?

atapaka
  • 1,172
  • 4
  • 14
  • 30
  • That looks odd indeed. What is the gig? You just need to get the software installed, or you want to decipher the logic? I would just zap that to get it installed to be honest, but if you want to test the conditions you could evaluate them in a VBScript in different installation modes using `Session.EvaluateCondition("condition here")`. I have a test package for this, but it is not anywhere for download yet. You can also just use a simple VBScript and condition it to show a flag dialog. [Sample here](https://stackoverflow.com/a/52377800/129130) (bottom). – Stein Åsmul Oct 02 '19 at 14:00
  • @SteinÅsmul I want to understand the logic. – atapaka Oct 02 '19 at 14:01
  • Did you author this condition or did someone else? There's no telling what they intended for it to do and if it has any defects in that implementation. It certainly seems over engineered to me. – Christopher Painter Oct 02 '19 at 19:19
  • @leosenko This condition looks like nonsense to be honest - almost like it is a joke. If you want I can send you a tool to help you test it yourself, but as far as I can see it is basically almost always true. Maybe there is something I am missing with that SERVER property. – Stein Åsmul Oct 03 '19 at 12:15

1 Answers1

2

This is all governed by Windows Installer's Conditional Statement Syntax

https://learn.microsoft.com/en-us/windows/win32/msi/conditional-statement-syntax

It appears your trying to do custom UI work but I don't know how all of that relates to a server name IP address.

In these scenarios I have a custom action that implements business rule checks (reach out and touch a server or validate FQDN/IP ) and set a property to 1 or 0. Then I use mutually exclusive control events (Publish elements with Condition in the inner text ) to either Spawn a dialog that says there is a problem or NewDialog the next dialog of the wizard loop.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • Yeah, I thought the same when I saw that condition. You have to break that down in a script that can be understood easily. Another great case for VBScript :-). Visible source and all that. – Stein Åsmul Oct 02 '19 at 19:18
  • VBScript? LOL ... think that can't be done in PowerShell or C# in no time flat? If I cared enough I could probably quickly write an EXE that lets you set a bunch of Key/Value pairs in a Property bag, type in a condition and evaluate if it's true or false as you type it. – Christopher Painter Oct 02 '19 at 19:22