One of our client software requires that the Word PIA is installed.
I have already put the check in the MSI and it works like a charm. (in case
MSI run manually)

Now to convert it over to C++ for the Bootstrapper, thought it would be easy
as pie since the method is a C++ call :(

the Bootstrapper blows up when it is calling the MsiLocateComponent method
in WixStandardBootstrapperApplication.cpp

Changes:

precomp.h:

#include <Msi.h>

#pragma comment(lib, "msi.lib") // or else get a link error :(

WixStandardBootstrapperApplication.cpp:

HRESULT hr = S_OK;
DWORD dwFileAttributes = 0;
BOOL fValidateWordPIAInstalled = TRUE;
BOOL fValidateComponentExists = TRUE;
LPWSTR sczUnformattedComponentIdx86 =
L"{9FE736B7-B1EE-410C-8D07-082891C3DAC8}";
LPWSTR sczComponentIdx86 = NULL;
LPWSTR sczUnformattedComponentIdx64 =
L"{13C07AF5-B206-4A48-BB5B-B8022333E3CA}";
LPWSTR sczComponentIdx64 = NULL;
INSTALLSTATE installState = INSTALLSTATE_BROKEN; // or INSTALLSTATE_LOCAL
LPWSTR sczPath = NULL;
DWORD cch = 1024; // hmm MAX_PATH would be better...
DWORD dwIndex;
LPCWSTR sczFoundStrIn = NULL;

hr = StrAlloc(&sczPath, cch);
ExitOnFailure(hr, "Failed to allocate string for component path.")

hr =  BalFormatString(sczUnformattedComponentIdx86, &sczComponentIdx86);
installState = MsiLocateComponent(sczComponentIdx86, sczPath, &cch);

// Check to see if the path for the component exists
fValidateComponentExists = FileExistsEx(sczPath, &dwFileAttributes);


// If the component is not installed or unknown AND the component path
doesn't exist fail
if ( (INSTALLSTATE_UNKNOWN == installState || INSTALLSTATE_ABSENT ==
installState) && !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;
}

// code for x64 is exactly the same but use the x64 component ID GUID :)

any help would be appreciated!!

thanks,

Steve






--
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-tp7594186.html
Sent from the wix-devs mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
WiX-devs mailing list
WiX-devs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-devs

Reply via email to