notepad-plus-plus / notepad-plus-plus

Notepad++ official repository
https://notepad-plus-plus.org/
Other
21.87k stars 4.45k forks source link

after installing 8.5.1 on Windows 11 system, it needs to restart Explorer to make "Edit with Notepad++" appears #13399

Closed FanXiangTM closed 1 year ago

FanXiangTM commented 1 year ago

On Windows 11 system, after installing 8.5.1, the context menu disappeared

the problem was solved after restarting Explorer

xroberx commented 1 year ago

On my system, the context menu entry also disappeared. I use the well-known StartAllBack that allows me to use the classic context menu, and with the previous version (8.5), the menu entry was duplicated, and now with this version (8.5.1) the menu entry is gone. If I switch off the option to use the classic context menu in StartAllBack, I can see the menu entry, but I don't want to use the new context menu because it is ugly and non functional. All other applications except for Notepad++ are there in the classic context menu. Please consider adding an option to restore the 8.4.9 behaviour for those of us that do not want to use the new context menu.

madareklaw commented 1 year ago

Restarting Windows explorer via Task manager fixed this issue for me

AvenCores commented 1 year ago

I had the same problem, the problem was solved after restarting Explorer

chip33 commented 1 year ago

I use the "classic" context menu on windows 11. The 'edit with notepad++' context menu shows only in the new context menu. Many users feel the same as me and use the old style menu. Please give a choice on installation to override this setting.

donho commented 1 year ago

It's OS behaviour. Restarting Windows or Restarting Windows explorer via Task manager will fix it.

chip33 commented 1 year ago

@GurliGebis @donho The new nppShell is reading the OS CurrentBuildNumber

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion] "CurrentBuildNumber"="22624"

and installing the new Sparse Package if the build number corresponds to Windows 11. This leaves win 11 users who use the classic context menu with no Notepad++ context menu entry at all. Please could we include an option on installation to choose the legacy ContextMenu that is still installed for Windows 10 users in 8.5.1? This approach is used by WinRar as a way of enabling users to chose between the Sparse Package for the modern context menu or the legacy if they are using the classic context menu in Win 11. Thanks.

GurliGebis commented 1 year ago

@chip33 there is a bug that causes the 32bit installer to not work on Windows 11, which will be fixed in the next release. With the sparse package solution, it shows up in both menus, but it is not working for 32bit at the moment.

xroberx commented 1 year ago

@chip33 there is a bug that causes the 32bit installer to not work on Windows 11, which will be fixed in the next release. With the sparse package solution, it shows up in both menus, but it is not working for 32bit at the moment.

I am not sure if we are talking about the same thing, but the classic context menu issue on Windows 11 also happens with the x64 version.

GurliGebis commented 1 year ago

@xroberx I think the smartest is to test once we get the final changes merged, since the version 8.5.1 is based upon has some issues.

GurliGebis commented 1 year ago

@xroberx you might also just need to restart explorer, since a bit of code is missing to reload it

donho commented 1 year ago

I don't think there's a bug regarding the installation of context menu. But rather a bug/OS default for showing context menu. An issue has been created here: https://github.com/notepad-plus-plus/nppShell/issues/2

GurliGebis commented 1 year ago

Yep. @donho did you have time to look at my PR in this repo?

FadeMind commented 1 year ago

It's OS behaviour. Restarting Windows or Restarting Windows explorer via Task manager will fix it.

Nope, reboot do nothing with that.

20230331-1680240023

Entry HKEY_CLASSES_ROOT\CLSID\{B298D29A-A6ED-11DE-BA8C-A68E55D89593} does not exists anymore in 8.5.1 release. Context menu UWP is handled only via separated UWP package: 20230331-1680240236

REPRODUCTION ISSUE

Remove current Notepad++ from system, reboot. Install new fresh 8.5.1 release with Context Menu ON, Results:


WinMerge have UWP and legacy menu handlers. Works flawlessy. 20230331-1680240637 20230331-1680240623

Also even in Modern Menu Mode Notepad++ menu option is available in Modern Menu, not legacy.

GurliGebis commented 1 year ago

