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

Function pythoncom_CoMarshalInterface

com/win32com/src/PythonCOM.cpp:1201–1236  ·  view source on GitHub ↗

@pymethod |pythoncom|CoMarshalInterface|Marshals an interface into a stream

Source from the content-addressed store, hash-verified

1199
1200// @pymethod |pythoncom|CoMarshalInterface|Marshals an interface into a stream
1201static PyObject *pythoncom_CoMarshalInterface(PyObject *self, PyObject*args)
1202{
1203 PyObject *obriid, *obIStream, *obUnk, *ret=NULL;
1204 IID riid;
1205 IStream *pIStream=NULL;
1206 IUnknown *pIUnknown=NULL;
1207 void *pvdestctxt=NULL; // reserved
1208 DWORD destctxt, flags=MSHLFLAGS_NORMAL;
1209 if ( !PyArg_ParseTuple(args, "OOOk|k:CoMarshalInterface",
1210 &obIStream, // @pyparm <o PyIStream>|Stm||An IStream interface into which marshalled interface will be written
1211 &obriid, // @pyparm <o PyIID>|riid||IID of interface to be marshalled
1212 &obUnk, // @pyparm <o PyIUnknown>|Unk||Base IUnknown of the object to be marshalled
1213 &destctxt, // @pyparm int|DestContext||MSHCTX_* flag indicating where object will be unmarshalled
1214 &flags)) // @pyparm int|flags|MSHLFLAGS_NORMAL|MSHLFLAGS_* flag indicating marshalling options
1215 return NULL;
1216 if (PyWinObject_AsIID(obriid, &riid)
1217 &&PyCom_InterfaceFromPyObject(obIStream, IID_IStream, (void **)&pIStream, FALSE)
1218 &&PyCom_InterfaceFromPyObject(obUnk, IID_IUnknown, (void **)&pIUnknown, FALSE)){
1219 PY_INTERFACE_PRECALL;
1220 HRESULT hr = CoMarshalInterface(pIStream, riid, pIUnknown, destctxt, pvdestctxt, flags);
1221 PY_INTERFACE_POSTCALL;
1222 if (FAILED(hr))
1223 PyCom_BuildPyException(hr);
1224 else{
1225 Py_INCREF(Py_None);
1226 ret=Py_None;
1227 }
1228 }
1229 PY_INTERFACE_PRECALL;
1230 if (pIUnknown)
1231 pIUnknown->Release();
1232 if (pIStream)
1233 pIStream->Release();
1234 PY_INTERFACE_POSTCALL;
1235 return ret;
1236}
1237
1238// @pymethod interface|pythoncom|CoUnmarshalInterface|Unmarshals an interface
1239static PyObject *pythoncom_CoUnmarshalInterface(PyObject *self, PyObject*args)

Callers

nothing calls this directly

Calls 5

PyWinObject_AsIIDFunction · 0.85
FAILEDFunction · 0.85
PyCom_BuildPyExceptionFunction · 0.85
ReleaseMethod · 0.45

Tested by

no test coverage detected