[pywin32-checkins] pywin32/com/win32com/src PyStorage.cpp,1.5,1.6 PythonCOM.cpp,1.33,1.34
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Roger U. <ru...@us...> - 2005-01-07 06:55:15
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15917/com/win32com/src Modified Files: PyStorage.cpp PythonCOM.cpp Log Message: Add FmtIdToPropStgName & PropStgNameToFmtId Index: PythonCOM.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PythonCOM.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** PythonCOM.cpp 30 Nov 2004 21:30:27 -0000 1.33 --- PythonCOM.cpp 7 Jan 2005 06:54:56 -0000 1.34 *************** *** 34,37 **** --- 34,40 ---- extern PyObject *pythoncom_StgOpenStorage(PyObject *self, PyObject *args); extern PyObject *pythoncom_StgOpenStorageEx(PyObject *self, PyObject *args); + extern PyObject *pythoncom_FmtIdToPropStgName(PyObject *self, PyObject *args); + extern PyObject *pythoncom_PropStgNameToFmtId(PyObject *self, PyObject *args); + #ifndef MS_WINCE extern PyObject *pythoncom_StgIsStorageFile(PyObject *self, PyObject *args); *************** *** 1582,1585 **** --- 1585,1590 ---- { "UnwrapObject", pythoncom_UnwrapObject, 1 }, // @pymeth UnwrapObject|Unwraps a Python instance in a gateway object. { "Unicode", pythoncom_Unicode, 1 }, // @pymeth Unicode|Converts a string into a <o PyUnicode> object. + { "FmtIdToPropStgName", pythoncom_FmtIdToPropStgName, 1}, //@pymeth FmtIdToPropStgName|Convert a FMTID to its stream name + { "PropStgNameToFmtId", pythoncom_PropStgNameToFmtId, 1}, //@pymeth PropStgNameToFmtId|Convert property set name to FMTID { NULL, NULL } }; Index: PyStorage.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyStorage.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PyStorage.cpp 31 Oct 2003 04:41:00 -0000 1.5 --- PyStorage.cpp 7 Jan 2005 06:54:55 -0000 1.6 *************** *** 210,212 **** --- 210,248 ---- } + // @pymethod <o PyUNICODE>|pythoncom|FmtIdToPropStgName|Converts a FMTID to its stream name + PyObject *pythoncom_FmtIdToPropStgName(PyObject *self, PyObject *args) + { + // @pyparm <o PyIID>|fmtid||Format id - a property storage GUID (FMTID_* IIDs) + HRESULT err; + WCHAR oszName[CCH_MAX_PROPSTG_NAME]; + FMTID fmtid; + PyObject *obfmtid=NULL; + if (!PyArg_ParseTuple(args, "O:FmtIdToPropStgName", &obfmtid)) + return NULL; + if (!PyWinObject_AsIID(obfmtid, &fmtid)) + return NULL; + err=FmtIdToPropStgName(&fmtid, oszName); + if (err!=S_OK) + return PyCom_BuildPyException(err); + return PyWinObject_FromWCHAR(oszName); + } + + // @pymethod <o PyIID>|pythoncom|PropStgNameToFmtId|Converts a property set name to its format id (GUID) + PyObject *pythoncom_PropStgNameToFmtId(PyObject *self, PyObject *args) + { + // @pyparm string/unicode|Name||Storage stream name + FMTID fmtid; + WCHAR *oszName=NULL; + HRESULT err; + PyObject *obName=NULL; + if (!PyArg_ParseTuple(args, "O:PropStgNameToFmtId", &obName)) + return NULL; + if (!PyWinObject_AsWCHAR(obName,&oszName)) + return NULL; + err=PropStgNameToFmtId(oszName,&fmtid); + PyWinObject_FreeWCHAR(oszName); + if (err!=S_OK) + return PyCom_BuildPyException(err); + return PyWinObject_FromIID(fmtid); + } |