PDA

View Full Version : REGDBDELETEVALUE issue



raj@123
01-11-2010, 12:08 AM
I am facing the below issue related to the REGDBDELETEVALUE function. For me this issue occurs under the below scenario:
While Installation:
1. Create the registry key thru REGDBDREATEKEY let say "testkey".
2. Create a value inside that key thru REGDBSETKEYVALUEEX let say "testvalue".
3. Installation has been finished now.
4. Now manually create a registry value let say "testvaluemanually" inside the same key "testkey".
5. While Uninstallation, i am calling the REGDBDELETEVALUE function inside the ONMAINTUIAFTER event for "testvalue". But this time it is deleting the complete "testkey" key. So, "testvaluemanually" is also getting removed.
Expectation: Only the "testvalue" should be removed. "testvaluemanually" should be retained.
PLease help if some one knows the resolution.

raj@123
01-11-2010, 04:58 AM
Got the answer from the InstallShield Help.
If the key you are creating with RegDBCreateKeyEx already exists and you have not disabled logging, the key—which other applications use—will be logged for uninstallation. During an uninstallation, the key will be uninstalled, causing problems for those applications that use the key. To avoid this problem, test for the existence of the key using RegDBKeyExist before creating it. If the key already exists, use RegDBCreateKeyEx to create a subkey unique to your application. Then, when uninstallation takes place, only the subkey will be deleted. If you do not wish to test for the existence of the key first, you can use the Disable function to disable logging while you create the key. Enable logging after the key is created. Remember, however, that the key will not be uninstalled with your application.