6 Answers
Lower-integrity processes can’t pass messages to higher level ones.
You’ll find that this is the case for any elevated process since Windows Vista onward.
Processes run under certain security access tokens and integrity levels. Explorer runs under your user account’s restricted token with a medium integrity level, and when you elevate a process by running as administrator, it will use a different, unrestricted security token with a high integrity level.
Part of the security overhaul that came with Vista was User Interface Privilege Isolation, which prevents lower level processes from sending messages to higher level ones (because the messages may be malicious, as in the case of shatter attacks).
So in this case, Windows won’t allow Explorer to send the drag and drop message to Notepad++ (it actually returns “success” but drops the message).
For more detailed information about access tokens, integrity levels and UIPI, see Windows Integrity Mechanism Design.
Louis explained why you can’t drag from non-admin-mode explorer into admin-mode Notepad++, and magicandre told you how get around it by running explorer in admin mode.
After experiencing a similar problem myself, I have to ask further: why are you running Notepad++ in admin mode in the first place? In my case it was because the HTML Tidy plugin which I like to use has to update a cfg file in Notepad++’s Program Files folder in order to work; and Windows 8 has Program Files locked down like crazy.
So in the end I unlocked the Notepad++ Program Files folder as outlined here:
http://forums.auran.com/trainz/entry.php?115-Removing-the-security-restrictions-from-a-folder-in-the-Program-Files-folder
Then I could happily run Notepad++ as a regular user, and then I could drag & drop or use the ever-handy context menu again, from non-admin-mode explorer into non-admin-mode Notepad++.
I hope this helps you in some way.
2
Louis gave you the correct technical answer, here is workaround. You can start the Explorer with admin rights with a hack and now you should be able to drag & drop files.
In most cases (where you have read- but not write-access as regular user) there is a better approach than running Notepad++ as admin:
Install the plugin “Save as admin” (see Notepad++ plugin manager).
Now just run Notepad++ as a regular user and open the files you want to edit. As you have read-access this will work without problems.
Now every time you try to save a file you don’t have write permissions the “Save as admin” plugin will elevate the privileges for saving. Therefore if you now execute the save command an UAC dialog will be displayed and if you select “yes” on that dialog the file will be saved using admin permissions.
Another workaround is to use the standalone (zipped) version of Notepad++ instead of the installer version.
- Uninstall/Delete Notepad++
- Go to the Notepad++ download page and download the .zip or .7z package (not the exe)
- Unzip the contents of that package somewhere inside your user directory
Drawback to this workaround is you will of course need to create your own shortcuts and manually update your default text editor if desired. And you won’t have the context-menu entry for notepad unless you hack it in there yourself.
Changing permissions on an elevated task installed by the elevated installers service is difficult at best. Windows 7 x64. I took the path suggested.. I used Control Panel » Programs and Features to uninstall Notepad++.
Then went to the Notepad++ website and downloaded the zipped version with no installer.
Then used Windows Explorer to extract all files to the path C:\Program Files (x86)\Notepad++
– the same as the original installer path.
Then I created a folder group in the All Programs section of the Start menu.
- Click Start menu
- Right click All programs
- Open All Users
- Click Programs
- Right click, New » Folder, enter
Notepad++
Then I used another Explorer window to create a shortcut to notepad++.exe
, then dragged and dropped that shortcut into the C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Notepad++
, answering the Destination Folder Access Denied dialog box with Continue.
Next disable the AutoUpdate function for Plugins on Notepad++, like most software these days “Updates” are often “hostile” and carry a real degree of risk. For an application I prefer to know when an update occurs.. it is not a service so it is riskier to trust developers to properly test their code.
Go » Plugins » Plugin Manager » Show Plugins » Settings (lower left corner), there uncheck Notify of plugin updates at startup.
Now I can drag and drop again.
Now the Notepad++ process is not being run as an elevated task and other applications like Explorer are allowed to drag and drop files on the open Notepad++ program window to open them.
22