[vbox-dev] COM interface changes in v5.0 - What it means ?

Alexander Eichner Alexander.Eichner at oracle.com
Sat Apr 4 15:44:36 UTC 2015

Hi Alexey,

These wrapper classes are generated by [0] and automatically creates the boilerplate developers had to implement manually before when adding a new
method to the Main API. It also converts the parameters from COM specific types to much easier to use types. This is to make developers lives
easier. It also allows for automatic generation of logging and dtrace probes for the server side API.
This is only used for the VBoxSVC daemon, the client side (frontends, etc.) remain the same. You can have a look at the generated wrappers, they reside in

Regarding your other questions in the first mail:


It is macro which generates the first part of a API method definition. It depends on the host platform what to emit but basically
it adds the return type (HRESULT) and on Windows adds also __stdcall.

>What is HRESULT?

HRESULT is the type for status codes used in COM. In the old code it is automatically generated by STDMETHODIMP but because
STDMETHODIMP is only used in the wrapper classes and not by the methods implementing the functionality it needs to be added there.

>How did COMGETTER* became get* ?

See above, the COMGETTER is now in the wrapper class of the class implementing the interface and calls the new method.

>What was the meaning of "AutoCaller autoCaller(this);“ ?

See [1], it basically ensures that the VirtualBox base class is ready to use and remains usable while a client calls a method. It is still there but
moved to the generated wrapper class.

>BSTR equals to char* string ? So if Unicode converts to it, only ASCII will work?
>Why BSTR suddenly became com::Utf8Str ?

Answering this two together, strings are converted automatically from BSTR to com::Utf8Str. This was done manually before and cumbersome.
com::Utf8Str is much easier to use. This should also answer your question regarding the use of QT strings. Always use com::Utf8Str [2]

> How old COM code compares to the new one ?

The functionality is the same but the a lot of repeating code was removed making it easier to maintain. It is also easier to generate logging statements
and debugging functionality for the whole API now. Nothing has changed on the client side there.

> And where this magic happens in new ver ? (CheckComArgOutPointerValid(), ...)

Yes, you guessed it. It is done in the wrapper classes now ;)

I hope I got everything correct. I didn’t do the conversion to the new code and my general knowledge about COM is not that detailed. If someone spots a mistake please
correct me.


[0] https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Main/idl/apiwrap-server.xsl
[1] https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Main/include/AutoCaller.h
[2] https://www.virtualbox.org/browser/vbox/trunk/include/VBox/com/string.h

Alexander Eichner | VirtualBox Engineering
ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | 71384 Weinstadt, Germany
Hauptverwaltung: Riesstraße 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603

Komplementärin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Geschäftsführer: Alexander van der Ven, Astrid Kepper, Val Maher

> On 04.04.2015 14:27, Alexey Eromenko <al4321 at gmail.com> wrote:
> Additionally you seem to generate whole bunch of stuff at compile
> time, like this:
> in file: USBControllerImpl.h
> #include "USBControllerWrap.h"
> But file "USBControllerWrap.h" is nowhere to be found... what generates it ?
> On Sat, Apr 4, 2015 at 12:01 AM, Alexey Eromenko <al4321 at gmail.com> wrote:
>> Thanks in advance,
>> --
>> -Alexey Eromenko "Technologov"
> -- 
> -Alexey Eromenko "Technologov"
> _______________________________________________
> vbox-dev mailing list
> vbox-dev at virtualbox.org
> https://www.virtualbox.org/mailman/listinfo/vbox-dev

More information about the vbox-dev mailing list