blog: browse 7Z/RAR/ISO in xplorer2 and other file managers

Discussion & Support for xplorer² professional

Moderators: fgagnon, nikos, Site Mods

Kilmatead
Platinum Member
Platinum Member
Posts: 4573
Joined: 2008 Sep 30, 06:52
Location: Dublin

Re: blog: browse 7Z/RAR/ISO in xplorer2 and other file manag

Post by Kilmatead »

Seems to be something endemic to Win8 and its inability to decide what kind of machine it's on (and the users not setting it themselves). Like I said above, I just tried a standard stock install in a Win"10" machine, and it didn't blink at all, so Win8.2 appears to "fix it" anyway. :shrug:

Edit: Actually, I'm wrong on that. Win"10" doesn't work properly either, in more ways than one. :evil:
Last edited by Kilmatead on 2015 May 04, 19:57, edited 1 time in total.
wasker
Gold Member
Gold Member
Posts: 799
Joined: 2005 Oct 21, 16:33
Location: WA, USA
Contact:

Re: blog: browse 7Z/RAR/ISO in xplorer2 and other file manag

Post by wasker »

Restart doesn't "fix" the problem.
I'm using Xplorer2 - the only file manager that does not suck. Actually, it rocks!
User avatar
nikos
Site Admin
Site Admin
Posts: 15771
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

Re: blog: browse 7Z/RAR/ISO in xplorer2 and other file manag

Post by nikos »

I bet you know about object registration.
See if there is an entry for HKCR\SevenZipFolder and if the various extensions you want e.g. 7z have their default value pointing to this SevenZipFolder type
Kilmatead
Platinum Member
Platinum Member
Posts: 4573
Joined: 2008 Sep 30, 06:52
Location: Dublin

Re: blog: browse 7Z/RAR/ISO in xplorer2 and other file manag

Post by Kilmatead »

No, Nikos, this is not user-error; Win8+ extension registration seems to be fubar. It looks like they did the same to that that Vista did to column handlers - while it "looks" the same, it simply does not behave as you would expect from Win7 and below (in the name of "security", so programmes can't easily reroute associations by themselves without user cooperation).

It works best if there were never any associations on the system in the first place, but once they start accruing (WinRAR, WinZIP, etc) you have to waste a lot of time using the properties context menu to forcefully switch - even restarts just ignore the registry (which is insane).
User avatar
FrizzleFry
Platinum Member
Platinum Member
Posts: 1241
Joined: 2005 Oct 16, 19:09

Re: blog: browse 7Z/RAR/ISO in xplorer2 and other file manag

Post by FrizzleFry »

Windows 8 requires that programs integrate with the Set Default Programs control panel... then you can use set default programs to choose defaults for this program...

this looks useful but looking at this I'm not sure because it says "Default Programs provides a set of APIs (deprecated in Windows 8 )"

I got SevenZipFolders to show up in default programs (as ExplorerFrame) by manually creating registry keys but it was not really operational... I could not uncheck extensions that were already associated with SevenZipFolders... I think a call to SHChangeNotify is needed...

Why does SevenZipFolders show as ExplorerFrame in the open with dialog?
Kilmatead
Platinum Member
Platinum Member
Posts: 4573
Joined: 2008 Sep 30, 06:52
Location: Dublin

Re: blog: browse 7Z/RAR/ISO in xplorer2 and other file manag

Post by Kilmatead »

I added the SHChangeNotify call a couple of days ago and it works fine, but Win8+ just doesn't like anyone doing this "the registry-way" any more (works perfectly and instantly in Win7) - so the extra step of obligating the user to reorientate via that popup is going to be necessary for Win8+. :shrug:

Strangely, this all works fine if there aren't any existing associations on the system (if the user never installed WinRAR or WinZip, etc) for archive-types - but (as you discovered) when trying to "un-associate" something, or change something that already exists, Win8+ gets very cranky (SHChangeNotify has no impact on this). Forcing the issue (using the right-click properties menu) is a solution for "de-association".

Explorerframe is the generic name used for interfacing with WinExplorer (i.e., the shell). If it doesn't show up in the menu, navigating the menu directly to explorer.exe is the same thing. Not sure if a shell-extension by itself can inject its name into this list, as the list itself is designed for desktop programmes, and shell extensions are not something you call directly, per se.

On the plus side, most of these extensions are pretty arcane and user's aren't likely to be turning the associations on and off very often (you either decide you like what it does or you don't), and any archivers used are always in the context menu anyway for direct access.
User avatar
FrizzleFry
Platinum Member
Platinum Member
Posts: 1241
Joined: 2005 Oct 16, 19:09

Re: blog: browse 7Z/RAR/ISO in xplorer2 and other file manag

Post by FrizzleFry »

after creating the registry entries below, SevenZipFolder appears in the Default Programs list and lets you select extensions to handle... it does not let you uncheck extensions but that seems normal... I can't get it to show the icon in the program list for some reason...

after you register the program you should be able to set associations for a program by calling IApplicationAssociationRegistrationUI::LaunchAdvancedAssociationUI which should show a dialog similar to what default programs shows

Code: Select all

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications]
"SevenZipFolder"="Software\\SevenZipFolder\\Capabilities"

[HKEY_LOCAL_MACHINE\SOFTWARE\SevenZipFolder]
"Path64"="C:\\tools\\7zNSE\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\SevenZipFolder\Capabilities]
"ApplicationDescription"="browse archives supported by 7zip like ZipFolders"
"ApplicationName"="SevenZipFolder"
"ApplicationIcon"="C:\\tools\\7zNSE\\SevenZipFolder.dll,0"

[HKEY_LOCAL_MACHINE\SOFTWARE\SevenZipFolder\Capabilities\FileAssociations]
".7z"="SevenZipFolder"
".arj"="SevenZipFolder"
".dmg"="SevenZipFolder"
".gz"="SevenZipFolder"
".gzip"="SevenZipFolder"
".hfs"="SevenZipFolder"
".iso"="SevenZipFolder"
".lha"="SevenZipFolder"
".lzh"="SevenZipFolder"
".lzma"="SevenZipFolder"
".rar"="SevenZipFolder"
".swm"="SevenZipFolder"
".tar"="SevenZipFolder"
".taz"="SevenZipFolder"
".tbz"="SevenZipFolder"
".tbz2"="SevenZipFolder"
".tgz"="SevenZipFolder"
".tpz"="SevenZipFolder"
".txz"="SevenZipFolder"
".wim"="SevenZipFolder"
".xar"="SevenZipFolder"
".z"="SevenZipFolder"

[HKEY_LOCAL_MACHINE\SOFTWARE\SevenZipFolder\DefaultIcon]
@="C:\\tools\\7zNSE\\SevenZipFolder.dll,0"

I cobbled together the following C# code to launch the set associations for a program dialog for SevenZipFolder... I got it from here... don't ask me about the ClassInterface stuff... that came straight from ApplicationAssoicationRegistrationUI.cs

Code: Select all

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    [ClassInterface(ClassInterfaceType.None)]
    [ComImport]
    [Guid("1968106d-f3b5-44cf-890e-116fcb9ecef1")]
    [TypeLibType(TypeLibTypeFlags.FCanCreate)]
    internal sealed class ApplicationAssociationRegistrationUI : IApplicationAssociationRegistrationUI
    {
        [MethodImpl(MethodImplOptions.InternalCall)]
        public extern void LaunchAdvancedAssociationUI(string appRegistryName);
    }

    [CoClass(typeof(ApplicationAssociationRegistrationUI))]
    [ComImport]
    [Guid("1f76a169-f994-40ac-8fc8-0959e8874710")]
    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    [TypeLibImportClass(typeof(ApplicationAssociationRegistrationUI))]
    internal interface IApplicationAssociationRegistrationUI
    {
        void LaunchAdvancedAssociationUI([MarshalAs(UnmanagedType.LPWStr)] string appRegistryName);
    }

    static class Program
    {
        static void Main(string[] args)
        {
            var assocUI = new ApplicationAssociationRegistrationUI();
            try
            {
                assocUI.LaunchAdvancedAssociationUI("SevenZipFolder");
            }
            catch
            {
                // Exceptions here typically mean the ProgID is not registered correctly. 
            }
            finally
            {
                Marshal.ReleaseComObject(assocUI);
            }
        }
    }
}

Apparently this has changed in Windows 10 though... you wont get the set defaults dialog but some pop-up message...
Kilmatead
Platinum Member
Platinum Member
Posts: 4573
Joined: 2008 Sep 30, 06:52
Location: Dublin

Re: blog: browse 7Z/RAR/ISO in xplorer2 and other file manag

Post by Kilmatead »

FrizzleFry wrote:Apparently this has changed in Windows 10 though... you wont get the set defaults dialog but some pop-up message...
Actually, that's not true (trust MSDN to get their own docs wrong again) - despite it saying:
Starting in Windows 10 Insider Preview, this does not launch the association dialog box. It displays a dialog to the user informing them that they can change the default programs used to open file extensions in their Settings
Actually invoking ApplicationAssociationRegistrationUI seems to bring up the appropriate association checkbox settings dialog, not a simple information message...

Image

Who needs C# .NET flotsam when you can just call ApplicationAssociationRegistrationUI via COM directly and do it in 6 lines instead of 50:

Code: Select all

Local Const $CLSID_AARUI = "{1968106d-f3b5-44cf-890e-116fcb9ecef1}"
Local Const $IID_IAARUI = "{1f76a169-f994-40ac-8fc8-0959e8874710}"
Local Const $sTagIAARUI = "LaunchAdvancedAssociationUI hresult(wstr)"

