-
Notifications
You must be signed in to change notification settings - Fork 13
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
Handle systems with multiple users #24
Handle systems with multiple users #24
Conversation
NppShell.dll is supposed to provide "Edit with Notepad++" context menu, but now it's getting more and more complex. I do understand that you're trying to fix all the issues that we've discovered, but I prefer to wait and to see users' feedback. Obviously RC publication doesn't help and we need more users feedback for what you have implemented. This PR will be merged, if it's really necessary (ie. a lot of users have the same problem and this solution is tested by them). Hope you understand my concern. |
@donho sure, I understand 🙂 |
0bfabe2
to
99461b6
Compare
99461b6
to
e512237
Compare
@GurliGebis |
@donho I'll push a branch with some logging later today or tomorrow, if you can try and build that locally and run it, and give me the log file, that would be great. |
@donho Here you go: https://github.com/GurliGebis/nppShell/tree/multi-user-debug Here is how to test it:
Please look inside the %APPDATA%\NppShell folder for the NppShell.txt file, please send me the content of that file if it doesn't work. |
@GurliGebis It looks promising. Here are the packages of TEST15: |
Tested - the menu entry is missing only on the very first time. So it's OK I think. |
@donho it works for me as well 🙂 |
@GurliGebis and @donho Since the msix package needs to be registered per user, I think you guys had a great solution with the method EnsureRegistrationOnCurrentUser. However, it has a blind spot: the uninstallation. The uninstaller will use regsvr32 /u which will uninstall only for the user that is executing the uninstaller, leaving the package still installed for other users. I saw that winmerge uses some bat scripts that call powershell commands directly to register/unregister but I could not find if they are calling to all users in the machine. |
@ddomingos-encora There really is no clean way to remove it from all users on the system, but since the msix is gone, it shouldn't cause any issues. |
Hi @GurliGebis
If you think it's a good approach, I can create a PR. Regards. |
@ddomingos-encora I can take a look at it. |
@ddomingos-encora come to think of it. |
@ddomingos-encora I tried it myself. This is the original problem I ran into - when provisioning a sparse package, it just never gets installed for users, it just stays in the AllUsers list. Did you test it locally, to verify that it actually got installed? |
All users:
Current user:
|
Also, by looking at the documentation, it looks like provisioning packages is for when creating a wim installation file. |
Hi @GurliGebis p.s: I'd like to ask you some help. I ended up messing my Windows. I generated the DLL and MSIX and to not have to use long paths I copied them to C: The problem is that when unregistering, the code calls a function related to ACL and this completely changed the permissions of my C: What does that function do? Do you know how could I revert its effect to get access again to my C: drive? Thanks |
@ddomingos-encora you are right - I will test again later today (only had 4 hours of sleep last night) |
@ddomingos-encora it does it, to prevent issues with the taskbar icon, since if the dll and msix is located in the same folder as the main exe, things break. There is no backup of the ACL's, so if you C drive is all messed up by having them in the root - I don't think there is an easy way to correct it (maybe do an upgrade to the same Windows version using the ISO - that might fix it - just a thought though, not something I have tested) |
@ddomingos-encora okay, it seems like with using an empty string, it gets installed. I have pushed my changes here - can you take a look and see if you can spot anything wrong? What I have done is the following:
|
Hi @GurliGebis |
@ddomingos-encora thanks. |
This handles multi user systems.
Since we cannot install a sparse package (msix) for all users on the system (due to the way the store and it's services are architected), we have to install it specifically for every user.
We do this by using the fact that the DLL is registered in the registry, so when the user right clicks a file for the first time, the DLL is loaded into explorer.exe's address space.
So we do the following:
The cool thing about this, is that we only run the check when the user right click for the first time in their session, since that is the only time the DLL is loaded into explorer.exe - after that, it stays in memory for the rest of their session.
The only downside is that the very first time a user (that isn't the one who installed Notepad++) right clicks a file, the menu items will be missing, since we haven't had a check to register the items yet. (Since our code isn't running before then, we cannot do it before this).
This fixes notepad-plus-plus/notepad-plus-plus#13476