The bafunctions.dll is ideal for the scenario you described.  There is more
info on how to use a bafunctions.dll at  here
<https://wixextba.codeplex.com/>  .  Prior to wix 3.8 you needed to use the
download from that site to modify the behavior of wix 3.7.  But now you just
need to create a win32 DLL project and add the sample code to that project.

1) Define an overridable Variable element in your BA to be used in your
XxxPackage/@InstallCondition to control if your optional package is
installed.  (You can get this working on the command line first before
adding the BAFunctions.dll.)
2)  Create a Win32 DLL project, and copy the sample code from  here
<https://github.com/wixtoolset/wix3/tree/ecfe55eb0654758427dc196f1d98ef4cb3d16f29/src/burn/Samples/bafunctions>
  
(or from the folder tree to the source zip download).
3) In WixBootstrapperBAFunction.cpp (probably in OnDetectComplete), you
would implement the code to detect the prereq, and then set the Variable
(defined in the Bundle).  For this situation I prefer to use a Numeric
variable.

//  based on some test, do not install 'Prereq
hr = m_pEngine->SetVariableNumeric(L"Prereq", 0);
BalExitOnFailure(hr, "Failed to set variable.");

I have done this and it works very well.  You could also implement code in
the Plan handlers rather than using a engine Variable in the
InstallCondition, but I did not do that when I was using the
BAFunctions.dll.  (I since moved to a mba.)



--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Calling-C-API-in-WiX-Standard-Bootstrapper-Application-tp7599620p7599632.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to