cancel
Showing results for 
Search instead for 
Did you mean: 
Grimfort
Pilgrim

Large Property Values

I've got an issue in IS12 (http://community.installshield.com/showthread.php?t=185075), but wondered if anyone has dealt with large amounts of data in a property (20k, licence code, even > 500 chars will do!) using IS2009.

Will look into upgrading if anyone can prove it works. All I want to do it take a long string in the UI, about 16k-20k and write it out to an XML file at exec time. IS12 seems to be blocking me, maybe IS2009 allows this?
Labels (1)
0 Kudos
8 Replies
RobertDickau
Pilgrim

Re: Large Property Values

Assuming you're asking about InstallScript, I can verify that 500 characters works in InstallShield 2009: create a registry key HKCR\...MyKeyName with a string value LongValue with 1,000 characters. In the MSI project, create a system search that reads the value into a property PROP_WITH_LONG_VALUE. Create an InstallScript custom action---
[code]#include "ifx.h"

export prototype GetLongValue(HWND);

function GetLongValue(hInstall)
STRING sLongValue[2048];
NUMBER nBufferSize;
NUMBER nReturn;
begin

nBufferSize = 2049;

nReturn =
MsiGetProperty(hInstall, "PROP_WITH_LONG_VALUE", sLongValue, nBufferSize);

SprintfBox(INFORMATION,
"Long Property Value", "%d (%d) -> %s", nReturn, nBufferSize, sLongValue);

end;[/code]---and schedule it after the AppSearch action, and it seems to work...
0 Kudos
Grimfort
Pilgrim

Re: Large Property Values

Does the AppSearch happen in exec time, after UI?

Thanks for the research.
0 Kudos
RobertDickau
Pilgrim

Re: Large Property Values

You can look in the Sequences and Actions view to see when the AppSearch action runs: early in the UI sequence (for a full-UI installation) or Execute sequence (for a silent/reduced-UI installation).
0 Kudos
Grimfort
Pilgrim

Re: Large Property Values

Hmmm, thanks. Maybe I'll get a test copy or something, I could always get it to work in the UI section, its the exec section its not working in.

Many thanks!
0 Kudos
RobertDickau
Pilgrim

Re: Large Property Values

Where is the property set, and where in the Execute sequence are you getting the value?
0 Kudos
Grimfort
Pilgrim

Re: Large Property Values

The data is being picked up from an XML file (or copied into a textbox during the UI). I confirmed that all the data is there as I can see it in the textbox, and if I move between forms the data is kept. I have a CA to read the XML file, and in that script just to test it, I did Set and Gets and message boxed the results and the data was all there.

I was trying to put the output back into the XML file using the built in "XML File Changes" part of IS. This was just outputting a blank string. I believe this is done by ISXmlInstall. When this stopped working I attempted to do it manually believing it to be a problem with that part of the system. I added a CA which ran after WriteIniValues, in there was the Get property script very similar to what you have shown.

Every time I try and read that property I get the error as described above. If the data is short it works, so the mechanism is working fine. I just don't understand how (or why) it chops it off. To add, it always tells me I need 1024 extra returned from the Size parameter.

We are very close to release date so I have had to actually remove this screen from the installer and now the user has to load our software afterwards to enter their licensekey Smiley Sad. When I have the time we likely upgrade to 2009, and if this feature works I can add the screen back in.
0 Kudos
Cary_R
Pilgrim

Re: Large Property Values

Bumping this thread...

Robert, I note that you've set the buffer to 2049 in this example. Is there a particular reason for this?

(I ask because the script engine seems to crash when you try to MsiGetProperty a value that is 2050 characters long...)

RobertDickau wrote:
Assuming you're asking about InstallScript, I can verify that 500 characters works in InstallShield 2009: create a registry key HKCR\...MyKeyName with a string value LongValue with 1,000 characters. In the MSI project, create a system search that reads the value into a property PROP_WITH_LONG_VALUE. Create an InstallScript custom action---
[code]#include "ifx.h"

export prototype GetLongValue(HWND);

function GetLongValue(hInstall)
STRING sLongValue[2048];
NUMBER nBufferSize;
NUMBER nReturn;
begin

nBufferSize = 2049;

nReturn =
MsiGetProperty(hInstall, "PROP_WITH_LONG_VALUE", sLongValue, nBufferSize);

SprintfBox(INFORMATION,
"Long Property Value", "%d (%d) -> %s", nReturn, nBufferSize, sLongValue);

end;[/code]---and schedule it after the AppSearch action, and it seems to work...
0 Kudos
Cary_R
Pilgrim

Re: Large Property Values

In fact, I found that it fails catastrophically exactly at 2050 characters, which you can see yourself below:

[CODE]function MyFunction(hMSI)
STRING sBuffer[8000],sCount,sError;
number nSize, i, nResult;
begin
nSize = 4096;
for i = 1 to 4096
try
nSize = 4096;
nResult = MsiGetProperty(hMSI, "MYPROP", sBuffer, nSize);

if(StrLength(sBuffer) = 0) then
NumToStr(sCount,i);
MessageBox("Lost property value at char count: " + sCount,0);
else
//We don't make it to this point 2051 times, it quits on the next MsiGetProperty()
MsiSetProperty(hMSI,"MYPROP",sBuffer + "X");
endif;
catch
NumToStr(sError,Err.Number);
MessageBox("2050 char error: " + sError,0);
endcatch;
endfor;
end;[/CODE]

This is in IS2010 and 2012 (although I am told by a colleague of mine that it seems fine in IS2013 SP1). Known issue, with a known fix maybe?

Cary R wrote:
Bumping this thread...

Robert, I note that you've set the buffer to 2049 in this example. Is there a particular reason for this?

(I ask because the script engine seems to crash when you try to MsiGetProperty a value that is 2050 characters long...)
0 Kudos