Is it a clean, unmodified Windows 11 installation? Because the normal behavior on Windows 11 is for the menu item to show up in both the new and the old menu.

Can you try installing it in the Windows Sandbox (feature in Windows, might need to be enabled) and see if it works there?

FadeMind commented 1 year ago

Is it a clean, unmodified Windows 11 installation? Because the normal behavior on Windows 11 is for the menu item to show up in both the new and the old menu.

@GurliGebis latest build Windows 11 Pro 22H2 22621.1485. Notepad++ 8.4.9 provides legacy entry in menu.

20230401-1680337153 20230401-1680337103

Notepad++ 8.5.1 provides MODERN UWP entry in menu, missed Notepad++ entry in legacy menu.

20230401-1680337500

20230401-1680337511

Legacy menu entry is usefull in Total Commander for example.

FadeMind commented 1 year ago

Legacy menu handler registry keys

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\CLSID\{B298D29A-A6ED-11DE-BA8C-A68E55D89593}]
@="ANotepad++64"

[HKEY_CLASSES_ROOT\CLSID\{B298D29A-A6ED-11DE-BA8C-A68E55D89593}\InprocServer32]
@="C:\\Program Files\\Notepad++\\NppShell_06.dll"
"ThreadingModel"="Apartment"

[HKEY_CLASSES_ROOT\CLSID\{B298D29A-A6ED-11DE-BA8C-A68E55D89593}\Settings]
"Title"="Edit with &Notepad++"
"Path"="C:\\Program Files\\Notepad++\\notepad++.exe"
"Custom"=""
"ShowIcon"=dword:00000001
"Dynamic"=dword:00000001
"Maxtext"=dword:00000019
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\ANotepad++64]
@="{B298D29A-A6ED-11DE-BA8C-A68E55D89593}"
GurliGebis commented 1 year ago

@FadeMind my guess is that TC doesn't use the new context menu, so it registers it differently. That is why I'm suggesting trying in the sandbox, to see if it works in there. (Since if it does, it seems like something else that is installed is causing problems)

FadeMind commented 1 year ago

@GurliGebis Issue is that installer 8.5.1 does not register ContextMenuHandlers\ANotepad++64 and CLSID\{B298D29A-A6ED-11DE-BA8C-A68E55D89593} keys.

FadeMind commented 1 year ago

@GurliGebis in the sandbox clean install seems works, but in native OS not.

GurliGebis commented 1 year ago

@FadeMind on Windows 11, the ContextMenuHandlers is not the way to do it. Just registering the sparse package (which gives the new menu) also gives the old menu, so you shouldn't register it the old way.

Since it works in the sandbox, it seems like there is either of two things wrong.

  1. Some settings are changed, that prevents entries added to the modern menu from showing in the old menu.
  2. Something other program is installed that causes issues.

The sandbox uses the system files from your existing installation, so clearly the needed files are there. Are you using any kind of software that changes the shell? (like a classical start menu or something along those lines)

FadeMind commented 1 year ago

@GurliGebis OK. For some reasons ContextMenuHandlers\ANotepad++64 and CLSID\{B298D29A-A6ED-11DE-BA8C-A68E55D89593} are not set via NEW 8.5.1 installer. 20230401-1680341084

20230401-1680341172

In sandbox was set, in native not. I don't using tweak software against compatible issues

In 8.4.9 handler was here for legacy. 20230401-1680340141

GurliGebis commented 1 year ago

@FadeMind I have sent a suggestion to @donho with some changes for the installer, once he has looked at them, hopefully we can get a new installer we can use to test.

FadeMind commented 1 year ago

@GurliGebis I revert to 8.4.9 version for now. In future I can test fixed installer.

donho commented 1 year ago

I have sent a suggestion to @donho with some changes for the installer, once he has looked at them, hopefully we can get a new installer we can use to test.

@GurliGebis Which suggestion?

@FadeMind v8.5.2 RC is here now: https://community.notepad-plus-plus.org/topic/24328/notepad-v8-5-2-release-candidate

Could you test it ?

FadeMind commented 1 year ago

@donho

So. no changes.

Even for NEW fresh account local Menu Item for Legacy Menu does not show up. Only UWP Modern.

Tried: Install override current version Notepad++ and clean install.

For me usefull is now 8.4.9 release with legacy menu (needed in TC).

GurliGebis commented 1 year ago

@donho those have been integrated by you a while ago 😃 Since it works in the sandbox (which is a copy of his system, just clean of other programs and default settings) it is something installed or some settings causing it to not show up.

GurliGebis commented 1 year ago

Also, we cannot register the old context menu on Windows 11, since it causes double entries in the old menu for everyone else that has the one from the package. @donho Since it is working in the sandbox, something else is breaking it, so I don't think we can do much about that (since we register things correctly in the OS)

FadeMind commented 1 year ago

@GurliGebis Well, WinRAR or WinMerge handle it. Notepad++ not. Sandbox is not good enviroment for testing. I have another device with Windows 11 CLEAN - no tweaks too. Without any extra apps. Notepad++ also does not provides legacy menu in newer versions. Legacy 8.4.9 works. IMHO Installer should provides OLD legacy version menu handler AND Windows 11 handler alongside. Did you test "double entires", or this is "in theory"? :>

GurliGebis commented 1 year ago

@FadeMind the sandbox is a copy of the existing machine with default settings and no apps. Yes, I tested on my machine with both the sparse package and the registry settings, that gives the normal modern entry and double entries in the classic menu.

The ISO you tested with, is that directly from Microsoft, or downloader from some where else?

GurliGebis commented 1 year ago

I don't know about winrar, since it is closed source, but Winmerge uses the legacy IContextMenu interface, while we have switched to the "new" IExplorerCommand interface (new in quote, since it is from the Windows Vista/7 days)

GurliGebis commented 1 year ago

Once I get home later I'll re-test with the newest Windows 11 ISO from Microsoft and report back

GurliGebis commented 1 year ago

@FadeMind Here is a video of a clean install using the latest Windows 11 ESD from Microsoft (http://dl.delivery.mp.microsoft.com/filestreamingservice/files/6b90885c-6e27-459f-b4ad-e717bcdaf7fc/22621.525.220925-0207.ni_release_svc_refresh_CLIENTBUSINESS_VOL_x64FRE_en-us.esd)

Video: https://www.youtube.com/watch?v=_SfLUGKEETw

So it is working on a completely clean install - so my question is - if a clean install using the ISO you have doesn't work, what changes has been made to it? (Since a clean install using the official ESD from Microsoft works just fine).

If you want to test using the ESD above, you can use this to convert it from an ESD to an ISO: https://github.com/abbodi1406/WHD/raw/master/scripts/esd-decrypter-wimlib-63.7z

FadeMind commented 1 year ago

@GurliGebis 20230403-1680524595

I using Polish language here.

I don't have idea what and where block it using legacy Notepad++ menu. I know only one thing: 8.4.9 works with old DLL. 8.5.1/8.5.2 RC does not.

donho commented 1 year ago

@ArkadiuszMichalski In case that your Windows 11 is Polish version, could you test v8.5.2 RC to check if Notepad++ context menu is installed on both Windows11 Modern context menu and classic legacy menu (accessible via "Show more options")?

GurliGebis commented 1 year ago

The language shouldn't have anything to do with it, since it is just an MUI on top of Windows. @donho which language of Windows are you using? (Just in case it is the same on all non-english)

donho commented 1 year ago

@GurliGebis I don't think so either, but we never know. My Windows 11 is English one and it works on both menu.

FadeMind commented 1 year ago

@donho @GurliGebis I will try in virtual environment fresh ISO with Polish lang.

GurliGebis commented 1 year ago

@donho okay @FadeMind okay, thanks.

I just tested the danish version of Windows, and that seems to be working fine, so I don't think it is related to Windows being non-english.

donho commented 1 year ago

@GurliGebis Maybe it's related? https://github.com/notepad-plus-plus/nppShell/issues/18

FadeMind commented 1 year ago

@donho I removed Winmerge. Reboot. Install fresh. Aaaand Menu items were gone. Seems to windows self have issues after latest updates blob. In VM on older images and in Sandbox seems to be fine, BUT after removing packages - freak out and registry keys gone.

GurliGebis commented 1 year ago

@FadeMind This is pretty strange @donho I don't think so

FadeMind commented 1 year ago

OK. So this is UPSTREAM. Even with latest RC WinMerge in legacy menu items gone. Notepad++ also. In VM fresh older build Windows 11 properly register shell extensions, in preview builds - nope.

GurliGebis commented 1 year ago

Okay, that is what I'm thinking as well, which annoys me, since it is impossible to work around. It seems clear that Microsoft is moving the classic context menu into the background (the be fair, they have said it is only a fallback, until people gets stuff ported over)

GurliGebis commented 1 year ago

@donho I got an idea. We could add an extra installer option as a workaround, that registers the old way on Windows 11. Should be simple to add using a rundll32 function. It is ugly as hell, but it would allow people to force the old registration on Windows 11, if needed.

ArkadiuszMichalski commented 1 year ago

@donho I test this on VM because on real system I bring back old things (like task bar and context menu).

After install Notepad++:

Notepad++ v8.5.2   (64-bit)
Build time : Apr  2 2023 - 20:05:21
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line : 
Admin mode : OFF
Local Conf mode : OFF
Cloud Config : OFF
OS Name : Windows 11 Enterprise (64-bit)
OS Version : 21H2
OS Build : 22000.795
Current ANSI codepage : 1250
Plugins : 
    mimeTools (2.9)
    NppConverter (4.5)
    NppExport (0.4)

Open context menu in empty space on pulpit: image

Open on some text file does the entry in new context menu but not in old: image

Personally, I do not use the installation version, so I do not know exactly what to check here. But if you need anything more, let me know.

It would be nice if Notepad++ in some day had a separate tab in Settings for adding/removing context menu entries like ConEmu does. This could even work for any portable versions, and if we wanted to remove them, we could quickly remove their entries from the registry through this window. But I don't know how it relates to this new context menu because I turned it off completely. image

FadeMind commented 1 year ago

@ArkadiuszMichalski dziękuję, właśnie ocaliłeś 48 godzin z mojego życia w kwestii reinstalacji Windowsa od zera i konfigurowania go do stanu użyteczności. Jaką masz wersję (dokładny build). Pozdrawiam

FadeMind commented 1 year ago

@donho @GurliGebis WinMerge in default integrate Modern UWP Menu in Windows 11 ONLY. But they are separated standalone menu for MANAGE IT. And for legacy menu you have to Click on proper option. Sooo, it is not exactly upstream. It is an issue implementation NEW DLL from Notepad++.

20230403-1680541572

After applying changes: 20230403-1680541908 20230403-1680541885

Maybe Devs from WinMerge can help you?

GurliGebis commented 1 year ago

Looking at the Winmerge code, it doesn't look too different than this. I might be able to build a test dll later this week

chip33 commented 1 year ago

Looking at the Winmerge code, it doesn't look too different than this. I might be able to build a test dll later this week

@GurliGebis There is also some code and discussion on PowerToys where they went through a similar thing with their context menus.

https://github.com/microsoft/PowerToys/search?q=tier+1&type=issues

GurliGebis commented 1 year ago

@FadeMind if you have a test machine, and are willing to test this, I have a new DLL you can try - it is test signed with my test certificate, so you need to install that first - it is included.

  1. Download and unzip this somewhere: https://www.dropbox.com/s/oo7ji0m9fsze81u/NppShellRewrite.zip?dl=0
  2. Install the certificate into the "Trusted Root Certification Authorities" store (this is why you need a test machine - you shouldn't install certificates random people give you into there on production machines).
  3. Unregister the current DLL by running the following command inside the contextMenu folder: regsvr32 /u NppShell.dll
  4. Replace the NppShell.dll in there with the one in the zip file above.
  5. Register the new DLL by running this command inside the contextMenu folder: `regsvr32 NppShell.dll"

Then try and see if the element is showing in the classic context menu.

It works on my machine, but it also worked before, so the only thing I can say is that it hasn't made it any worse.

If anyone else is having the issue, and has a test machine to test on (PLEASE don't use your production machine for this), go ahead.