When writing to a registry key during an install, a unc path directly after a file:// literal is not properly expanded.
To properly enable our .chm file (in the to $TARGETDIR$\help directory) to be opened from a network location because of a MS security change http://support.microsoft.com/kb/896054 we are writing a registry key during our install that looks like this:
key:SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictionsvalue: UrlAllowList
data: $TARGETDIR$\help;file://$TARGETDIR$\help
This works fine if we install to a mapped drive location like M:\product, but if we install to a UNC share location like \\shared location\product, then the second part of the data after the semi-colon (file://$TARGETDIR$\help) doesn't get expanded correctly - the "\\" seems to be interpreted as a special character and only the first "\" character is written so for instance the key is written like this:
\\shared location\product\Help;file://\shared location\product\Help
...when it should be written like this:
\\shared location\product\Help;file://\\shared location\product\Help
Variable in registry key not properly expanding
-
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: Variable in registry key not properly expanding
Dear User,
try with adding an additional "\" (slash) to your UNC share location.
I just tried the following with the "Wite Registry" command and it seems to work fine.
\\shared location\product\Help;file://\\\shared location\product\Help
Hope this helps you.
Regards
try with adding an additional "\" (slash) to your UNC share location.
I just tried the following with the "Wite Registry" command and it seems to work fine.
\\shared location\product\Help;file://\\\shared location\product\Help
Hope this helps you.
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Re: Variable in registry key not properly expanding
No, that won't work because if the user doesn't install to a UNC location but rather to a mapped drive like M:\product then there is an extra "\" in the path that is written to the registry. If it was possible, I guess that I could add code to the script to see if the first character of $TARGETDIR$ was a "\" (can you do substrings in script code, I don't see any easy way to do that?) and then prefix that value to the resulting string, but I shouldn't have to do that should I? There seems to pretty clearly be a bug in how the expansion of the $TARGETDIR$ special value.
-
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: Variable in registry key not properly expanding
Honestly, I suppose it could be probably done using the "Extract Path" command.
This command manipulates a path string to extract the requested drive, folder, file name, or file extension information, OR it replaces double occurences of a backslash character with a single occurence.
... in this way I suppose you could check if the user has selected an UNC location or a system drive.
Regards
This command manipulates a path string to extract the requested drive, folder, file name, or file extension information, OR it replaces double occurences of a backslash character with a single occurence.
... in this way I suppose you could check if the user has selected an UNC location or a system drive.
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Re: Variable in registry key not properly expanding
This simply does not work if a variable is involved no mater how it is defined - it does not matter how many "\" are specified, the Write Registry key always strips it to a single \ character.
None of these work (they all write out a single '\' character):
Write Registry Key HKLM\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions\\UrlAllowList, $TARGETDIR$\help;file://$TARGETDIR$\help
Write Registry Key HKLM\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions\\UrlAllowList, $TARGETDIR$\help;file://\$TARGETDIR$\help
Write Registry Key HKLM\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions\\UrlAllowList, $TARGETDIR$\help;file://\\\$TARGETDIR$\help
Write Registry Key HKLM\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions\\UrlAllowList, $TARGETDIR$\help;file://\\\\$TARGETDIR$\help
Write Registry Key HKLM\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions\\UrlAllowList, $TARGETDIR$\help;file:///\\\$TARGETDIR$\help
...etc.
...setting it to a temporary variable also does not work:
Set Variable KEYVALUE to $TARGETDIR$\help;file://$TARGETDIR$\help
Write Registry Key HKLM\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions\\UrlAllowList, $KEYVALUE$
Specifying a constant value works fine:
Write Registry Key HKLM\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions\\UrlAllowList, \\shared location\product\Help;file://\\shared location\product\Help
...no need to add an extra '\' character, etc.
Right now it appears there is simply no way to write out the value that I need to write out, will you please have a developer investigate - possibly some way to specify a hex character like #92; or &92 or [char]92 or...???
None of these work (they all write out a single '\' character):
Write Registry Key HKLM\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions\\UrlAllowList, $TARGETDIR$\help;file://$TARGETDIR$\help
Write Registry Key HKLM\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions\\UrlAllowList, $TARGETDIR$\help;file://\$TARGETDIR$\help
Write Registry Key HKLM\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions\\UrlAllowList, $TARGETDIR$\help;file://\\\$TARGETDIR$\help
Write Registry Key HKLM\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions\\UrlAllowList, $TARGETDIR$\help;file://\\\\$TARGETDIR$\help
Write Registry Key HKLM\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions\\UrlAllowList, $TARGETDIR$\help;file:///\\\$TARGETDIR$\help
...etc.
...setting it to a temporary variable also does not work:
Set Variable KEYVALUE to $TARGETDIR$\help;file://$TARGETDIR$\help
Write Registry Key HKLM\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions\\UrlAllowList, $KEYVALUE$
Specifying a constant value works fine:
Write Registry Key HKLM\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions\\UrlAllowList, \\shared location\product\Help;file://\\shared location\product\Help
...no need to add an extra '\' character, etc.
Right now it appears there is simply no way to write out the value that I need to write out, will you please have a developer investigate - possibly some way to specify a hex character like #92; or &92 or [char]92 or...???
-
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: Variable in registry key not properly expanding
Dear User,
Did you try the following?
I just created a blank project from scratch using the above code and it works fine.
The stored value registry is exactly as you expect it has to be;
\\shared location\product\Help;file://\\shared location\product\Help
NOTE! I used NATIVE_ENGINE mode (Set Variable NATIVE_ENGINE to TRUE) to execute the Write Registry command immediately (... purple commands are deferred to Apply Install execution otherwise).
The same code snippet in IA Clippboard format;
Hope this helps you.
Regards
Did you try the following?
Code: Select all
Set Variable NATIVE_ENGINE to TRUE
Set Variable MYVAR to \\shared location\product\Help
Write Registry Key HKLM\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictionsMY\UrlAllowList, $MYVAR$;file://\$MYVAR$
I just created a blank project from scratch using the above code and it works fine.
The stored value registry is exactly as you expect it has to be;
\\shared location\product\Help;file://\\shared location\product\Help
NOTE! I used NATIVE_ENGINE mode (Set Variable NATIVE_ENGINE to TRUE) to execute the Write Registry command immediately (... purple commands are deferred to Apply Install execution otherwise).
The same code snippet in IA Clippboard format;
Code: Select all
~InstallAware Clipboard Data~
~Write Registry~
~{298E30BB-E26F-4F34-AC9D-A42D8575D232}~
~0~
~2|~
~SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictionsMY~
~UrlAllowList~
~$MYVAR$;file://\$MYVAR$~
~TRUE~
~FALSE~
~Comment~
~{1DE1C427-8A49-4783-BECA-E7A6E789D1CF}~
~~
~Set Variable~
~{15A932F6-A1FF-4C8C-90CB-9EDBB24C7C84}~
~MYVAR$MYAH$MYAH$FALSE~
~\\shared location\product\Help~
~Set Variable~
~{A3B2D90D-7317-4158-BD5F-4F2DD91133CC}~
~NATIVE_ENGINE$MYAH$MYAH$FALSE~
~TRUE~
Hope this helps you.
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Re: Variable in registry key not properly expanding
Yes, that does work for me, thank you, to handle both cases (UNC and mapped drives) in case anyone else runs into this I had to do this:
I would have thought that NATIVE_ENGINE would be the default, but I guess that there are reasons why not? I went through the forums and didn't really see anything that would prevent me from doing this for other projects as well (it seems much faster) so I will look into it further. I really shouldn't have to condition the code to add the additional '\' to the key that I am writing, but that could simply be a registry issue - regardless, thank you again for all of your help!
Code: Select all
Parse String $TARGETDIR$ into Variables CHMDIR1 and (Split at position from start)
if Variable CHMDIR1 Equals \
Write Registry Key HKLM\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions\\UrlAllowList, $TARGETDIR$\help;file://\$TARGETDIR$\help
else
Write Registry Key HKLM\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions\\UrlAllowList, $TARGETDIR$\help;file://$TARGETDIR$\help
end
Code: Select all
~InstallAware Clipboard Data~
~End~
~{7318BDA1-7597-4F97-8232-7157F60B13C7}~
~Write Registry~
~{34BE391D-F462-403B-BFA0-ECA0707588A7}~
~0~
~2~
~SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions\~
~UrlAllowList~
~$TARGETDIR$\help;file://$TARGETDIR$\help~
~TRUE~
~FALSE~
~Else~
~{2315A606-3451-4E22-9777-97F34BCEAA5A}~
~Set Variable~
~{273A49CA-5C11-4D94-B861-5B87A48C7060}~
~NATIVE_ENGINE$MYAH$MYAH$FALSE~
~FALSE~
~Write Registry~
~{85188B6A-EA5B-4F48-8678-2977099F838B}~
~0~
~2~
~SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions\~
~UrlAllowList~
~$TARGETDIR$\help;file://\$TARGETDIR$\help~
~TRUE~
~FALSE~
~If~
~{FBCDB015-B026-49CD-8A87-F700DE8E7401}~
~CHMDIR1~
~0~
~\\~
~FALSE~
~Parse String~
~{21CBA81A-AC49-41AD-83DE-7AE2B8D6A146}~
~$TARGETDIR$~
~2~
~CHMDIR1~
~~
~2~
~FALSE~
~FALSE~
I would have thought that NATIVE_ENGINE would be the default, but I guess that there are reasons why not? I went through the forums and didn't really see anything that would prevent me from doing this for other projects as well (it seems much faster) so I will look into it further. I really shouldn't have to condition the code to add the additional '\' to the key that I am writing, but that could simply be a registry issue - regardless, thank you again for all of your help!
-
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: Variable in registry key not properly expanding
Dear User,
By default the Windows Installer Engine is the one enabled, because currently it is the most used and requested mode. The native engine is not intended to duplicate the Windows Installer engine. Instead, it is designed to provide a faster, non-transactional alternative to the Windows Installer engine.
Happy that you solved!
Regards
I would have thought that NATIVE_ENGINE would be the default, but I guess that there are reasons why not?
By default the Windows Installer Engine is the one enabled, because currently it is the most used and requested mode. The native engine is not intended to duplicate the Windows Installer engine. Instead, it is designed to provide a faster, non-transactional alternative to the Windows Installer engine.
Happy that you solved!
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Who is online
Users browsing this forum: No registered users and 113 guests