You are here

Registry: key value in shared key

4 posts / 0 new
Last post
DatLicht
Offline
Last seen: 2 years 4 months ago
Joined: 2015-04-21 07:39
Registry: key value in shared key

I have a to-portabilize software which creates an autorun entry in

HKCU\Software\Microsoft\Windows\CurrentVersion\Run\

here an extract of my launcher.ini:

[Launch]
[...]

[Activate]
Registry=true

[RegistryKeys]
[...]
mysoftware15=HKCU\Software\Microsoft\Windows\CurrentVersion\Run\MySoftware
[...]

Of course, I cannot take the whole \Run key because it's a shared key. Unfortunately, it doesn't get recognized by the launcher. If I understand the documentation right, with

[RegistryValueWrite]

, I explicitely need to declare a value (which I do not want).

Any ideas?

John T. Haller
John T. Haller's picture
Offline
Last seen: 1 hour 25 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
RegistryValueBackupDelete

We use RegistryValueBackupDelete since this is a value and not a key, and we don't need to preserve the portable version's entry. Here's a real-world example from Free Download Manager Portable:

[RegistryValueBackupDelete]
1="HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\Free Download Manager"

Sometimes, the impossible can become possible, if you're awesome!

DatLicht
Offline
Last seen: 2 years 4 months ago
Joined: 2015-04-21 07:39
okay, but ...

Thanks so far, this will help me in this case, but leaves this general question open:

As the value will be deleted on exit when set by the portable app, how can such a value be preserved? I could imagine that it would be relevant if using different products from one manufacturer that uses the same key. Surely this isn't a good coding style, but is absolutely not that rare, especially on commercial products when one license includes another product (or vice versa).

[RegistryKeys]

could not be used here as changing the whole key would cause side effects.

[RegistryValueBackupDelete]

also cannot be used in this case as the set value would be deleted after closing the app.

[RegistryValueWrite]

also could not be used as I would have to declare an explicit value which isn't always clear before.

Is there a way to preserve a single value?

depp.jones
Offline
Last seen: 22 hours 48 min ago
DeveloperTranslator
Joined: 2010-06-05 17:19
I think [RegistryKeys] is the

I think [RegistryKeys] is the way to do it. It backs up the existing key, replaces it with the one form the portable app during runtime and restores the original after closing it (and backs up the one form the portable app). Mixing the existing key with the one from the portable app would most likely mess things up - either breaking portability or destroying the existing values. Think of storing a shared license value. This could be overwritten by the portable app with result that the host machine's license could be replaced by the portable app's one. How would you distinguish the values during runtime?
I consider this the limit of portablizing an app. If you could give a real world example, maybe another solution could be possible. If it could not be achived by the launcher out of the box, there is still the possibility to use custom code.

Log in or register to post comments