OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 16, 2024 1:46 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: VirtualBox: Shared clipboard / drag 'n' drop
PostPosted: Sat Sep 09, 2017 3:56 pm 
Offline
Member
Member
User avatar

Joined: Fri Jan 27, 2017 12:15 pm
Posts: 149
Location: Belgium
Hello all,

For quite some time I have been wondering how to use the clipboard / drag 'n' drop features in VirtualBox. I am especially interested in the clipboard feature. How would I implement it in to my OS, and how does it work exactly?

Thanks in advance,
obiwac

_________________
AQUA OS: https://obiwac.wordpress.com/aqua-os/


Top
 Profile  
 
 Post subject: Re: VirtualBox: Shared clipboard / drag 'n' drop
PostPosted: Sun Sep 10, 2017 2:06 am 
Offline
Member
Member

Joined: Fri Aug 19, 2016 10:28 pm
Posts: 360
I am not familiar with the interface and have never programmed it, but I investigated a little and can share what I found.

First, as you may know, the clipboard function uses guest additions, which are drivers/services that communicate between the guest OS and the host application. Apparently, there are multiple communication models, and the one used by the clipboard addition is called HGCM (Host-Guest Communication Manager). This model uses port io through a pseudo pci device (the first port in the device's I/O space apparently) to communicate with the host, with vendor id 0x80ee, and device id 0xcafe. You can check how the device is configured inside the VirtualBox sources here. This model implements IPC of sorts, which connects host "service" modules with the guest additions. The service modules are briefly mentioned in the Oracle VM VirtualBox Programming Guide and Reference ("7.4 HGCM Service Implementation"), but it is not nearly enough for your purposes. You can see the clipboard service implementation here. The guest addition on Windows is implemented as a system tray application that registers a clipboard listener. The communication with the host jumps through certain hoops, because it opens a device file which implements the IPC, which then in turn communicates with the host through the pseudo-device's port. Most of the code on the guest side eventually is serialized through those two sources in the respective guest kernel: VBoxGuestR0LibHGCMInternal.cpp -> VBoxGuestR0LibGenericRequest.cpp. The former implements the HGCM functions more or less, so if you are capable to reverse engineer it, and reverse engineer the clipboard service implementation, you might be able to get the clipboard integration working. This is all I could find, sorry.


Top
 Profile  
 
 Post subject: Re: VirtualBox: Shared clipboard / drag 'n' drop
PostPosted: Sun Sep 10, 2017 6:09 am 
Offline
Member
Member
User avatar

Joined: Fri Jan 27, 2017 12:15 pm
Posts: 149
Location: Belgium
Ok thanks! It's a lot more complicated than I thought at first glance. Maybe I'll do this later on and not quite now.

_________________
AQUA OS: https://obiwac.wordpress.com/aqua-os/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 510 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group