Skip to content

vmware: add legacy text-clipboard backdoor commands (6-9)#1589

Open
felixrieseberg wants to merge 1 commit into
copy:masterfrom
felixrieseberg:vmware-clipboard-pr
Open

vmware: add legacy text-clipboard backdoor commands (6-9)#1589
felixrieseberg wants to merge 1 commit into
copy:masterfrom
felixrieseberg:vmware-clipboard-pr

Conversation

@felixrieseberg

@felixrieseberg felixrieseberg commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Just like the other VMWare-related PRs, no hard feelings if you don't want them - I just want to upstream stuff I've done for Windows. This one implements the four legacy text-clipboard backdoor commands on VMware port 0x5658:

Cmd Name Direction Description
6 GETSELLENGTH host→guest Returns byte-length of staged text, 0xFFFFFFFF if nothing fresh
7 GETNEXTPIECE host→guest Reads next 4 bytes of staged text (LE dword)
8 SETSELLENGTH guest→host Allocates a receive buffer for an incoming transfer
9 SETNEXTPIECE guest→host Writes next 4 bytes into the receive buffer; emits vmware-clipboard-guest when full

Bus events added:

  • vmware-clipboard-host – caller stages a Uint8Array; the device makes it readable via GETSELLENGTH/GETNEXTPIECE
  • vmware-clipboard-guest – fired when the guest finishes writing, carries the received Uint8Array

This is the pre-RPC clipboard protocol that open-vm-tools and its predecessors use. Because the guest reads and writes directly via IN/OUT instructions on port 0x5658, a minimal Win9x agent can sync CF_TEXT with the host from ring 3 without any kernel driver — just a MOV EAX, 564D5868h / IN EAX, DX loop.

The command numbers and wire format match VMware Workstation's implementation as documented in the open-vm-tools source (lib/backdoor/backdoorGcc32.c, vmtools/src/vmbackdoor.c).

Implementation notes

  • CLIP_MAX (64 KiB) caps both directions to prevent unbounded allocation.
  • clip_out_fresh is a one-shot flag: GETSELLENGTH arms it (sets fresh = false) so a second poll before new data arrives returns 0xFFFFFFFF.
  • On the guest→host side, SETNEXTPIECE auto-fires vmware-clipboard-guest once the cursor reaches the declared length. A zero-length SETSELLENGTH fires immediately.
  • Clipboard state is ephemeral and not included in get_state/set_state; a save/restore discards any in-flight transfer, matching the behaviour of real VMware Tools.

Host stages bytes via the vmware-clipboard-host bus event; guest polls
GETSELLENGTH/GETNEXTPIECE. Guest pushes via SETSELLENGTH/SETNEXTPIECE
and the device emits vmware-clipboard-guest when the buffer fills.
Same protocol as open-vm-tools' pre-RPC copy/paste, so a tiny Win9x
agent can do IN EAX,DX from ring 3 with no driver.
@chschnell

Copy link
Copy Markdown
Contributor

Nice PR (same goes for #1542)!

Do you have some experience with vmware backdoor support for older guests? I was looking for Windows and found these:

I have the absolute mouse positioning working under Windows 3.1, I wonder if I could get the clipboard working, too.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants