Incorporating SaveAsAdmin's handling into N++'s
editing a given file sometimes requires elevated permissions due to the file’s protected location (e. g. C:\Program Files\Notepad++\change.log) and N++ can handle this, of course.
But IMHO, there’s a small, yet important, downside with the current implementation: all editing done prior to confirming the launch in Administrator mode is simply lost.
The reason behind is that N++'s newly created admin-instance opens the file once again instead of reading edited contents from the “parent” instance.
Installing SaveAsAdmin plugin solved this before N++ x64 launched.
And I tried my best to get the plugin working with on x64, but I don’t understand C++ good enough to succeed.
From what I do understand, SaveAsAdmin seems to launch a non-windowed “sub-program”, pass in edited contents via pipe and the sub-program (with elevated permissions for itself) then writes the file’s contents to disk.
So, can N++ kind of incorporate SaveAsAdmin’s way of dealing with such files? Maybe by passing the contents to the admin-instance, too?
Any help would be greatly appreciated!
@Eagle3386 You may want to test this https://github.com/chcg/nppSaveAsAdmin/releases/tag/188.8.131.52.9. Just a rebuild of the sourceforge repo with adaptations to x64. I will also add it to the x64 pluginManager list, if it is working fine for you.
@chcg, awesome work - thanks mate! 👍
Some suggestions, though:
- either keep the 4-digit versioning scheme known from the .NET framework, i. e. change it to “184.108.40.206” or maybe even “220.127.116.11” due to the added build of a x64 version or switch to (IMHO better) semantic versioning, i. e. release it as version “1.1.0”
- add yourself as a author within the about dialog and credits as “credit where credit is due” :)
- change the version display of “a,b,c,d” to the common “a.b.c.d”
If you want, I’d happily fork it on GH and provide you with a PR - just drop me short line. :)
Eagle3386 last edited by Eagle3386
@donho since the resulting NppAdminAccess.exe is (and can) not be signed with N++'s official certificate, I’d like to know if you can incorporate @chcg’s provided code in order to have less technical educated N++ users getting a “valid” UAC prompt from Windows instead of the yellow “do you really trust this app” one.
@all: what do I need to do to receive the 2nd reputation point in order to not be forced to wait 20 minutes between each reply anymore?
@Claudia-Frank, thanks for helping me overcoming the “penalty”! ☺️
@Eagle3386 The dll version is still 18.104.22.168. As this is just a rebuild without any functional change and I’m not planning to extend or further modify it. So keeping it as is for now.
@chcg, while I disagree regarding functional change as support for x64 is introduced, I’m also deeply thankful for your rebuilt.
Hence, I’ll consider this solved and would love to see it available in plugin manager(s) for x64 soon. :)