5
votes

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.

3
Removing an entry that doesn't belong to you could break other things on the system. You should leave them alone if they're not yours.Ken White
I agree with what @Ken said. At least would be fair to make a page asking the user what they want to do with that optional key (e.g. only if it's value will be set to a low value). Anyway, what is that key ? I found only information about ReceiveTimeout, nothing about RequestTimeout.TLama
Would you like to have a page where would you tell the user about a short connection timeout and the risks to your application with some options to modify (or delete) this registry value ? (this page could be displayed only if this registry value will be found and will have a low value). Or do you rather want to delete this value without any option ? Users may have this value set manually for some reason, so if I were you I would rather choose an options page. Some people could take a direct deletion as malicious behavior. What would you prefer ?TLama
I agree with the comments, but this post on SO: stackoverflow.com/questions/2625650/… explains what I'm talking about. This key is actually a residue of other installers that don't bother to clean up behind themselves. TLama proposed the ideal solution though, I would like to give them the choice, although I'm pretty sure the target audience of my app will not have the slightest clue what a reg key is.Juicy
I was thinking about a page like this, but maybe it's much detailed. I don't know how to design such page. It's unfair to modify it (or delete) without any option and it's unfair to your application. And it's also quite hard to explain to the user. This page would be shown just when the registry value would be found and would have value, let's say 10 seconds. First option (they could be exchanged) would keep the settings, second would delete the key and the third would allow to enter custom value (that's quite hazard).TLama

3 Answers

10
votes

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.

3
votes

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

2
votes

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.