[vbox-dev] How to get the current running IMachine instance inside a host service?

Michael Thayer Michael.Thayer at Sun.COM
Mon May 11 02:10:19 PDT 2009


Hello Huihong,

Huihong Luo wrote:
> take an example, the VBoxSharedFolders.dll is a service between guest and host. This dll is running inside the same process as the VirtualBox.exe launching the vm. I just need to find out the current vm this shared dll is being used.
>  
> I couldn't find any method to do this simple thing: where am I?
HGCM services have no built-in mechanism for getting information about
the VM they are running in and such-like.  This is because they were
originally designed to work in things like VBoxBFE, which is a
simplified frontend where the normal VirtualBox APIs are not available.
 What you can do instead is to use the HGCM "host call" functionality to
pass any needed information into the service when it is started.  To see
examples of this, grep for "HostCall" in src/VBox/Main/ConsoleImpl[2].cpp.

If you need to get information or send notifications or whatever while
the service is running, you can also register callbacks ("host service
extensions") with the service.  For an example of this, grep for
"ServiceExtension" in ConsoleImpl2.cpp.

BTW, I haven't forgotten the VbglR3GuestPropWait() issue you mentioned,
but I haven't got round to looking at it yet.  Sorry!

Regards,

Michael
-- 
Sun Microsystems GmbH        Michael Thayer
Werkstrasse 24               VirtualBox engineer
71384 Weinstadt, Germany     mailto:michael.thayer at sun.com

Sitz der Gesellschaft:
Sun Microsystems GmbH, Sonnenallee 1, 85551 Kirchheim-Heimstetten
Amtsgericht Muenchen: HRB 161028
Geschaeftsfuehrer: Thomas Schroeder, Wolfgang Engels, Wolf Frenkel
Vorsitzender des Aufsichtsrates: Martin Haering




More information about the vbox-dev mailing list