[pywin32-checkins] pywin32/com/win32comext/ifilter/src PyIFilter.cpp,1.1,1.2
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2005-01-25 09:47:13
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/ifilter/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27342 Modified Files: PyIFilter.cpp Log Message: Add BindIFilterFromStream Index: PyIFilter.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/ifilter/src/PyIFilter.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PyIFilter.cpp 22 Jun 2004 00:53:56 -0000 1.1 --- PyIFilter.cpp 25 Jan 2005 09:47:00 -0000 1.2 *************** *** 94,100 **** stat.cwcStartSource, stat.cwcLenSource); - - - } --- 94,97 ---- *************** *** 231,234 **** --- 228,260 ---- } + static PyObject *pyBindIFilterFromStream(PyObject *self, PyObject *args) + { + HRESULT hr; + IUnknown *pOb = NULL; + PyObject *obStg; + + PyObject *ret; + long lres = 0; + if (!PyArg_ParseTuple(args, "O:BindIFilterFromStream", &obStg)) + return NULL; + + IStream *pstm; + BOOL bPythonIsHappy = TRUE; + if (!PyCom_InterfaceFromPyObject(obStg, IID_IStream, (void **)&pstm, FALSE /* bNoneOK */)) + bPythonIsHappy = FALSE; + + if (!bPythonIsHappy) + return NULL; + + Py_BEGIN_ALLOW_THREADS; + hr = BindIFilterFromStream( pstm , NULL , (void**)&pOb ); + pstm->Release(); + Py_END_ALLOW_THREADS; + if (FAILED(hr)) + ret = OleSetOleError(hr); + else + ret = PyCom_PyObjectFromIUnknown(pOb, IID_IFilter, FALSE); + return ret; + } static int AddConstant(PyObject *dict, const char *key, long value) *************** *** 275,279 **** { { "LoadIFilter", pyLoadIFilter, 1 }, // @pymeth Init|Description of Init ! { "BindIFilterFromStorage", pyBindIFilterFromStorage, 1 }, // @pymeth Init|Description of Init { NULL } }; --- 301,306 ---- { { "LoadIFilter", pyLoadIFilter, 1 }, // @pymeth Init|Description of Init ! { "BindIFilterFromStorage", pyBindIFilterFromStorage, 1 }, // @pymeth BindIFilterFromStorage| ! { "BindIFilterFromStream", pyBindIFilterFromStream, 1 }, // @pymeth BindIFilterFromStream| { NULL } }; |