Creating a custom option in Windows 11 mini context menu

On my previous W11, I disabled the mini menu, or dynamic menu or W11 menu, immersive context menu, I’ve seen it named a dozen different things with no consistency coming from Microsoft.

At work, I’ve left it enabled without much hassle. I really wanted to keep it enabled at home but 7zip options being relegated to the legacy menu really caused me some irritation. I decided this can’t be too complex to make your own menu entries, boy was I wrong.

Basically this is somewhat related to the Microsoft Store and Windows Appx, I’m just an IT guy, not a developer, but not many seem to be embracing the store so I’m not surprised to see adoption of these options being limited.

I didn’t want to pay for anything so I skipped the store app people recommended. There was another way, but it’s a bit of a hack. You can utilize a reserved appid to intercept the command and run yours own command. I have a rotating wallpaper, so I don’t need “Set as Wallpaper”, we’re going to use that.

Next, I needed to determine how my most frequent option to extract the archive to a folder with the archive name (same as the built-in zip extraction does, if you really like 7z, you could also attempt to bypass that function instead and the icon won’t really change, I may tinker with that later.)

I started looking through the registry and found that all the right click context menu options are using a dll file to make their command calls, I’m not so sure I can get that linked, I get the impression I’m limited to a single command line call, I doubt I can chain a dll off this. I’ll leave that as an exercise for the reader.

Procmon was the next step, ran a cap and then extracted a 7z using the function I wanted, I found on the process path this command:

"C:\Program Files\7-Zip\7zG.exe" x -o"I:\test\zipfilename\" -spe -an -ai#7zMap7134:116:7zEvent12024

I ran it a second time and got a different portion after the hash mark, I suspect this is something the dll uses. I searched a bit and found an answer: https://sourceforge.net/p/sevenzip/discussion/45797/thread/8fbdb3a210/

It seems to simply be a memory mapping to a filename, this explains why there is no 7z file in the command. -an and -ai I could not get to work, it is probably related to me sending an actual file handle and not a memory mapped file. spe eliminates making a pointless root folder, if someone makes a zip called “ziptest.zip” and inside is “ziptest” folder, it smartly eliminates that root folder.

I ended up having this .reg file to modify the registry, the setdesktopwallpaper entries were not in my registry in these locations, so the removal part wasn’t necessary for me, but others were using them, I also removed the Directory one as I don’t need this option visible on directories, as I cannot extract them anyway.

Windows Registry Editor Version 5.00

[-HKEY_CURRENT_USER\SOFTWARE\Classes\*\shell\SetDesktopWallpaper]
[-HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\shell\SetDesktopWallpaper]

[HKEY_CURRENT_USER\SOFTWARE\Classes\*\shell\SetDesktopWallpaper]
"MUIVerb"="Extract 7z to folder"
[HKEY_CURRENT_USER\SOFTWARE\Classes\*\shell\SetDesktopWallpaper\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x -o.\\* -spe \"%1\""

The set as background image next to it cannot be removed, that’s why I’m thinking my next task might be to just replace the Extract All option, though some people had problems replacing certain functions. Someone tried to replace “Open in New Window” but it started launching the software in some taskbar icons, so you have to be careful about what is linked to that function, in some cases the original function remains. Connect mapped drive was another one, more details about the hack method of replacing specific entries with your own apps here:
https://github.com/microsoft/vscode/issues/127365#issuecomment-1022715602

Leave a comment

Design a site like this with WordPress.com
Get started