Reputation: 1
I am writing a bootstrapper for a product with several prerequisites. To determine which prereqs to install, I use MSI AppSearch.
The bootstrapper opens the myproduct.msi package with ::MsiOpenPackageEx()
, then calls ::MsiDoAction("AppSearch")
to load the properties, and finally fetches the properties of interest to determine which prereqs need loading. I then close the prereqs session (::MsiCloseHandle()
) so it won't interfere with any MSI sessions used by the prereqs installers. Ultimately (after prereqs are installed) the bootstrapper runs msiexec /i myproduct.msi
.
I want to extend this by calling a custom action ::MsiDoAction("MyExtendedAppSearch")
which will populate additional MSI properties during the prereqs session, using WMI to do searches that MSI AppSearch cannot do. However, when I call that action, it returns ERROR_FUNCTION_NOT_CALLED
. The same action, when called in a real install session, works just fine.
I have tried this with both a C .dll and with VBScript (embedded, Binary
table, doesn't matter). Apparently there is some sort of initialization done in a real install that I am not doing. Also or alternatively, I'm not setting the right flag bits on the action, or should be scheduling it in InstallExecuteSequence
(or not, or something).
Your guidance will be much appreciated. Thanks in advance.
Upvotes: 0
Views: 1056
Reputation: 11
@Cosmin Pirvu: it's not scheduled at all, nor in any sequence table. It exists only in the CustomAction table, and is called explicitly by the chainer program.
Never mind, folks. False alarm/sloppy programmer.
Meta-solution: read your predecessor's code carefully, and read the docs even more carefully.
Solution: ::MsiOpenPackageEx()
was being called with the MSIOPENPACKAGEFLAGS_IGNOREMACHINESTATE
flag. Per the MSI documentation, using that flag returns a restricted session handle that cannot call .dll, .exe or script custom actions.
Not passing that flag -- or, equivalently, calling ::MsiOpenPackage()
(no Ex
) -- returns an unrestricted handle that can .dll, .exe or script custom actions.
Upvotes: 1