Skip to content
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

Copy Paste not working in one direction (Remote -> Local) #6859

Closed
Tracked by #7342
bilago opened this issue Jan 12, 2024 · 19 comments · Fixed by #7217
Closed
Tracked by #7342

Copy Paste not working in one direction (Remote -> Local) #6859

bilago opened this issue Jan 12, 2024 · 19 comments · Fixed by #7217
Labels
bug Something isn't working unreproducible Can not be reproduced

Comments

@bilago
Copy link

bilago commented Jan 12, 2024

Bug Description

Running nightly on both machines, I can copy paste from my local machine to the remote machine but not in the other direction.

I've enabled/disabled clipboard on both, rebooted, and no change.

File copy from Remote to local is working

no data in my logs for rustdesk to indicate any issues, any way to make it more verbose ?

How to Reproduce

Remote into computer
Select text on remote computer
Press ctrl+C
Focus to local computer
Press ctrl+V
No text pasted, or previous clipboard from local pasted

Expected Behavior

Clipboard should transfer text to local machine

Operating system(s) on local side and remote side

Windows 11 -> Windows 10

RustDesk Version(s) on local side and remote side

1.2.4 -> 1.2.4

Screenshots

n/a

Additional Context

No response

@bilago bilago added the bug Something isn't working label Jan 12, 2024
@rustdesk rustdesk added the unreproducible Can not be reproduced label Jan 12, 2024
Repository owner deleted a comment from xuemingyang Jan 15, 2024
fufesou added a commit to fufesou/rustdesk that referenced this issue Feb 20, 2024
Signed-off-by: fufesou <shuanglongchen@yeah.net>
@rustdesk rustdesk reopened this Feb 22, 2024
@fufesou
Copy link
Collaborator

fufesou commented Feb 23, 2024

@bilago Please try the tmp build here https://github.com/fufesou/rustdesk/releases/tag/tmp

Install or run it on the remote side.

Installed version: C:\Windows\ServiceProfiles\LocalService\AppData\Roaming\RustDesk\log\server\RustDesk_rCURRENT.log
Portable version: %appdata%\RustDesk\log\RustDesk_rCURRENT.log

Only some logs prefixed with "REMOVE ME ====== " are added.

Please check if there're some logs there.

1708678878117

@bilago
Copy link
Author

bilago commented Feb 23, 2024

@fufesou

[2024-02-23 12:56:54.286197 -05:00] ERROR [src\common.rs:314] REMOVE ME ======== Failed to get clipboard: The clipboard contents were not available in the requested format or the clipboard is empty.

every single time I do CTRL+C

@evilJazz
Copy link

@evilJazz please try out the today's nightly build, we have some fix for linux.

Thanks! Clipboard transfer in the new build of 1.2.4 works again. Tested against server running 23.10 and 1.2.3 and later updated server to the same release of 1.2.4. Both working.

@fufesou
Copy link
Collaborator

fufesou commented Feb 24, 2024

@fufesou

[2024-02-23 12:56:54.286197 -05:00] ERROR [src\common.rs:314] REMOVE ME ======== Failed to get clipboard: The clipboard contents were not available in the requested format or the clipboard is empty.

every single time I do CTRL+C

@bilago Thank you for your patient testing. It seems RustDesk cannot detect content of the clipboard or there's something wrong.

Can you please download the build, and try again? https://github.com/fufesou/rustdesk/releases/tag/tmp

I've added more logs about the errors.

image

Please "Ctrl + C" text content, or it will continuously print the following log.

Failed to get clipboard: The clipboard contents were not available in the requested format: The operation completed successfully

@bilago
Copy link
Author

bilago commented Feb 27, 2024

@fufesou thanks for all your help so far, I just installed this version and I get this non stop in the logs:

[2024-02-27 08:10:25.583953 -05:00] ERROR [src\common.rs:314] REMOVE ME ======== Failed to get clipboard: The clipboard contents were not available in the requested format: The operation completed successfully. (os error 0)
[2024-02-27 08:10:25.917199 -05:00] ERROR [src\common.rs:314] REMOVE ME ======== Failed to get clipboard: The clipboard contents were not available in the requested format: The operation completed successfully. (os error 0)
[2024-02-27 08:10:26.250755 -05:00] ERROR [src\common.rs:314] REMOVE ME ======== Failed to get clipboard: The clipboard contents were not available in the requested format: The operation completed successfully. (os error 0)

@rustdesk
Copy link
Owner

@fufesou build a version output the format.

@fufesou
Copy link
Collaborator

fufesou commented Feb 28, 2024

@bilago Hi, please try https://github.com/fufesou/rustdesk/releases/tag/tmp again. I've add the available clipboard formats.

image

Please copy text and then check what it report in the log.

@bilago
Copy link
Author

bilago commented Feb 28, 2024

@fufesou

[2024-02-28 12:35:53.711409 -05:00] ERROR [src\common.rs:314] REMOVE ME ======== Failed to get clipboard: The clipboard contents were not available in the requested format: CF_UNICODETEXT is not available, but no error occurs. available formats:  13,

@fufesou
Copy link
Collaborator

fufesou commented Feb 29, 2024

CF_UNICODETEXT is exactly 13.

I cannot understand why IsClipboardFormatAvailable(13) returns 0, while EnumClipboardFormats() returns 13.

Can you please do the following tests?

  1. Try reverse connection.
    If you're testing connect from "A" to "B", try connect from "B" to "A".
    Then copy any text.
    Check the log at %appdata%\RustDesk\log\RustDesk_rCURRENT.log

    To check if the "system user" affacts on that machine.
    The server(remote) side process run as the system user.
    If you reverse the connecting, the clipboard checking will run as a normal user.

    You've methioned

    What I did find out while I wait, was if I reverse the connection, clipboard is working fine both ways. Its only when i'm connecting from Win 11 (Server) to Win 10 (Client)

  2. Download the new test app. https://github.com/fufesou/rustdesk/releases/tag/tmp Maybe it canbe a workaround.
    This build will try get text from the clipboard when IsClipboardFormatAvailable(13) returns 0, but EnumClipboardFormats()'s returns contains 13.

@bilago
Copy link
Author

bilago commented Feb 29, 2024

@fufesou
with the latest build:

 [2024-02-29 09:39:51.240021 -05:00] ERROR [src\common.rs:314] REMOVE ME ======== Failed to get clipboard: The clipboard contents were not available in the requested format: CF_UNICODETEXT is not available, but no error occurs. available formats: []
[2024-02-29 09:39:51.577925 -05:00] ERROR [src\common.rs:314] REMOVE ME ======== Failed to get clipboard: Unknown error while interacting with the clipboard: failed to read clipboard text size

I reversed connection and clipboard is working in both directions without any errors.

@fufesou
Copy link
Collaborator

fufesou commented Feb 29, 2024

[2024-02-29 09:39:51.240021 -05:00] ERROR [src\common.rs:314] REMOVE ME ======== Failed to get clipboard: The clipboard contents were not available in the requested format: CF_UNICODETEXT is not available, but no error occurs. available formats: []
[2024-02-29 09:39:51.577925 -05:00] ERROR [src\common.rs:314] REMOVE ME ======== Failed to get clipboard: Unknown error while interacting with the clipboard: failed to read clipboard text size

Did you copy some text between these two logs?

It seems the "system user service" affects reading the clipboard on your machine, maybe because of some system settings.
And the workaround does not work.

If so, I can hardly do more changes.

Can you please try again? Do not install on the remote side, connect to the remote, then Ctrl + C on the remote side.
Just to make sure the normal user process works fine again.

You may find logs in %appdata%\RustDesk\log\RustDesk_rCURRENT.log

@rustdesk
Copy link
Owner

rustdesk commented Mar 3, 2024

This code https://github.com/dacap/clip/blob/94693e2414a2c69a8ca16f065240c80a94cc6221/clip_win.cpp#L289 seems better, better lock/unlock behavior.

In https://github.com/1Password/arboard/blob/77e0e078eb460ac2fa0eda96124163c11ef6b2d1/src/platform/windows.rs#L493, size() and data copy not embrased in the same lock, though there is a comment saying no problem, but doubtful. Also it check CF_UNICODETEXT only, do not check the other text format.

Another clue:

https://learn.microsoft.com/en-us/answers/questions/1168537/oleclipboard-and-idataobject-under-local-system-ac


Since this thread is too long, so I removed some dicussions, and made a conclusion here so that we do not get lost. Thanks @DoumanAsh for a lot of good suggestions very much.

Currently, on the remote machine, the system service running with user session token can set_text, but failed to get_text? Since about why get_text failed, maybe because of

  • permission settings, @DoumanAsh suggest "individual PCs may have different security settings", but we have no idea how and where to check this, :(. Even this is the reason, we can not expect every user adjust security settings for clipboard working in RustDesk, :(
  • Bug of specific windows update, windows update is suggested.
  • maybe format, we will check more format rather than CF_UNICODETEXT only
  • unknow reason

What will we do?

  • 1, @fufesou will try out the https://github.com/dacap/clip.
  • 2, If above clip does not work, we will pause and observe if more users report this.
  • 3, If we have more users report this, we will try out another solution, get text via ipc from cm process which is a user process, since we know user session works on this machine, @bilago had written a .net program to verify.

Repository owner deleted a comment from fufesou Mar 3, 2024
Repository owner deleted a comment from DoumanAsh Mar 4, 2024
Repository owner deleted a comment from fufesou Mar 4, 2024
Repository owner deleted a comment from DoumanAsh Mar 4, 2024
Repository owner deleted a comment from bilago Mar 4, 2024
Repository owner deleted a comment from bilago Mar 4, 2024
Repository owner deleted a comment from bilago Mar 4, 2024
Repository owner deleted a comment from bilago Mar 4, 2024
Repository owner deleted a comment from attikov Mar 4, 2024
Repository owner deleted a comment from bilago Mar 4, 2024
Repository owner deleted a comment from attikov Mar 4, 2024
Repository owner deleted a comment from bilago Mar 4, 2024
Repository owner deleted a comment from fufesou Mar 4, 2024
Repository owner deleted a comment from bilago Mar 4, 2024
Repository owner deleted a comment from bilago Mar 4, 2024
Repository owner deleted a comment from fufesou Mar 4, 2024
Repository owner deleted a comment from bilago Mar 4, 2024
Repository owner deleted a comment from fufesou Mar 4, 2024
Repository owner deleted a comment from bilago Mar 4, 2024
Repository owner deleted a comment from bilago Mar 4, 2024
Repository owner deleted a comment from attikov Mar 4, 2024
Repository owner deleted a comment from attikov Mar 4, 2024
Repository owner deleted a comment from bilago Mar 4, 2024
@fufesou
Copy link
Collaborator

fufesou commented Mar 4, 2024

@bilago Hi, can you please try https://github.com/fufesou/rustdesk/releases/tmp again? Thanks.

I've used https://github.com/dacap/clip as the clipboard implemantion on Windows.

Repository owner deleted a comment from Beingjustinroyfernandes Mar 5, 2024
Repository owner deleted a comment from attikov Mar 5, 2024
@rustdesk
Copy link
Owner

rustdesk commented Mar 6, 2024

@bilago could you test above?

@bilago
Copy link
Author

bilago commented Mar 6, 2024

@fufesou with your latest tmp build, clipboard is not working from remote, and no logs indicating anything either

C:\Windows\ServiceProfiles\LocalService\AppData\Roaming\RustDesk\log\server\RustDesk_rCURRENT.log

on the remote

@rustdesk
Copy link
Owner

rustdesk commented Mar 6, 2024

Thanks @bilago , We will have to go to step 2. :(

  • 1, @fufesou will try out the https://github.com/dacap/clip.
  • 2, If above clip does not work, we will pause and observe if more users report this.
  • 3, If we have more users report this, we will try out another solution, get text via ipc from cm process which is a user process, since we know user session works on this machine, @bilago had written a .net program to verify and your reversed connection works.

@bilago
Copy link
Author

bilago commented Mar 6, 2024

I do appreciate all the time spent on this, I look forward to future developments on the issue.

Repository owner deleted a comment from attikov Mar 7, 2024
Repository owner deleted a comment from bilago Mar 7, 2024
@rustdesk
Copy link
Owner

rustdesk commented Mar 8, 2024

tracked by #7342

@rustdesk rustdesk closed this as completed Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unreproducible Can not be reproduced
Projects
None yet
4 participants