notepad2-mod icon indicating copy to clipboard operation
notepad2-mod copied to clipboard

Built in UAC elevation request

Open XhmikosR opened this issue 12 years ago • 5 comments

This is Issue 50 moved from a Google Code project. Added by 2011-10-13T16:27:44.000Z by [email protected]. Please review that bug for more context and additional comments, but update this bug.

Original labels: Type-Enhancement, Priority-Medium

Original description

Do to UAC protection in windows editing files in system folders requires administrator permissions. It's quite anoying to have to close notepad2, open it as administrator, reopen the file, edit it again and finally be able to save.

So I was wondering if it would not be possible to add a built in UAC elevation request on save or as maybe a "edit as administrator" option to aliviate the issue.

XhmikosR avatar Aug 27 '12 09:08 XhmikosR

From Notepad2 FAQ:

There may be an easier way to save files with Administrator privileges. The principle of this method would be to create a temporary file, and then use a Win32 API file operation function with partial UAC elevation support to copy the temporary file over the original. However, this would break hardlinks, so that's why it's a design decision not to implement this method in Notepad2.

So in lieu of an "easier way to save files with Administrator privileges," he recommends using /u (or /n /u as the case may be) and copy/paste your text.

Seemed like that might be relevant to this issue.

QWp6t avatar Jun 17 '13 19:06 QWp6t

Incrementing this:

  • In File menu put a menu item "Reopen as Admin" This option should reopen the current file using /u

This can solve this feature request.

josenicomaia avatar Jan 05 '15 02:01 josenicomaia

If save fails because of missing rights save a temporary diff of the buffer and the file. Display a dialog that allows you to open the file in an elevated Notepad2 and apply the temporary diff. Add an 'Open elevated' feature in the file open dialogue, maybe. This would be in addition to the menu entry suggested by @josenicomaia . This also prevents the hardlink breaking issue with copying a temporary file. Disadvantage: basic support for diff-ing required.

apex-hughin avatar Mar 06 '15 11:03 apex-hughin

I realize this is an old issue, but I implemented this much-needed feature over the weekend (#154). It works by saving a temp file before restarting, and then loading the contents from that temp file, but keeping the original filename. For this, I added a new command line parameter, /buffer, allowing specifying path to the filename with the contents of the text buffer.

Would be awesome if this gets merged :)

hmemcpy avatar Apr 30 '16 20:04 hmemcpy

Thanx @hmemcpy :+1:

klonos avatar Apr 30 '16 21:04 klonos