-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
notepad++ 8.5.1 no icon when launching from the context menu (edit file) #13410
Comments
Indeed, I can reproduce it. @GurliGebis |
BTW, @AvenCores Could you provide the debug info via menu |
Notepad++ v8.5.1 (64-bit) |
@donho the code reads the current path of the dll, combine that with notepad++.exe |
@GurliGebis |
@donho okay, I'll try and see if I can reproduce it. |
@donho is the issue still present in TEST5? |
It works - Notepad++ has been launched and the file is opened in launched Notepad++.
Yes. As I said, I can reproduce in TEST5 (both x32 & x64), though they are not "clean" installation. |
@donho I can reproduce it myself. So there is something with the notepad++.exe that explorer doesn't like, when it is run like this. I have tried running it from a simple console program, and it does the same, so it is not related to this DLL (or to be more specific, it is not related to being run from within the DLL), but something about it being starting using CreateProcess. I'll see if I can figure out why CreateProcess doesn't want to let the icon show. |
@donho if I hardcode it like this:
It starts the normal notepad.exe, and it keeps its icon just fine. Any ideas? |
okay, it seems like it is related to it being spawned inside dllhost for some reason |
@donho do you have any ideas? |
@GurliGebis |
@donho is there a version where it works? |
All of them have been using CreateProcess for it - I have tried with ShellExecute, but that gives the same result. From what I can see, it only happens with the notepad++.exe binary, every other program I have tried with has it working just fine. |
@GurliGebis |
@GurliGebis |
@donho yes, that used the old IContextMenu stuff, which works completely different. Sure, no worries. |
How about |
@donho I have already tried that one, the result is the same (as mentioned above). |
We might need help from someone who knows a bit more about programming against the Windows UI than I do. |
How do you use it? Could you provide the code please?
Can you put MessageBox into const wstring EditWithNppExplorerCommandHandler::GetNppExecutableFullPath()
{
const wstring path = GetInstallationPath();
const wstring fileName = L"\\notepad++.exe";
const wstring fullFilePath = L"\"" + path + fileName + L"\""
MessageBoxW(NULL,fullFilePath.c__str() ...)
return fullFilePath ;
} |
This is how I tried with ShellExecuteEx:
That ignores which file is selected (just to test), but it still shows nothing. The full file path is: |
From what I can see from examples around the internet, we are executing it correctly. |
Just compared the info on the notepad++ process when open normally and using the extension - everything is the same, except the parent process is dllhost instead of explorer. I have to go for tonight. |
Just tried one more thing, and that makes it even more weird:
Added this to wWinMain and tested from a command prompt, if I run it with I'm out of ideas for now |
Could it be some kind of permission token that is different, since it is initiated from dllhost, compare to when it is initiated from explorer? |
IIRC |
I think maybe we should dig here. const wstring EditWithNppExplorerCommandHandler::GetNppExecutableFullPath()
{
return L"C:\\Program Files\\Notepad++\\notepad++.exe";
} Does it work for x64 binary? If both work, then I guess (I could be wrong very probably) that the function which returns a const string is optimized by the compiler, and for the reason of that I am not aware (race condition?) that |
@donho okay, I have made some progress. If I move notepad.exe into the Program Files folder, it doesn't work at all (I guess it tries to load some dll files directly from it's path, since it normally live in system32, which is rich with dll files). HOWEVER - and now it gets interresting - If I copy Notepad++.exe into C:\Windows\System32 and hardcode that path into the dll (and ignore it's errors about missing xml files), the icon WORKS!!!! So now the question is - why does it work in System32 and not in Program Files. My theory is that it is related to file system permissions - I'll keep digging - but now we are getting somewhere 😀 |
Okay, I can confirm it is a permission issue. If I run this:
And then change the permissions to be inherited on child items (since it only sets it on the folder), it works! So, now to figure out what the difference is between the default permissions and the ones we have on notepad.exe, so we can figure out what is missing. |
Okay, I got it figured out - now to fix it. |
@donho are you ready? Here we go..... When registering a sparse package, the directory it is located in gets the following ACL set: This causes the application to be unable to read the icon, when it is being loaded in the context of the context menu. I will create two pull requests - one for the NppShell project, that requires it to be inside a subfolder, and another one for this repo that updates the installer to install those files inside a subfolder called Now it all starts to makes sense. |
@donho first step is to merge this PR and then let me know - once that is done, I'll update the #13411 PR to point to that and have the files in the correct folder. PR in NppShell: notepad-plus-plus/nppShell#6 |
@donho I have updated the #13411 with the installer changes - it still points to the HEAD of NppShell, so I'll update that part after you have merged the PR mentioned above. To see the changes needed for the installer (I hope, since I cannot build that and test): https://github.com/notepad-plus-plus/notepad-plus-plus/compare/9d7b7b45089b1a3febc6bca5b24b69263696216f..91518508445a228d7bae3b570ae153dc8109fb85 |
@GurliGebis |
@donho I am sorry to hear that. |
BTW, have you tried what @ozone10 has suggested ? |
@ozone10 and @donho yes, we already have the msix tag in the notepad++.exe manifest 🙂 |
@donho I just tested notepad-plus-plus/nppShell#6, and it is working. |
@GurliGebis |
I'm away for the next hour 🙂 |
Fixed by notepad-plus-plus/nppShell@e4f9037 |
Hey there, just a quickie about the (not so monstrous) icon in the right click context menu for "Edit with Notepad++", posted an inf file for the Admin version. The line in question has: |
windows 11 last bild
npp.8.5.1.Installer.x64.exe
no icon when launching from the context menu (edit file)
![image](https://user-images.githubusercontent.com/64781822/227704077-75e7910b-0f23-4c84-a24d-39badcad2f3e.png)
but if you just run notepad++ as a normal application, the icon is displayed
![image](https://user-images.githubusercontent.com/64781822/227704114-73ca53c8-2f4e-4739-b2c5-4923f860cd5b.png)
The text was updated successfully, but these errors were encountered: