I'm working on qBittorrent Portable, and run into a bit of a problem with registry values.
There are a number of registry values that qBittorrent uses for associating .torrent and Magnet files with qBittorrent, but these values aren't written as I would typically expect. For instance it writes to: HKCU\Software\Classes\.torrent/Default where the key is HKCU\Software\Classes value name is .torrent/Default. I've submitted a bug report, and I hope that they will fix it in the future, but I would like to get a workaround in the mean time.
The [RegistryValueBackupDelete] section in the launcher ini will delete the appropriate registry values, but I would like to be able to save them to restore the next time the portable app is run. I don't see how to do this without saving the entire HKCU\Software\Classes key, which would save a lot of information not related to qBittorrent.
Is there a way to make registry values portable similar to how [RegistryKeys] works?
Thank you,
Andy
It should be as simple as
A value name is only ever the final part of the registry key. So in the example you are citing, HKCU\SOFTWARE\Classes\.torrent is the key, and Default is the value. And yes, the naming scheme is non-intuitive, since you would expect the "value" to be the path of the exe, but in fact that is the data, and value is the name of the entry.
Edit: but I don't believe that it is a bug in the app - the default value is a bit of a special case, and is more like the data associated with the value-that-is-the-key, which means that it is OK to treat the key as a value in that context, and it will be inferred that it actually means the default value in the key given.
For the launcher, just treat it as a key again, and it should work fine.
What would be the purpose of saving them ?
I do need see the need of saving them to a registry file
Any chance on a regshot or something similar ?
Formerly Gringoloco
Windows XP Pro sp3 x32
Here is a partial Regshot (only Keys added and Values added).
You can see under keys added that the root key added was HKCU\Software\qBittorrent, which I have been able to save and restore with no problems.
However, if you look at the Values added, you will see:
and others like it.
Notice how the slashes change from "\" to "/" after qBittorrent. If I exported this, it would be like this:
Where "qBittorrent/shell/open/command/Default" is the name of a value under the Classes key. This is not standard use of the registry, and I believe that there is an error in the qBittorrent code where those slashes are getting switched. I have submitted that bug to qBittorrent, but I would like to get a work around for the time being.
If I just delete these values, the user will be asked at each launch whether they want to associate with .torrent and Magnet file types.
Let me know if more clarification is needed.
Thank you,
Andy
You would need some custom-code !
If you'd do:
...for all of the 12 odd values.
And then write a CustomCode, like:
...for again all of the 12 values.
Note that I haven't tested this and probably you have to play with the code a bit, but I can't see why it shouldn't work !
good luck
Formerly Gringoloco
Windows XP Pro sp3 x32
That is kind of the conclusion I came to, but instead of the custom code, I was going to try adding them to a [RegistryValueWrite] section. I still won't be able to save, but that shouldn't be an issue since they are referring to the AppDir.
Ah, [RegistryValueWrite] , I forgot all about that !
Are you telling me these file associations actually work ?
If they do somehow you could write the value like:
[edit: Changed PAL:AppDir to %PAL:AppDir%]
Formerly Gringoloco
Windows XP Pro sp3 x32
The file associations definitely shouldn't work!
That is a weird bug. I think it probably indicates that someone didn't know what they were doing properly. But surely if it created them once then it'll create them again so the RegistryValueWrites won't be needed..?
I am a Christian and a developer and moderator here.
“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1
I hadn't thought of that. I never tested whether or not the file associations actually worked. I guess what I need to do is write the mangled registry so that qBittorrent doesn't ask about association and try writing the correct registry to get the association to actually works.
Testing! Yay!