Unable to drag/drop a file to terminal with UAC turned off #10796

Closed
opened 2026-01-31 02:30:32 +00:00 by claunia · 17 comments
Owner

Originally created by @Genesis-Nova on GitHub (Sep 27, 2020).

Originally assigned to: @zadjii-msft on GitHub.

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

Originally created by @Genesis-Nova on GitHub (Sep 27, 2020). Originally assigned to: @zadjii-msft on GitHub. 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
Author
Owner

@DHowett commented on GitHub (Sep 28, 2020):

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.

@DHowett commented on GitHub (Sep 28, 2020): 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.
Author
Owner

@DHowett commented on GitHub (Sep 28, 2020):

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.

@DHowett commented on GitHub (Sep 28, 2020): 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.
Author
Owner

@Genesis-Nova commented on GitHub (Sep 28, 2020):

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.

@Genesis-Nova commented on GitHub (Sep 28, 2020): 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.
Author
Owner

@DHowett commented on GitHub (Sep 29, 2020):

Interesting! That would have been important to mention. I'll reopen this while we think about what's intended behavior.

@DHowett commented on GitHub (Sep 29, 2020): Interesting! That would have been important to mention. I'll reopen this while we think about what's intended behavior.
Author
Owner

@zadjii-msft commented on GitHub (Sep 13, 2021):

@Genesis-Nova Hey just to be sure I'm fixing this correctly, how did you disable UAC? Just by sliding the User Account Control slider all the way down, or by setting EnableLUA to 0 in the registry? I think I have a way to detect the second scenario, but not the first.

@zadjii-msft commented on GitHub (Sep 13, 2021): @Genesis-Nova Hey just to be sure I'm fixing this correctly, how did you disable UAC? Just by sliding the User Account Control slider all the way down, or by setting `EnableLUA` to 0 in the registry? I think I have a way to detect the second scenario, but not the first.
Author
Owner

@ghost commented on GitHub (Oct 20, 2021):

:tada:This issue was addressed in #11221, which has now been successfully released as Windows Terminal Preview v1.12.2922.0.🎉

Handy links:

@ghost commented on GitHub (Oct 20, 2021): :tada:This issue was addressed in #11221, which has now been successfully released as `Windows Terminal Preview v1.12.2922.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.12.2922.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Author
Owner

@bpsib commented on GitHub (Jan 15, 2023):

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?

@bpsib commented on GitHub (Jan 15, 2023): 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?
Author
Owner

@NyaMisty commented on GitHub (Mar 13, 2023):

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
PS2: New Notepad does not uses DataExchangeHost, it's receiving WM_DROPFILES and using DragQueryFile to handle the file dropping

@NyaMisty commented on GitHub (Mar 13, 2023): 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 PS2: New Notepad does not uses DataExchangeHost, it's receiving WM_DROPFILES and using DragQueryFile to handle the file dropping
Author
Owner

@antnesswcm commented on GitHub (Jul 19, 2023):

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 commented on GitHub (Jul 19, 2023): 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?
Author
Owner

@zadjii-msft commented on GitHub (Jul 19, 2023):

@antnesswcm I'm pretty sure this was more correctly fixed in #14946, which was shipped in 1.18.

@zadjii-msft commented on GitHub (Jul 19, 2023): @antnesswcm I'm pretty sure this was more correctly fixed in #14946, which was shipped in 1.18.
Author
Owner

@NyaMisty commented on GitHub (Jul 19, 2023):

@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:

  1. Previous discussion on DataExchangeHost was talking about cases where UAC-enabled & user requested elevation, but in our case, user directly turned off the whole UAC
    • The difference is, when UAC enabled, the drag should be forbidden, which is also what UIPI does
    • But when UAC disabled, UIPI will be fully turned off, but DataExchangeHost won't sync with UIPI's state, even UIPI get turned off in kernel, DataExchangeHost still refuses drag request as if UAC was still on.
  2. The key problem in this case was to make DataExchangeHost pass the drag event unconditionally when UAC disabled. I know that has nothing to do with WindowsTerminal, and required updates to OS itself. So I need someone inside MSFT to push the progress :)
@NyaMisty commented on GitHub (Jul 19, 2023): @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: 1. Previous discussion on DataExchangeHost was talking about cases where UAC-enabled & user requested elevation, but in our case, user directly turned off the whole UAC - The difference is, when UAC enabled, the drag should be forbidden, which is also what UIPI does - But when UAC disabled, UIPI will be fully turned off, but DataExchangeHost won't sync with UIPI's state, even UIPI get turned off in kernel, DataExchangeHost still refuses drag request as if UAC was still on. 2. The key problem in this case was to make DataExchangeHost pass the drag event unconditionally when UAC disabled. I know that has nothing to do with WindowsTerminal, and required updates to OS itself. So I need someone inside MSFT to push the progress :)
Author
Owner

@NyaMisty commented on GitHub (Jul 19, 2023):

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

@NyaMisty commented on GitHub (Jul 19, 2023): 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
Author
Owner

@Genesis-Nova commented on GitHub (Jul 20, 2023):

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.

@Genesis-Nova commented on GitHub (Jul 20, 2023): > 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.
Author
Owner

@skunkmommy commented on GitHub (Feb 23, 2024):

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.

@skunkmommy commented on GitHub (Feb 23, 2024): 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.
Author
Owner

@i486 commented on GitHub (Jun 9, 2024):

It still doesn't work.

@i486 commented on GitHub (Jun 9, 2024): It still doesn't work.
Author
Owner

@Genesis-Nova commented on GitHub (Jul 16, 2024):

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

Would recommend anyone having the drag-drop issue try this.
This is in no way, shape, or form related to dragging tabs, this is related to dragging files into terminal and having it work as it does for a normal cmd or powershell window.

@Genesis-Nova commented on GitHub (Jul 16, 2024): > 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 Would recommend anyone having the drag-drop issue try this. _This is in no way, shape, or form related to dragging **tabs**, this is related to dragging files into terminal and having it work as it does for a normal cmd or powershell window._
Author
Owner

@JackCui001 commented on GitHub (Dec 10, 2024):

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

Work like a charm for me. Thanks!

@JackCui001 commented on GitHub (Dec 10, 2024): > 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](https://github.com/antnesswcm) probably you can also have a try Work like a charm for me. Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#10796