With the below code it still crashes the bootstrapper at the first call to 
MsiLocateComponentW: (the log file has the checking x64 Word PIA)

In the precomp.h header file I have added:
#include <Msi.h>        // For MsiLocateComponent call
// To fix MSI linking errors
#pragma comment(lib, "msi.lib")

In the 
WIX_ToolSet_v3.8\src\ext\BalExtension\wixstdba\WixStandardBootstrapperApplication.cpp
 file I have:

DWORD dwFileAttributes = 0;
BOOL fValidateComponentExists = FALSE;
INSTALLSTATE installState = INSTALLSTATE_BROKEN;
LPWSTR sczPath = NULL;
DWORD cch = 0;
LPWSTR sczComponentIdx86 = L"{9FE736B7-B1EE-410C-8D07-082891C3DAC8}";
LPWSTR sczComponentIdx64 = L"{13C07AF5-B206-4A48-BB5B-B8022333E3CA}";

BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Checking the x86 version of the Word 
PIA");
installState = MsiLocateComponentW((LPCWSTR)sczComponentIdx86, sczPath, &cch);
BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "First call to MsiLocateComponentW, the 
install state of x86 Word PIA: %ls", installState);
cch++;
hr = StrAlloc(&sczPath, cch);
ExitOnFailure(hr, "Failed to allocate string for component path.");
installState = MsiLocateComponentW((LPCWSTR)sczComponentIdx86, sczPath, &cch);
BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Second call to MsiLocatecomponentW, 
the install state of x86 Word PIA: %ls", installState);

fValidateComponentExists = FileExistsEx(sczPath, &dwFileAttributes);
BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Retrieve the install path of x86 Word 
PIA: %ls", sczPath);

// If the component is not installed or unknown AND the component path doesn't 
exist fail
if ( (installState == INSTALLSTATE_UNKNOWN || installState == 
INSTALLSTATE_ABSENT) && !fValidateComponentExists )
{
  BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "InstallState of Word x86 PIA is 
%ls", installState);
  BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Install path of Word x86 PIA is 
%ls", sczPath);
  fValidateWordPIAInstalled = FALSE;
}


From: Phill Hogland [via Windows Installer XML (WiX) toolset] 
[mailto:ml-node+s687559n7594274...@n2.nabble.com]
Sent: April-23-14 9:47 AM
To: Steven Ogilvie
Subject: RE: Trying to use MsiLocatecomponent in Bootstrapper to check for a 
Word PIA

Something to note is that in the first call to MsiLocateComponentW, the second 
param (path buffer) must be NULL, and the third param (buffer size) must be 
zero, or you will get INSTALLSTATE_INVALIDARGS.  (And when you allocate a 
larger buffer, prior to the first call, it returns INSTALLSTATE_UNKNOWN.)  But 
what I found curious was that when you make the first call with a NULL pointer 
and zero size indicator, it returns INSTALLSTATE_LOCAL (rather than 
INSTALLSTATE_MOREDATA, as documented).  It also returns the size of the needed 
buffer, without the terminator in cch.  Others have pointed out in MSDN posts 
that they used to get INSTALLSTATE_MOREDATA but a 'change' happened and they 
are now observing INSTALLSTATE_LOCAL (returned by the initial call).

Initially I added a switch (installState) {....} of all possible return codes, 
and then removed it to simplify the post.  You will probably want to add code 
to check the returns, being aware of the above behavior, which seems to differ 
from the documentation.
________________________________
If you reply to this email, your message will be added to the discussion below:
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Trying-to-use-MsiLocatecomponent-in-Bootstrapper-to-check-for-a-Word-PIA-tp7594186p7594274.html
To unsubscribe from Trying to use MsiLocatecomponent in Bootstrapper to check 
for a Word PIA, click 
here<http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7594186&code=U3RldmVuLk9naWx2aWVAdGl0dXMuY29tfDc1OTQxODZ8ODU3MjA0NTIw>.
NAML<http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Trying-to-use-MsiLocatecomponent-in-Bootstrapper-to-check-for-a-Word-PIA-tp7594186p7594280.html
Sent from the wix-devs mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
WiX-devs mailing list
WiX-devs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-devs

Reply via email to