Notepad++ v8.8.2 Release Candidate
-
@donho said in Notepad++ v8.8.2 Release Candidate:
So is it also a plugin or it’s a piece of code?
N++ own code.
I was starting to get tired of constantly checking the correct setup combinations for my N++ (backup snapshots ON/OFF vs N++ run as admin/non-admin, drag&drop for elevated vs non-elevated etc…) while editing system files etc.
I don’t like using that plugin not only because it messes with the FlushFileBuffers WINAPI, but also because it uses interprocess pipes and a custom unsigned external NppAdminAccess.exe app, which then manifests itself like this:
At first I was thinking about a new similar small but signed “npp-uac.exe” app, but then I thought - why not use the existing signed notepad++.exe for this! I will not pollute this thread more, but it is relatively simple PR and moreover it has the power to cover different N++ ops and not only the Save one as the NppSaveAsAdmin plugin (so e.g. adding a new
#UAC-TOGGLE-R/O-ATTRIBUTE#
should be then easy):
What you see above is Save-op N++ attempt, which is now in fact:
- detecting ERROR_ACCESS_DENIED while trying to open N++ output file for writing
- redirecting standard N++ output to a temp-location file (otherwise using the same file writing code as is now)
- requesting UAC-elevated op by calling the runas ShellExecuteEx on N++ with special params (will be handled later by slightly modified wWinMain)
- at the very start of wWinMain, the elevated N++ process detects it is a UAC-op request and not the usual N++ launching and does the requested op (in this case it will do a simple CopyFile temp2destination + DeleteFile(temp)) and immediately exits