Skip to content

Fixes the "Run as different user" window freezing#27779

Merged
ibeckermayer merged 7 commits intomasterfrom
isaiah/scard-implement-cancel
Jun 14, 2023
Merged

Fixes the "Run as different user" window freezing#27779
ibeckermayer merged 7 commits intomasterfrom
isaiah/scard-implement-cancel

Conversation

@ibeckermayer
Copy link
Copy Markdown
Contributor

The problem was that we were occasionally getting SCARD_IOCTL_GETSTATUSCHANGEW calls with infinite timeouts, which we would never return from because our status never changes. This is the correct behavior in the short run, but we were ignoring the meaning of SCARD_IOCTL_CANCEL, which tells such long-hanging calls to return with an SCARD_E_CANCELLED return value.

This was causing the "Run as different user" window to freeze, because something internally was waiting around for an SCARD_E_CANCELLED that would never come.

To fix this, now whenever we get an SCARD_IOCTL_GETSTATUSCHANGEW with an infinite timeout, we add to the corresponding context a DeviceControlResponse that wraps the necessary SCARD_E_CANCELLED return value. Later, when an SCARD_IOCTL_CANCEL is received for that context, we grab the DeviceControlResponse and return it.

The problem was that we were occasionally getting SCARD_IOCTL_GETSTATUSCHANGEW
calls with infinite timeouts, which we would never return from because our
status never changes. This is the correct behavior in the short run, but we
were ignoring the meaning of SCARD_IOCTL_CANCEL, which tells such long-hanging
calls to return with an SCARD_E_CANCELLED return value.

This was causing the "Run as different user" window to freeze, because something
internally was waiting around for an SCARD_E_CANCELLED that would never come.

To fix this, now whenever we get an SCARD_IOCTL_GETSTATUSCHANGEW with an infinite
timeout, we add to the corresponding context a DeviceControlResponse that wraps
the necessary SCARD_E_CANCELLED return value. Later, when an SCARD_IOCTL_CANCEL
is received for that context, we grab the DeviceControlResponse and return it.
Copy link
Copy Markdown
Collaborator

@zmb3 zmb3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will have a closer look soon.

Comment thread lib/srv/desktop/rdp/rdpclient/src/rdpdr.rs Outdated
Comment thread lib/srv/desktop/rdp/rdpclient/src/rdpdr/scard.rs Outdated
Comment thread lib/srv/desktop/rdp/rdpclient/src/rdpdr/scard.rs Outdated
Comment thread lib/srv/desktop/rdp/rdpclient/src/rdpdr.rs Outdated
@ibeckermayer ibeckermayer requested a review from zmb3 June 13, 2023 17:20
Comment thread lib/srv/desktop/rdp/rdpclient/src/rdpdr/scard.rs
Comment thread lib/srv/desktop/rdp/rdpclient/src/rdpdr/scard.rs
@ibeckermayer ibeckermayer added this pull request to the merge queue Jun 14, 2023
Merged via the queue into master with commit c1b9492 Jun 14, 2023
@ibeckermayer ibeckermayer deleted the isaiah/scard-implement-cancel branch June 14, 2023 21:45
@public-teleport-github-review-bot
Copy link
Copy Markdown

@ibeckermayer See the table below for backport results.

Branch Result
branch/v11 Create PR
branch/v12 Create PR
branch/v13 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants