[vbox-dev] Virtualbox with HGCM and HGSMI c++ tests?

John Chatham JChatham at acuitus.com
Wed Mar 11 18:26:45 UTC 2015

While I don't have any useful advice for direct use of HGCM or HGSMI, I can help you with the communication channel you want.  See: https://forums.virtualbox.org/viewtopic.php?f=10&t=62123#p302284

Or, for a quick summary: it's fairly easy to hack vboxmanage run program in guest to pass stdin to the in-guest process.  You will also need to fix a few bugs in vboxmanage to make it work right; most notably, the default implementation will delete the last character of each buffer's worth of stdout/stderr, can crash if fed non-character data, and (for windows guests), polls in a busy loop.

You can find a patch for the stdin pass-through and the buffer truncation issue here: https://forums.virtualbox.org/viewtopic.php?f=34&t=56700#p277559 but I never uploaded specific patches for the other two problems.  The non-character data issue can be fixed just bypassing the attempt to convert to UTF8 format in ctrlExecPrintOutput, and the busy loop is fixed by a simple usleep(25000) under loop case ProcessWaitResult_WaitFlagNotSupported - at least for my use case, that much delay fixed the processor usage issue, while still allowing plenty of throughput.

More information about the vbox-dev mailing list