RobertvanderHulst
Posts: 22
Joined: Wed Mar 04, 2009 4:09 pm

When Importing REG file GUID Strings are corrupted

I am using AI 7.1.3
When I import a REG file with the following contents

Code: Select all

REGEDIT4

[HKEY_LOCAL_MACHINE\Software\Foo]
"Package"="{e8d067dd-5a12-4d49-9ab1-7d7d429c293b}"
Then the "Package" string gets corrupted. AI shows:

Code: Select all

[\{]e8d067dd-5a12-4d49-9ab1-7d7d429c293b[\}]
When I run the installer the result in the registry seems to be fine. What is the reason the string gets changed ?

Robert
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: When Importing REG file GUID Strings are corrupted

Hi,

This happens because of the way Windows Installer treats formated type values. For example: [\x] is replaced by the character x; in your case, to include a left and right brace ({}), you can use

Code: Select all

 [\{] [\}]
Here are more details about Windows Installer Formatted type.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
RobertvanderHulst
Posts: 22
Joined: Wed Mar 04, 2009 4:09 pm

Re: When Importing REG file GUID Strings are corrupted

Bogdan wrote:Hi,

This happens because of the way Windows Installer treats formated type values. For example: [\x] is replaced by the character x; in your case, to include a left and right brace ({}), you can use

Code: Select all

 [\{] [\}]
Here are more details about Windows Installer Formatted type.

Regards,
Bogdan
Ok I understand that. I can also understand that you need to use [\[] to include a left square bracket.
But why are the curly braces ({ and }) placed inside square brackets? Do they have a special meaning ?
I can't see any special meaning in the reference page you included.
If I remove the brackets it works without problems

Robert
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: When Importing REG file GUID Strings are corrupted

Hi,
But why are the curly braces ({ and }) placed inside square brackets? Do they have a special meaning ?
Yes, the braces are reserved characters and must be escaped. You can read more about this here.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
RobertvanderHulst
Posts: 22
Joined: Wed Mar 04, 2009 4:09 pm

Re: When Importing REG file GUID Strings are corrupted

Bogdan wrote:Hi,
But why are the curly braces ({ and }) placed inside square brackets? Do they have a special meaning ?
Yes, the braces are reserved characters and must be escaped. You can read more about this here.

Regards,
Bogdan
The relevant section says:

Code: Select all

If a substring is enclosed in curly braces ({ }), and it contains no property names enclosed in square brackets ([ ]), the substring is left unchanged, including the curly braces.
If a substring is enclosed in curly braces ({ }) and it contains one or more property names enclosed in square brackets ([ ]) then, if all the property names are valid, the text (with the resolved substitutions) is displayed without the curly braces.
So you would only have to put curly braces in brackets if there are brackets between them...

Robert

Return to “Common Problems”