Local $oApplicationAssociationRegistrationUI = ObjCreateInterface($CLSID_AARUI, $IID_IAARUI, $sTagIAARUI)
$oApplicationAssociationRegistrationUI.LaunchAdvancedAssociationUI("SevenZipFolder")
It's going to take a little while, but I think I can adapt the Config.exe to handle Win7, 8, and 10. More or less. :D

I never should have volunteered for this shite - I'd get a lot more sleep.
User avatar
FrizzleFry
Platinum Member
Platinum Member
Posts: 1241
Joined: 2005 Oct 16, 19:09

Re: blog: browse 7Z/RAR/ISO in xplorer2 and other file manag

Post by FrizzleFry »

Good to know that it brings up the association dialog on Windows 10 also... of course that could change in the real version :roll:

There are some registry values that are not needed... I put them in trying to solve the missing icon problem... but they did not help...
"Path64"="C:\\tools\\7zNSE\\"
"ApplicationIcon"="C:\\tools\\7zNSE\\SevenZipFolder.dll,0"

[HKEY_LOCAL_MACHINE\SOFTWARE\SevenZipFolder\DefaultIcon]
@="C:\\tools\\7zNSE\\SevenZipFolder.dll,0"

also the program registration entries can go in HKCU instead of HKLM, supposedly, just make sure you point the RegisteredApplications key to the right place...
Kilmatead
Platinum Member
Platinum Member
Posts: 4573
Joined: 2008 Sep 30, 06:52
Location: Dublin

Re: blog: browse 7Z/RAR/ISO in xplorer2 and other file manag

Post by Kilmatead »

Yeah, I noticed those - I couldn't get the icon to work either (though to be fair I didn't try too hard) - I also noticed that HKLM\Software is one of those 64-redirection keys, so it needs to be targeted specifically when written to programmatically, whereas others did not (I lost half-an hour trying to figure out what I did wrong before I found it).

I'm thinking that originally Win10 did neuter ApplicationAssociationRegistrationUI, but probably got a lot of complaints from people who were using it in just this way (that's what they get for allowing Win8 to fester so long in the wild) and changed it back to preserve behavioural continuity. At least I hope that's the case.

Thank god for VM's you can wreak havoc upon, and then reset in a heartbeat. Simplifies experimentation no end!

Thanks for the info - it's strange that some of this stuff seems to have existed since Vista, but never really caught on (though to be fair, some things don't seem to do anything in Win7 at all anyway).
User avatar
nikos
Site Admin
Site Admin
Posts: 15771
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

Re: blog: browse 7Z/RAR/ISO in xplorer2 and other file manag

Post by nikos »

good detective work frizzlefry! once you know what to search for there's lots of information
of course all these are meant for applications and not for DLLs but if it works...
Kilmatead
Platinum Member
Platinum Member
Posts: 4573
Joined: 2008 Sep 30, 06:52
Location: Dublin

Re: blog: browse 7Z/RAR/ISO in xplorer2 and other file manag

Post by Kilmatead »

It feels weird not being able to "uncheck" things (once checked, it can only be undone by another programme), but as Frizzle says, it seems to be designed that way - you don't "unassociate" things anymore, you just let something else take them over or abandon them.

Like you say, there are some strange side-effects from this being a DLL and not a "real" application, as we're "half" associating with explorer itself, it doesn't seem to be geared for that specifically, but nor is it rejecting it wholesale. :shrug:
User avatar
FrizzleFry
Platinum Member
Platinum Member
Posts: 1241
Joined: 2005 Oct 16, 19:09

Re: blog: browse 7Z/RAR/ISO in xplorer2 and other file manag

Post by FrizzleFry »

It's telling that the Windows ZipFolder dll is not listed in default programs.

Another advantage to registering SevenZipFolder with default programs is that SZF now appears, as ExplorerFrame, in the open with dialog of unassigned extensions registered to SZF.
User avatar
nikos
Site Admin
Site Admin
Posts: 15771
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

Re: blog: browse 7Z/RAR/ISO in xplorer2 and other file manag

Post by nikos »

i will try setting the AppUserModelID of sevenzipfolder to Microsoft.Windows.Explorer. That's what zipfolders do and then all the other associations are not required. Probably the name will be fixed too!
Kilmatead
Platinum Member
Platinum Member
Posts: 4573
Joined: 2008 Sep 30, 06:52
Location: Dublin

Re: blog: browse 7Z/RAR/ISO in xplorer2 and other file manag

Post by Kilmatead »

nikos wrote:...and then all the other associations are not required.
Are we allowed to place bets against you succeeding? Or would that be too honest and disrespectful at the same time? Considering you've been doing outdoor plumbing all day while the rest of us have actually created a working solution to a problem you couldn't even reproduce at first, my Sceptical-O-Meter is bobbing off the charts.

However, if it means I can go to bed early tonight, knock yourself out. We'll wipe your humility off the white cliffs in the morning and just carry on as if the Pope never excommunicated your Orthodox - umm, "rim". :twisted:

If you succeed, perhaps you could remind us if Virgil’s Aeneid had a happy ending or not?
Post Reply