[vbox-dev] [PATCH RFC] Allow an extension pack to load an HGCM service

Klaus Espenlaub klaus.espenlaub at oracle.com
Thu Sep 5 15:23:13 GMT 2013


Hi Jeff,

On 02.09.2013 23:17, Jeff Westfahl wrote:
> Klaus,
>
>  > Right now I'm scratching my head why you designed this in such a
>  > backwards manner (at least that it feels to me right now, maybe it has
>  > just holes in its functionality which confuses me) - essentially I'm
>  > lacking an understanding how you think the new callback should be used
>  > to implement a HGCM module. A little pseudo code explaining where it is
>  > called (and where it gets its parameters from) should make this far
>  > easier to understand. Also don't forget to hint how such a loaded HGCM
>  > service would be used afterwards. I don't see any way for sending
>  > messages etc etc - please enlighten me :)
>
> I agree that I should have included an example of how this is intended to
> be used.
>
> First, my patch isn't intended to implement an HGCM module, only to
> allow an
> external HGCM module to be loaded by VirtualBox. I haven't (yet)
> implemented
> a useful HGCM module, only a shell to verify that my patch does indeed
> allow
> an external HGCM module to be loaded.

Yes, and I confirmed (never touched HGCM myself so far) that this is all 
which should be necessary. A loaded module will become active once the 
guest initiates a connection. So this should get us somewhere. Might 
need to be extended eventually to get extremely hairy stuff done, but 
let's wait until the problem becomes real.

> Here's a snippet with the pfnVMConfigureVMM callback of my extension pack
> module:
>
>          #define kHGCMServiceName "HGCMShell"
>
>          static int extPack_VMConfigureVMM(PCVBOXEXTPACKREG pThis,
>                IConsole *pConsole, PVM pVM)
>          {
>      int rc;
>      char szPath [RTPATH_MAX];
>
>      rc = gpExtPackHlp->pfnFindModule(gpExtPackHlp, kHGCMServiceName,
>       NULL, VBOXEXTPACKMODKIND_R3,
>       szPath, RTPATH_MAX, NULL);
>      if (RT_FAILURE(rc))
>              return rc;
>
>      rc = gpExtPackHlp->pfnLoadHGCMService(gpExtPackHlp, pConsole,
>            szPath, kHGCMServiceName);
>      if (RT_FAILURE(rc))
>              return rc;
>
>      return VINF_SUCCESS;
>          }
>
> Then you have HGCMShell.dll that is part of the extension pack and
> implements
> VBoxHGCMSvcLoad like any other HGCM service.
>
> That's the basic idea. It seemed to me that the main stumbling block to
> more
> and better HGCM examples is that current HGCM modules have their names and
> loading hard coded in VirtualBox, with no exposed mechanism to load an
> external
> module. I won't claim that this is the only or the best way to
> accomplish that
> goal, but it gets the job done.

I'll try to get this into 4.3.0_BETA2 so you can double check that my 
pretty much complete rewrite didn't totally destroy the intended 
purpose. My change which should allow loading modules from the extension 
pack isn't really tested, but the same code is used for the VRDE module 
(and there are several extpacks out there which use this) so I hope it's 
working.

Klaus

>
> Jeff Westfahl




More information about the vbox-dev mailing list