Currently it's possible to open a file in Notepad++ which requires administrative privileges if you want to save it. When you try to save it, Notepad++ gives you a bad error message ("Please check if this file is opened in another program."). This is a pain since you have to restart the program as administrator.
A process can't elevate itself once it's already been started, so to solve this we need to start another process from Notepad++. My solution works like so:
1) If elevation is needed when saving, Notepad++ first saves the file to a temporary file.
2) A second process - nppcopy.exe - is started with elevated privileges.
3) This second process moves the temporary file to its proper location.
I briefly considered other solutions (i.e. having the second process write the data directly), but IPC using the Windows API seemed very primitive (WM_COPYDATA doesn't handle variable length strings well). My current solution also keeps nppcopy.exe very lightweight and free of dependencies.
The attached zip file consists of:
1) The files needed to build nppcopy.exe.
2) A patch for Notepad++ so that it can take advantage of nppcopy.exe.
Place nppcopy.exe in the same directory as notepad++.exe. I don't know what your release process is, but if you accept this patch you will of course have to include nppcopy.exe in the installer.
I've also included slightly better error messages when saving.
Note that Notepad++ detects that nppcopy.exe has updated the saved file, so it prompts the user to reload the file. This is obviously undesirable. Therefore I disable the autoupdate for one (1) time whenever an elevation is needed (see "skipAutoUpdateOnce" etc).