Wix: Write a registry Entry during uninstallation
Hi Guys,
I am using Wix to write my MSIs.
I need to update a registry entry while uninstalling my application, does anybody know how this could be done.
Thanks
Nixu [/align]
I am using Wix to write my MSIs.
I need to update a registry entry while uninstalling my application, does anybody know how this could be done.
Thanks
Nixu [/align]
0 Comments
[ + ] Show comments
Answers (18)
Please log in to answer
Posted by:
axsysbabu
15 years ago
Posted by:
anonymous_9363
15 years ago
Posted by:
AngelD
15 years ago
Posted by:
anonymous_9363
15 years ago
Posted by:
nixu
15 years ago
Posted by:
anonymous_9363
15 years ago
How much time would have been saved if you had stated the problem properly? Using Wix will make no difference whatsoever, since Wix is simply a technology to create MSIs.
You need a Custom Action to permission the key above which YOUR key needs to be created, calling out to SetACL, SubInACL or whatever your preferred permissioning tool is.
You need a Custom Action to permission the key above which YOUR key needs to be created, calling out to SetACL, SubInACL or whatever your preferred permissioning tool is.
Posted by:
nixu
15 years ago
Hi VBScab
I am Creating MSIs to install software, and these MSI are written using WIX, So YES i am using the right tool.
To set the required ACL, you need to have permissions first, and not all users have such permissions, or else you can impersonate an admin user but you need to supply his credentials.
Using wix's basic registry stuff i am able to write under the LocalMachine during installation, but I just got stuck in writing during uninstallation.
Any help??
Nixu
I am Creating MSIs to install software, and these MSI are written using WIX, So YES i am using the right tool.
To set the required ACL, you need to have permissions first, and not all users have such permissions, or else you can impersonate an admin user but you need to supply his credentials.
Using wix's basic registry stuff i am able to write under the LocalMachine during installation, but I just got stuck in writing during uninstallation.
Any help??
Nixu
Posted by:
AngelD
15 years ago
Posted by:
nixu
15 years ago
Posted by:
anonymous_9363
15 years ago
Posted by:
AngelD
15 years ago
Posted by:
jmcfadyen
15 years ago
[blockquote]
[/blockquote]
Information about registry keys and/or values to be installed is authored in the Registry table. This table is processed by WriteRegistryValues and RemoveRegistryValues standard actions which must be scheduled in the Execute sequence tables.
To remove registry keys and/or values during install users must use RemoveRegistry table. This table is processed by RemoveRegistryValues standard action which must be scheduled in the Execute sequence tables.
Here is the list of columns of the Registry table:
Column name
Description
Registry
Primary key of the record.
Root
The predefined root key for the registry value:
Key
The localizable key for the registry value.
Name
Localizable registry value name. Use Null value to write to the default registry key.
Value
Localized registry value. This field is formatted field.
Component_
External key into the Component table.
To remove registry key on install we need to add record to the RemoveRegistry table:
Column name
Description
RemoveRegistry
Primary key of the record.
Root
The predefined root key for the registry value:
Key
The localizable key for the registry value.
Name
The localizable registry value name. If registry key is to be deleted, this column must contain minus sign (-).
Component_
External key into the Component table.
[blockquote]
What we can do with the registry[/blockquote]
These are the options we have when we install/delete registry key or value:
In MSI, prefixes to the Name column and prefixes and suffixes to the Value column are used to indicate the action to be performed. In Wix, elements <Registry> and <RegistryValue> are used for that purpose.
[blockquote]
How it translates to WiX?[/blockquote]
To create/delete registry keys:
Registry table
RemoveRegistry table
Registry element's
attribute
Description
Name
Value
Name
+
Null
Action="createKey"
On install, the key will be created if it is absent.
-
Null
Action="removeKeyOnUninstall"
On uninstall, the key will be deleted, including all its values and subkeys.
*
Null
Action="createKeyAndRemoveKeyOnUninstall"
The key will be created on install and deleted on uninstall.
-
Action="removeKeyOnInstall"
On install, the key will be deleted if present.
Prefixes and suffixes of the value in the Value column of the Registry table determine type of data stored in the registry:
Value column
Registry element's
attribute
Description
#x
Type="binary"
Hexadecimal value stored as binary data (REG_BINARY).
#%
Type="expandable"
Expandable string (REG_EXPAND_SZ).
#
Type="integer"
Integer value (REG_DWORD).
Contains [~] anywhere
Type="multiString"
List of strings (REG_MULTI_SZ).
Starts with two or more # or does not contain [~]
Type="string"
String (REG_SZ).
[blockquote]
Examples[/blockquote]
<Registry Id="TestKey"
Root="HKLM"
Key="SOFTWARE\ACME Corp"
Action="createKeyAndRemoveKeyOnUninstall" />
<Registry Id="TestKey"
Root="HKLM"
Key="SOFTWARE\ACME Corp"
Action="removeKeyOnInstall" />
[blockquote]
If you only remove registry key and do not create new ones, make sure you schedule RemoveRegistryValues standard action in the Execute sequence table. For example:[/blockquote]
<InstallExecuteSequence>
<RemoveRegistryValues />
</InstallExecuteSequence>
Root="HKLM"
Key="SOFTWARE\ACME Corp"
Action="createKeyAndRemoveKeyOnUninstall">
<Registry Id="DefaultValue"
Action="write"
Type="integer"
Value="123" />
</Registry>
<Registry Id="TestKey"
Root="HKLM"
Key="SOFTWARE\ACME Corp"
Action="createKeyAndRemoveKeyOnUninstall">
<Registry Id="TestValue"
Name="TestValue"
Action="write"
Value="123"
Type="string" />
</Registry>
<Registry Id="TestKey"
Root="HKLM"
Key="SOFTWARE\ACME Corp"
Action="createKey">
<Registry Id="TestValue"
Name="TestValue"
Action="remove" />
</Registry>
<Registry Id="TestKey"
Root="HKLM"
Key="SOFTWARE\ACME Corp"
Action="createKeyAndRemoveKeyOnUninstall">
<Registry Id="TestValue"
Name="TestValue"
Type="multiString"
Action="append">
<RegistryValue>123</RegistryValue>
<RegistryValue>456</RegistryValue>
<RegistryValue>789</RegistryValue>
</Registry>
</Registry>
<Registry Id="TestKey"
Root="HKLM"
Key="SOFTWARE\ACME Corp"
Action="createKeyAndRemoveKeyOnUninstall">
<Registry Id="SubKey"
Key="SubKey"
Action="createKeyAndRemoveKeyOnUninstall" />
</Registry>[/align][/align]
[/blockquote]
Information about registry keys and/or values to be installed is authored in the Registry table. This table is processed by WriteRegistryValues and RemoveRegistryValues standard actions which must be scheduled in the Execute sequence tables.
To remove registry keys and/or values during install users must use RemoveRegistry table. This table is processed by RemoveRegistryValues standard action which must be scheduled in the Execute sequence tables.
Here is the list of columns of the Registry table:
Column name
Description
Registry
Primary key of the record.
Root
The predefined root key for the registry value:
- default (-1) - Depends on the type of installation:
- HKCU - for per-user installation.
- HKLM - for per-machine installation.
- HKCU - for per-user installation.
- msidbRegistryRootClassesRoot (0) - HKCR
- msidbRegistryRootCurrentUser (1) - HKCU
- msidbRegistryRootLocalMachine (2) - HKLM
- msidbRegistryRootUsers (3) - HKU
Key
The localizable key for the registry value.
Name
Localizable registry value name. Use Null value to write to the default registry key.
Value
Localized registry value. This field is formatted field.
Component_
External key into the Component table.
To remove registry key on install we need to add record to the RemoveRegistry table:
Column name
Description
RemoveRegistry
Primary key of the record.
Root
The predefined root key for the registry value:
- default (-1) - Depends on the type of installation:
- HKCU - for per-user installation.
- HKLM - for per-machine installation.
- HKCU - for per-user installation.
- msidbRegistryRootClassesRoot (0) - HKCR
- msidbRegistryRootCurrentUser (1) - HKCU
- msidbRegistryRootLocalMachine (2) - HKLM
- msidbRegistryRootUsers (3) - HKU
Key
The localizable key for the registry value.
Name
The localizable registry value name. If registry key is to be deleted, this column must contain minus sign (-).
Component_
External key into the Component table.
[blockquote]
What we can do with the registry[/blockquote]
These are the options we have when we install/delete registry key or value:
For registry keys:[/align]
Create the key on install.[/align]
Delete the key on uninstall.[/align]
Create the key on install and delete it on uninstall.[/align]
Delete the key on install.[/align]
For registry values:[/align]
Create a binary (REG_BINARY) value.[/align]
Create an integer (REG_DWORD) value.[/align]
Create a string (REG_SZ) value.[/align]
Create an expandable string (REG_EXPAND_SZ) value.[/align]
Create a Null terminated list of strings (REG_MULTI_SZ) value:[/align]
New string can override existing string.[/align]
New string can be appended to existing string.[/align]
New string can be prepended to existing string.[/align]
In MSI, prefixes to the Name column and prefixes and suffixes to the Value column are used to indicate the action to be performed. In Wix, elements <Registry> and <RegistryValue> are used for that purpose.
[blockquote]
How it translates to WiX?[/blockquote]
To create/delete registry keys:
Registry table
RemoveRegistry table
Registry element's
attribute
Description
Name
Value
Name
+
Null
Action="createKey"
On install, the key will be created if it is absent.
-
Null
Action="removeKeyOnUninstall"
On uninstall, the key will be deleted, including all its values and subkeys.
*
Null
Action="createKeyAndRemoveKeyOnUninstall"
The key will be created on install and deleted on uninstall.
-
Action="removeKeyOnInstall"
On install, the key will be deleted if present.
Prefixes and suffixes of the value in the Value column of the Registry table determine type of data stored in the registry:
Value column
Registry element's
attribute
Description
#x
Type="binary"
Hexadecimal value stored as binary data (REG_BINARY).
#%
Type="expandable"
Expandable string (REG_EXPAND_SZ).
#
Type="integer"
Integer value (REG_DWORD).
Contains [~] anywhere
Type="multiString"
List of strings (REG_MULTI_SZ).
Starts with two or more # or does not contain [~]
Type="string"
String (REG_SZ).
[blockquote]
Examples[/blockquote]
Create a registry key on install and remove it on uninstall:[/align]
<Registry Id="TestKey"
Root="HKLM"
Key="SOFTWARE\ACME Corp"
Action="createKeyAndRemoveKeyOnUninstall" />
Remove a registry key on install:[/align]
<Registry Id="TestKey"
Root="HKLM"
Key="SOFTWARE\ACME Corp"
Action="removeKeyOnInstall" />
[blockquote]
If you only remove registry key and do not create new ones, make sure you schedule RemoveRegistryValues standard action in the Execute sequence table. For example:[/blockquote]
<InstallExecuteSequence>
<RemoveRegistryValues />
</InstallExecuteSequence>
Create a registry key with default value:[/align]
Root="HKLM"
Key="SOFTWARE\ACME Corp"
Action="createKeyAndRemoveKeyOnUninstall">
<Registry Id="DefaultValue"
Action="write"
Type="integer"
Value="123" />
</Registry>
Create a registry key with the string value:[/align]
<Registry Id="TestKey"
Root="HKLM"
Key="SOFTWARE\ACME Corp"
Action="createKeyAndRemoveKeyOnUninstall">
<Registry Id="TestValue"
Name="TestValue"
Action="write"
Value="123"
Type="string" />
</Registry>
On install, remove existing value of the registry key:[/align]
<Registry Id="TestKey"
Root="HKLM"
Key="SOFTWARE\ACME Corp"
Action="createKey">
<Registry Id="TestValue"
Name="TestValue"
Action="remove" />
</Registry>
Create a multi-string value:[/align]
<Registry Id="TestKey"
Root="HKLM"
Key="SOFTWARE\ACME Corp"
Action="createKeyAndRemoveKeyOnUninstall">
<Registry Id="TestValue"
Name="TestValue"
Type="multiString"
Action="append">
<RegistryValue>123</RegistryValue>
<RegistryValue>456</RegistryValue>
<RegistryValue>789</RegistryValue>
</Registry>
</Registry>
Create a key with sub-key: [/align]
<Registry Id="TestKey"
Root="HKLM"
Key="SOFTWARE\ACME Corp"
Action="createKeyAndRemoveKeyOnUninstall">
<Registry Id="SubKey"
Key="SubKey"
Action="createKeyAndRemoveKeyOnUninstall" />
</Registry>[/align][/align]
Posted by:
jib
15 years ago
Posted by:
AngelD
15 years ago
Posted by:
anonymous_9363
15 years ago
Posted by:
AngelD
15 years ago
ORIGINAL: nixu
Hi Guys,
I am using Wix to write my MSIs.
I need to update a registry entry while uninstalling my application, does anybody know how this could be done.
Thanks
Nixu [/align]
Sorry but can't see how he can update (modify) a registry entry during uninstall with either the Registry nor RemoveRegistry table during uninstall if the OP didn't mean remove instead of update.
Posted by:
jmcfadyen
15 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.