I have been struggling with getting pointer parameters to work with the COM interface for VirtualBox. In particular, the IFramebuffer interface. I cannot seem to get the following to give the expected results:
interface IFramebuffer : IDispatch { // snipped to just the interesting definition HRESULT RequestResize ( [in] ULONG aScreenId, [in] ULONG aPixelFormat, [in] BYTE * aVRAM, [in] ULONG aBitsPerPixel, [in] ULONG aBytesPerLine, [in] ULONG aWidth, [in] ULONG aHeight, [out, retval] BOOL * aFinished ); }; The type for aVRAM ends up being (correctly) VT_BYREF | VT_UI1. Unfortunately PyIDispatch (incorrectly) converts the parameter to just VT_UI1. The offending code path is: PyGatewayBase::Invoke() -> invoke_setup() -> PyCom_PyObjectFromVariant() -> VariantCopyInd(). My not so informed understanding is that pythoncom considers all VT_BYREF parameters as out-type parameters whereas, in this case at least, it is not always such. Indeed, in this case, the aVRAM parameter needs to be the *address* not the *value* for an object to implement IFramebuffer properly. Note that the object implementing IFramebuffer is passed as argument to another function much the same way as event listeners. I believe the fix involves PyIDispatch somehow using the type information to determine which parameters are not out-type and then to not dereference those. Any direction with this is greatly appreciated. Jeremy Kloth
_______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32