Flexera beginner

InstallShield 2015: How To Access Properties From InstallScript

I asked a similar question several weeks ago but did not try the suggested solution, which was to use MsiGetProperty, because I had found an alternative way to accomplish my task.  Now I must once again obtain the value stored in a Property from within an InstallScript and this time there is no workaround.  I tried MsiGetProperty and it does not work for me.  First, I'd like to make sure I am clear about what I mean by "Property" because there appear to be many types of Properties, MSI Installer properties, Installer properties, etc. 

For the InstallSuite wizard I defined a property to store what the user enters into a field.  So this is not an MSI pre-defined property, it is a property I created.  I don't know what the classification of such a Property is, or whether the distinction even matters.

I named it  ORBCAD_APP_SRV.  I have no problem passing this property from the Suite to subordinate packages that are run by the Suite, and using it for such things as a registry value, by simply enclosing it in brackets like this:  [ORBCAD_APP_SRV].  But I cannot reference this property in an InstallScript, I get a compile error. 

I literally copied and pasted an example of using MsiGetProperty into my InstallScript file and it did not work.  I suspect two possible causes:  (1)  The handle that you pass to MsiGetProperty:  Perhaps the one I am passing is not the right one, or (2)  MsiGetProperty is looking only at the tables in which MSI properties are defined and of course mine would not be there. 

The handle I pass to MsiGetPropety is as follows.  The InstallScript function from which I call the new function that calls MsiGetProperty is referenced from a CustomAction.  The type of that CustomAction is "InstallScript," and the function name is entered in the right pane in the custom action view.  The function declaration in the InstallScript file is as follows:

export prototype SetNicCardRegs(HWND);

HWND is the handle I pass from within that function when I call my new function that contains the GetMsiProperty call, which I in turn pass in the GetMsiProperty.

The behavior I get is this:  The first call to MsiGetProperty is supposed to return the size of the value of the property and return the result of ERROR_MORE_DATA.  You then call MsiGetProperty again to get the actual value.

In my case, MsiGetProperty does not return ERROR_MORE_DATA for the first call, it returns ERROR_SUCCESS; but returns an empty string for the value.  I believe that means it did not find the property name.  This could be because it is looking in the "wrong" table, or else that the handle I pass to it does not allow it to access the table in which my property is defined. 

Sorry for the lengthy question, but hopefully someone can see what I am doing wrong here. 








Labels (1)
0 Kudos
3 Replies

Hi @willhandley ,


Can you tell me below:


1) What kind of project you are using InstallScript MSI or Basic MSI with installscript custom action:

2) will it be possible to share the sample code and how you have sequenced in case of Basi msi project?

3) Is it possible to share the sample script and from which event (method name ) it is getting called in case of installscript? 

0 Kudos

Thanks for replying, I actually solved the problem yesterday but I was too tired by then to update this post.

This is an older InstallShield project that I inherited, not one I created and I'm not that familiar with it nor with InstallShield, for that matter.  I happened to notice that the InstallScript custom action that calls the InstallScript method and passes the HWND had "In-Script Execution" set as "Deferred Execution in System Context," and I remembered the guidance for MsiGetProperty saying something about most properties not being accessible to deferred actions.  It seems that this method needs to run with admin privileges and somehow that setting makes that happen.

The solution was to move the value of my Property to a system-defined Property named CustomActionData just before calling that script, and changing the method that calls MsiGetProperty to get the value from CustomActionData.

It worked.






0 Kudos
Frequent contributor

If it is a property created in the suite you need SuiteGetProperty

Check your help for details.



0 Kudos