2
How do I move an item above the separator line in the New submenu of Windows 10's right-click context menu?
Is there anything in the Registry that needs to be set?
2
How do I move an item above the separator line in the New submenu of Windows 10's right-click context menu?
Is there anything in the Registry that needs to be set?
2
Create a Config
subkey under the ShellNew
key of your file type. Then inside that subkey, add a string value named BeforeSeparator
. The change should take effect immediately:
To figure this out, I had to dive into the Explorer code. shell32.dll
contains a CNewMenu
class that represents the New menu and has a function named _BeforeSeparator
that determines whether the given entry should be placed before the separator. Here's the important part of that function's disassembly (courtesy of IDA):
First it uses PathMatchSpecW
to see if the key name is one of .lnk
, .library-ms
, or Folder
. If it is (red/left path), the item is guaranteed to appear above the line. If not (green/right path), the function checks whether a certain bit (10h
) in a certain part (+8
) of the data structure is set.
I needed to find the code responsible for setting that bit. There's a function called _GetNewObjectInfoForKey
that seems to be responsible for setting up the relevant data structures. Here's part of its disassembly, almost right at the beginning:
It tries to open a subkey called Config
and, if successful (red path), uses the _GetConfigFlags
function to set the part of the data structure containing the bit we're interested in! _GetConfigFlags
goes along testing for the existence of various entries and setting various bits if appropriate. Here's the part that sets our target bit (10h
):
And there we see the desired entry name: BeforeSeparator
.
1+1 for the assembly. Context menu registry changes can be applied with Explorer restart (without rebooting). – Biswapriyo – 2018-11-23T03:01:11.923