MCPcopy Create free account
hub / github.com/mhammond/pywin32 / pythoncom_CoGetInterfaceAndReleaseStream

Function pythoncom_CoGetInterfaceAndReleaseStream

com/win32com/src/PythonCOM.cpp:1152–1176  ·  view source on GitHub ↗

@pymethod |pythoncom|CoGetInterfaceAndReleaseStream|Unmarshals a buffer containing an interface pointer and releases the stream when an interface pointer has been marshaled from another thread to the calling thread.

Source from the content-addressed store, hash-verified

1150
1151// @pymethod <o PyIUnknown>|pythoncom|CoGetInterfaceAndReleaseStream|Unmarshals a buffer containing an interface pointer and releases the stream when an interface pointer has been marshaled from another thread to the calling thread.
1152static PyObject *pythoncom_CoGetInterfaceAndReleaseStream(PyObject *self, PyObject*args)
1153{
1154 PyObject *obStream, *obIID;
1155 if ( !PyArg_ParseTuple(args, "OO:CoGetInterfaceAndReleaseStream",
1156 &obStream, // @pyparm <o PyIStream>|stream||The stream to unmarshal the object from.
1157 &obIID )) // @pyparm <o PyIID>|iid||The IID if the interface to unmarshal.
1158 return NULL;
1159
1160 IID iid;
1161 if (!PyWinObject_AsIID(obIID, &iid))
1162 return NULL;
1163
1164 IStream *pStream;
1165 if (!PyCom_InterfaceFromPyObject(obStream, IID_IStream, (void **)&pStream, FALSE))
1166 return NULL;
1167
1168 IUnknown *pUnk;
1169 PY_INTERFACE_PRECALL;
1170 HRESULT hr = CoGetInterfaceAndReleaseStream(pStream, iid, (void **)&pUnk);
1171 // pStream is released by this call - no need for me to do it!
1172 PY_INTERFACE_POSTCALL;
1173 if (FAILED(hr))
1174 return PyCom_BuildPyException(hr);
1175 return PyCom_PyObjectFromIUnknown(pUnk, iid, /*BOOL bAddRef*/ FALSE);
1176}
1177
1178// @pymethod <o PyIUnknown>|pythoncom|CoCreateFreeThreadedMarshaler|Creates an aggregatable object capable of context-dependent marshaling.
1179static PyObject *pythoncom_CoCreateFreeThreadedMarshaler(PyObject *self, PyObject*args)

Callers

nothing calls this directly

Calls 5

PyWinObject_AsIIDFunction · 0.85
FAILEDFunction · 0.85
PyCom_BuildPyExceptionFunction · 0.85

Tested by

no test coverage detected