When I change the code in question to be like the following, it gets the
path.  (When I call the function as you did without and initial call with
the sczPath = NULL and cch = 0, then I never get the path, even if the
buffer was larger than needed.  You second code post has other issues
because pcchBuf is defined as a DWORD array, etc.)   But the following finds
the path to Word on my system.

                DWORD dwFileAttributes = 0; 
                BOOL fValidateComponentExists = FALSE; 
                INSTALLSTATE installState = INSTALLSTATE_BROKEN;
                LPWSTR sczPath = NULL;          
                DWORD cch = 0; 
                LPWSTR sczComponentIdx86 = 
L"{9FE736B7-B1EE-410C-8D07-082891C3DAC8}"; 
                installState = MsiLocateComponentW(sczComponentIdx86, sczPath, 
&cch);
                cch++;
                hr = StrAlloc(&sczPath, cch); 
                ExitOnFailure(hr, "Failed to allocate string for component 
path.") 
                installState = MsiLocateComponentW(sczComponentIdx86, sczPath, 
&cch);
                if (INSTALLSTATE_LOCAL == installState) {
                        fValidateComponentExists = FileExistsEx(sczPath, 
&dwFileAttributes); 
                }




--
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-tp7594186p7594264.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
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-devs

Reply via email to