[vbox-dev] [PATCH RFC] Allow an extension pack to load an HGCM service
Jeff Westfahl
jeff.westfahl at ni.com
Mon Sep 2 21:17:31 GMT 2013
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.
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.
Jeff Westfahl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20130902/e28fae4d/attachment.html>
More information about the vbox-dev
mailing list