cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Mark_Koehler
Level 6

MsiGetComponentPath Problem

InstallScript MSI

Older version of my application (5.10.120) is already installed, attempting to upgrade to a newer version (5.10.121). Application includes several components and these are installed to multiple directories.

I want to determine 2 things for a couple of components :

1. Is the compoent installed.
2. What is the installation directory for the component.

MsiGetComponentPath would appear to be the solution. It returns the current INSTALLSTATE_LOCAL but the path is empty. What am I doing wrong?

Here's a snippet of my code. I've incuded the prototype of MSIGetComponentPathA because InstallShield doesn't prototype this function :

[CODE]
prototype NUMBER MSI.MsiGetComponentPathA(BYVAL string, BYVAL string, BYVAL string, BYREF NUMBER);

function OnResumeUIBefore()
NUMBER nBytes;
STRING szTemp[255];
NUMBER nState;
begin
nBytes = 255;
nState = MsiGetComponentPathA("{60E11478-21C9-474B-A7CE-EC1A20721E41}","{940CB901-C496-496D-9BFF-32E46EE628E0}",szTemp,nBytes);
end;
[/CODE]

nBytes IS set to non-zero value after the call but szTemp is empty.

I looked but couldn't find any concrete examples of people using MsiGetComponentPath. I've tried different component IDs but valid ones all yield similar empty strings although different non-zero nBytes.

Perhaps I am using it too early in the process? If so, at what point would this information be available.

Thanks
Labels (1)
0 Kudos
(4) Replies
RobertDickau
Flexera Alumni

Before going down this road, the System Search Wizard supports "searches" for components, toward the bottom of the list of search types. Would that work for you?

(If you do want to go down that road, the third argument should probably be BYREF STRING...)
0 Kudos
Mark_Koehler
Level 6

RobertDickau wrote:
Before going down this road, the System Search Wizard supports "searches" for components, toward the bottom of the list of search types. Would that work for you?

(If you do want to go down that road, the third argument should probably be BYREF STRING...)


I don't think the System Search Wizard is available in InstallScript MSI projects. I couldn't find it.

Fixing the prototype (BYREF STRING) did the trick though. I should have seen that. Unfortunately, I had copied this prototype from someone else example. UGH!

Thanks for your very timely response. You are quick the workhorse around here. I can't count the number of times your previous responses have help me out.
0 Kudos
RobertDickau
Flexera Alumni

Thanks for the kind words, Mark!

If you do want to explore the other avenue, the System Search Wizard is available in Behavior and Logic > System Search.

Robert
0 Kudos
Mark_Koehler
Level 6

I stand corrected. I found System Search. My bad.
0 Kudos