First, let me define what I mean by saying private property. Normally, properties can be set using scripting such as follows:
<Property Id="CHECKREGISTRY">
<RegistrySearch Id="CheckRegistryKey"
Root="HKLM"
Key="SOFTWARE\Foo"
Name="Bar"
Type="raw" />
</Property>
<Condition Message="You don't have the required permission to install this tool.">
<![CDATA[Installed OR CHECKREGISTRY]]>
</Condition>
But the problem is that you can bypass this check by simply running a script like this:
msiexec.exe /i FooInstaller.msi /quiet CHECKREGISTRY="#1"
and that is against the very first idea that you should have the registry key to be able to do what you want to do.
As you see, a private property -- if exists -- would prevent this and allow being able to set only from within the MSI installer itself.
I was thinking to go to CustomAction
route, but for a very simple thing, it is overly complicated. Is there any simple solution to this problem, or how can we define private properties in the first place?
You can create a private property by naming it with a lowercase letter. Public properties are all-uppercase.
However, you can't use AppSearch
to set private properties.
Remember that MSI databases can be inspected so there's no real security. Best you can get is to use custom actions to obfuscate.
By definition, a property consisting only of uppercase letters is public. To make it private use some lowercase characters.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa371245(v=vs.85).aspx
If you are worried about a public property being set in the command line, just explicitly set it to an empty value before AppSearch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With