You are here

Portableapps.com Launcher: RegistryValues?

9 posts / 0 new
Last post
dagardner
dagardner's picture
Offline
Last seen: 5 years 5 months ago
Developer
Joined: 2007-09-20 14:41
Portableapps.com Launcher: RegistryValues?

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

Jimbo
Offline
Last seen: 4 years 11 months ago
Joined: 2007-12-17 05:43
What exactly is the problem you're seeing?

It should be as simple as

[Activate]
Registry=true

[RegistryKeys]
torrent=HKCU\SOFTWARE\Classes\.torrent

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.

Mark Sikkema
Offline
Last seen: 13 years 3 months ago
Developer
Joined: 2009-07-20 14:55
What would be the purpose of

What would be the purpose of saving them ?
I do need see the need of saving them to a registry file Pardon

Any chance on a regshot or something similar ?

Formerly Gringoloco
Windows XP Pro sp3 x32

dagardner
dagardner's picture
Offline
Last seen: 5 years 5 months ago
Developer
Joined: 2007-09-20 14:41
Here is a partial Regshot

Here is a partial Regshot (only Keys added and Values added).

----------------------------------
Keys added:13
----------------------------------
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{73262004-8473-4672-8558-0AA4277E0287}_is1
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\LegalNotice
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\MainWindow
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\Preferences
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\Preferences\General
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\Search
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\TorrentProperties
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\TorrentProperties\Peers
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\TorrentProperties\Trackers
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\TransferListFilters
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent-resume

----------------------------------
Values added:74
----------------------------------
... trimmed irrelevant values ...
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\Classes\.torrent/Default: "qBittorrent"
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\Classes\.torrent/Content Type: "application/x-bittorrent"
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\Classes\qBittorrent/shell/Default: "open"
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\Classes\qBittorrent/shell/open/command/Default: ""C:\Program Files\qBittorrent\qbittorrent.exe" "%1""
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\Classes\qBittorrent/Content Type/Default: "application/x-bittorrent"
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\Classes\qBittorrent/DefaultIcon/Default: ""C:\Program Files\qBittorrent\qbittorrent.exe",0"
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\Classes\Magnet/Default: "Magnet URI"
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\Classes\Magnet/Content Type: "application/x-magnet"
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\Classes\Magnet/URL Protocol: ""
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\Classes\Magnet/DefaultIcon/Default: ""C:\Program Files\qBittorrent\qbittorrent.exe",0"
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\Classes\Magnet/shell/Default: "open"
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\Classes\Magnet/shell/open/command/Default: ""C:\Program Files\qBittorrent\qbittorrent.exe" "%1""
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\Preferences\General\Locale: "en_US"
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\Preferences\General\Style: "windowsxp"
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\TorrentProperties\Trackers\trackersColsWidth: '300 100 100 136'
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\TorrentProperties\Peers\peersColsWidth: '100 100 100 100 100 100 100 0'
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\TorrentProperties\Peers\PeerListSortedCol: "0d"
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\TransferListFilters\selectedFilterIndex: 0x00000000
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\TransferListFilters\customLabels: 00
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\TorrentProperties\Visible: "false"
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\TorrentProperties\filesColsWidth: '300 100 100 100'
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\TorrentProperties\SplitterSizes: "158,284"
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\Search\searchHistory: 00
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\MainWindow\IsMaximized: "false"
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\MainWindow\size: "@Size(914 563)"
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\MainWindow\pos: "@Point(51 75)"
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\MainWindow\vSplitterSizes: '119 769'
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\LegalNotice\Accepted: "true"
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\TransferListSortedCol: "0d"
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\TransferListColsWidth: "200 0 100 100 100 100 100 100 100 100 100 100 0 0 0 0"
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\TransferListVisualIndexes: '0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15'
HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\qBittorrent\qBittorrent\TransferListColsHoS: "1 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0"
HKU\S-1-5-21-861567501-308236825-839522115-1003_Classes\.torrent/Default: "qBittorrent"
HKU\S-1-5-21-861567501-308236825-839522115-1003_Classes\.torrent/Content Type: "application/x-bittorrent"
HKU\S-1-5-21-861567501-308236825-839522115-1003_Classes\qBittorrent/shell/Default: "open"
HKU\S-1-5-21-861567501-308236825-839522115-1003_Classes\qBittorrent/shell/open/command/Default: ""C:\Program Files\qBittorrent\qbittorrent.exe" "%1""
HKU\S-1-5-21-861567501-308236825-839522115-1003_Classes\qBittorrent/Content Type/Default: "application/x-bittorrent"
HKU\S-1-5-21-861567501-308236825-839522115-1003_Classes\qBittorrent/DefaultIcon/Default: ""C:\Program Files\qBittorrent\qbittorrent.exe",0"
HKU\S-1-5-21-861567501-308236825-839522115-1003_Classes\Magnet/Default: "Magnet URI"
HKU\S-1-5-21-861567501-308236825-839522115-1003_Classes\Magnet/Content Type: "application/x-magnet"
HKU\S-1-5-21-861567501-308236825-839522115-1003_Classes\Magnet/URL Protocol: ""
HKU\S-1-5-21-861567501-308236825-839522115-1003_Classes\Magnet/DefaultIcon/Default: ""C:\Program Files\qBittorrent\qbittorrent.exe",0"
HKU\S-1-5-21-861567501-308236825-839522115-1003_Classes\Magnet/shell/Default: "open"
HKU\S-1-5-21-861567501-308236825-839522115-1003_Classes\Magnet/shell/open/command/Default: ""C:\Program Files\qBittorrent\qbittorrent.exe" "%1""
HKU\S-1-5-18\Software\Microsoft\Windows\ShellNoRoam\MUICache\C:\Program Files\qBittorrent\qbittorrent.exe: "qbittorrent"

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:

HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\Classes\qBittorrent/shell/open/command/Default: ""C:\Program Files\qBittorrent\qbittorrent.exe" "%1""

and others like it.

Notice how the slashes change from "\" to "/" after qBittorrent. If I exported this, it would be like this:

[HKU\S-1-5-21-861567501-308236825-839522115-1003\Software\Classes]
"qBittorrent/shell/open/command/Default"=""C:\Program Files\qBittorrent\qbittorrent.exe" "%1""

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

Mark Sikkema
Offline
Last seen: 13 years 3 months ago
Developer
Joined: 2009-07-20 14:55
That's just very odd :?

You would need some custom-code !
If you'd do:

[RegistryValueBackupDelete]
1=.torrent/Default
2=etc.
...

...for all of the 12 odd values.

And then write a CustomCode, like:

${SegmentFile}

${SegmentPrePrimary}
${registry::Write} "HKCU\Software\Classes" ".torrent/Default" '"qBittorrent"' "REG_SZ" $R0 ; return value 0 = success
${registry::Write} "HKCU\Software\Classes" ".torrent/Content Type" '"application/x-bittorrent"' "REG_SZ" $R0 ; return value 0 = success
etc...
!macroend

...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

dagardner
dagardner's picture
Offline
Last seen: 5 years 5 months ago
Developer
Joined: 2007-09-20 14:41
Yeah...

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.

Mark Sikkema
Offline
Last seen: 13 years 3 months ago
Developer
Joined: 2009-07-20 14:55
Ah, [RegistryValueWrite] , I

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:

[RegistryValueWrite]
HKCU\Software\Classes\qBittorrent/shell/open/command/Default=REG_SZ:"%PAL:AppDir%\qBittorrent\qbittorrent.exe" "%1"

[edit: Changed PAL:AppDir to %PAL:AppDir%]

Formerly Gringoloco
Windows XP Pro sp3 x32

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 6 months ago
Joined: 2007-04-15 21:08
Shouldn't

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

dagardner
dagardner's picture
Offline
Last seen: 5 years 5 months ago
Developer
Joined: 2007-09-20 14:41
Hmm...

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!

Log in or register to post comments