PDA

View Full Version : MSI Properties problem



JDeighton
04-10-2002, 07:03 AM
I'm having a great deal of trouble setting and then using some custom Properties in my installations. I've got some InstallScript that calculates values that need to be written to a product's INI file, but I can't seem to get the content of the string variables from the InstallScript into the MSI Properties.

I'm using MsiSetProperty to create and populate the desired Properties, and I've then used the Properties in the "INI File Changes" pane of the InstallShield Developer IDE. The problem is that while the INI entries are created, the values from the assigned Properties are nulls.

I've used some debug code to try to get to the bottom of the problem, for example:

if (MsiSetProperty(ISMSI_HANDLE, "MAINSETTING", sMainSetting) = ERROR_SUCCESS) then
MessageBox("MsiSetProperty Success", INFORMATION);
MessageBox(sMainSetting, INFORMATION);
MsiGetProperty(ISMSI_HANDLE, "MAINSETTING", sTest, nBuffer);
MessageBox(sTest, INFORMATION);
endif;

MsiSetProperty reports success, sMainSetting appears correct, but the contents of the MAINSETTING Property seems to be nothing at all...

Anyone have any ideas about this? Is there something I've managed to miss in several hours of trawling the help files and this forum?

Thanks,
J Deighton

RobertDickau
04-10-2002, 02:37 PM
When you're calling MsiGetProperty in your debugging code, you'll need to initialize the size buffer variable (nBuffer, in your example) using, say,

nBuffer=256;
Please see the Developer help page "Get or Set a Property".

JDeighton
04-15-2002, 08:05 AM
Okay,
I got my debug code working (thanks Robert); I am now sure that I'm successfully "setting and getting" MSI Properties. What I'm not able to do, however, is get the WriteIniValues action to take the Properties I've set and use them in my applications' INI file.

I've checked the following:
-Public Properties, e.g. MAINSETTING, are being created and values assigned to them by the InstallScipt code.
-IniFile table contains valid entries for each row, adding the public Properties as Values. Properties are correctly denoted as [PROPERTYNAME].
-The InstallScript function assigning the values to the Properties is called before the WriteIniValues action.

What I'm getting is an INI file that contains the INI entries the installer should be making, but the script-created/defined Properties don't appear - all I get is e.g.

[Primary]
MainSetting=

I tried defining the public Properties in the Direct Editor before attempting to assign values to them; I gave them a dummy value of "Test". If I do this, the INI entries produced by the installer read like this...

[Primary]
MainSetting=Test

... i.e. they are apparently never changed, even though MsiGetProperty reports back that they have.

I cannot figure out how to get these Properties set correctly so that their values end up in my applications' INI file. Any more help would be greatly appreciated - the deadline for beginning the migration of my old IS Pro 5.1 projects is Friday!

Thanks again...
J Deighton