-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to drag/drop a file to terminal with UAC turned off #7754
Comments
This is standard across the entire OS. Unfortunately, the only accepted way to get a file path into an elevated application (even notepad!) is by using the clipboard (in Terminal's case) or the File>Open dialog. |
This is a security measure implemented in Windows itself -- drag/drop is a form of messaging between applications, and messaging between non-admin and admin windows is very restricted. |
Well like in the ticket I listed, 6661, I'm running with uac off so there is no integrity level separation so I just thought I'd bring it up. |
Interesting! That would have been important to mention. I'll reopen this while we think about what's intended behavior. |
When we're elevated, we disable drag/dropping tabs when elevated, because of a platform limitation that causes the app to _crash_ (see #4874). However, if the user has UAC disabled, this actually works alright. So I'm adding it back in that case. I'm not positive if this is the best way to check if UAC is disabled, but normally, you'll get a [`TokenElevationTypeFull`] when elevated, not `TokenElevationTypeDefault`. If the app is elevated, but there's not a split token, that kinda implies there's no user account separation. If I'm wrong, it's just code, let's replace this with something that does work. ## Validation Steps Performed Booted up a Win10 VM, set `enableLUA` to `0`, rebooted, and checked if this exploded. It didn't. References #4874 References #3581 Work done in pursuit of #11096 Closes #7754 [`TokenElevationTypeFull`]: https://docs.microsoft.com/en-us/windows/win32/api/winnt/ne-winnt-token_elevation_type
🎉This issue was addressed in #11221, which has now been successfully released as Handy links: |
Using version 1.15.3466.0 in Windows 11 but this issue has NOT been fixed. Rearranging tabs with UAC disabled works but not drag and dropping files. #11221 only mentions allowing reordering of tabs with UAC disabled in the title but states it also fixes this issue. Maybe some regression somewhere? |
…/drop Credit where credit is due - @jboelter did literally all the hard work. I just separated this out to two elements: * Are we running elevated? * Can we drag drop? As we learned in #7754, the builtin administrator _can_ drag drop. But critically, they are also running as admin! The way we had this logic before, we're treat them as unelevated, because we had been overloading the meaning here. This splits these into two separate functions. Comes with the added benefit of re-adding the elevation shield to the Terminal window for users with UAC disabled (which was missing before) (and can _still_ be disabled). Closes #13928 Tested on a Win10 VM with `EnableLua=0`
We should reopen this issue! @bpsib has already said that this problem should be divided into 2 parts: dragging TABS & dragging FILES. I can also confirm, on Windows 11, all the way from 22000.XXX to latest 25309, dragging files to Windows Terminal NEVER worked. We don't know why @zadjii-msft closed this issue last year, but currently I highly doubt this problem is Windows Terminal-specific: The New Notepads uses exactly the same Tab pages provided by WinUI3, and it support drag & drop files under EnableLUA=0 out of box. PS1: I've debugged the Windows Terminal, the DragOver callback never triggers under EnableLUA=0 |
Credit where credit is due - @jboelter did literally all the hard work. I just separated this out to two elements: * Are we running elevated? * Can we drag drop? As we learned in #7754, the builtin administrator _can_ drag drop. But critically, they are also running as admin! The way we had this logic before, we're treat them as unelevated, because we had been overloading the meaning here. This splits these into two separate functions. Comes with the added benefit of re-adding the elevation shield to the Terminal window for users with UAC disabled (which was missing before) (and can _still_ be disabled). Closes #13928 Tested on a Win10 VM with `EnableLua=0`
Credit where credit is due - @jboelter did literally all the hard work. I just separated this out to two elements: * Are we running elevated? * Can we drag drop? As we learned in #7754, the builtin administrator _can_ drag drop. But critically, they are also running as admin! The way we had this logic before, we're treat them as unelevated, because we had been overloading the meaning here. This splits these into two separate functions. Comes with the added benefit of re-adding the elevation shield to the Terminal window for users with UAC disabled (which was missing before) (and can _still_ be disabled). Closes #13928 Tested on a Win10 VM with `EnableLua=0` (cherry picked from commit c5c15e8) Service-Card-Id: 88484047 Service-Version: 1.17
My environment: wt 1.17.230526001 zip version uac dragged to the bottom EnableLUA=0 Run profile as administrator (even if this option is not enabled, it still runs as administrator, possibly because I turned off EnableLUA) I still can't drag files, it shows the prohibited symbol. Is this issue resolved? |
@antnesswcm I'm pretty sure this was more correctly fixed in #14946, which was shipped in 1.18. |
@zadjii-msft Let me explain "more correctly fixed" more precisely. The #14946 fixes drag & drop initiatied from Windows Terminal (e.g. drag & drop tabs). But it DOES NOT fix the case when user drags files from other application to Windows Terminal. AFAIK, this is problem in Windows.UI.Xaml, which DataExchangeHost refuses to pass on drag event, even if there's actually no limitation. Here I sincerely ask for @zadjii-msft 's help:
|
Also I've pinpointed the problem & made a hook fix: https://github.com/NyaMisty/PunchDataExchangeHost With this, DataExchangeHost will be able to properly handle drag requests even when UAC disabled. @antnesswcm probably you can also have a try |
This is fantastic @NyaMisty, works perfectly in my limited testing. |
I run terminal as admin (I'm on Windows 10, version 22H2/build 19045.4046), and can confirm that this is broken even if UAC is on. I was literally just looking it up to see if anyone had a solution. |
It still doesn't work. |
Would recommend anyone having the drag-drop issue try this. |
Work like a charm for me. Thanks! |
Windows Version
10.0.19042.0
Terminal Version
1.3.2651
Any other software?
None open at the time
Steps to reproduce
Run windows terminal as administrator.
Try to drag a file/folder into the terminal to copy its path to the terminal window.
Does not work.
Expected behavior
I expected drag and drop for files/folders into the terminal window to behave the same as a command prompt or powershell window, both behave as expected in non-admin or administrator permission instances of the aforementioned programs.
Actual behavior
Path does not get copied during drag and drop into the terminal window, I just get the "deny" "not allowed" cursor icon when trying, unsure if this is related to the ongoing issue of being unable to rearrange tabs while in an admin window or not as seen in #6661
The text was updated successfully, but these errors were encountered: