Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inno Setup: Removing a problematic registry key left by another program

I'm writing an installer for my program in Inno Setup. My program uses web pages and Internet Explorer to interact with it.

Some of my queries take longer than 10 seconds, and I noticed on my friends computer that he had a registry key "RequestTimeout" for Internet Explorer that set a timeout of 10 seconds. This key is not naturally present on Internet Explorer, it is apparently added by a third party installer. But from what I read on the web quite a few people end up with it.

My question is, can I tell Inno Setup to delete or modify this key if it is present during setup?

I've googled and all the resources I could find about Inno Setup and Registry Keys have to do with uninstall options.

like image 339
Juicy Avatar asked Oct 25 '13 22:10

Juicy


3 Answers

Ignoring the points about whether you should delete a value that's not "yours", you can easily delete a registry value at install time by setting the type to none and add the deletevalue flag:

[Registry]
Root: HKLM; Subkey: "Software\My Company\My Program\Settings"; ValueName: "Value"; ValueType: none; Flags: deletevalue;

You can also add a Check: parameter and other conditional statements.

like image 103
Deanna Avatar answered Nov 03 '22 01:11

Deanna


For the completeness: Inno Setup is by default a 32 bit app. So, by default, it will delete the 32bits registry keys even on 64 bits architecture. For deleting 64 bit keys, you have to use the 64 bits constants (like Root: HKLM64 for HKey_Local_Machine).

More info here: Writing 32/64-bit specific registry key at the end of the installation

like image 26
Broken_Window Avatar answered Nov 03 '22 03:11

Broken_Window


In the inno setup help there are a few functions listed which you can use for that

function RegDeleteKeyIncludingSubkeys(const RootKey: Integer; const SubkeyName: String): Boolean;
function RegDeleteKeyIfEmpty(const RootKey: Integer; const SubkeyName: String): Boolean;
function RegDeleteValue(const RootKey: Integer; const SubKeyName, ValueName: String): Boolean;;

You can do this while the initializeWizard or the initializeSetup Mehod, there you can check the values and modify them. Also the comment on your question is correct.

like image 2
Al Phaba Avatar answered Nov 03 '22 03:11

Al Phaba