pywin32-checkins Mailing List for Python for Windows Extensions (Page 5)
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
(6) |
Jul
(50) |
Aug
(11) |
Sep
(24) |
Oct
(184) |
Nov
(118) |
Dec
(22) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(31) |
Feb
(25) |
Mar
(34) |
Apr
(105) |
May
(49) |
Jun
(38) |
Jul
(39) |
Aug
(7) |
Sep
(98) |
Oct
(79) |
Nov
(20) |
Dec
(17) |
2005 |
Jan
(66) |
Feb
(32) |
Mar
(43) |
Apr
(30) |
May
(58) |
Jun
(30) |
Jul
(16) |
Aug
(4) |
Sep
(21) |
Oct
(42) |
Nov
(11) |
Dec
(14) |
2006 |
Jan
(42) |
Feb
(30) |
Mar
(22) |
Apr
(1) |
May
(9) |
Jun
(15) |
Jul
(20) |
Aug
(9) |
Sep
(8) |
Oct
(1) |
Nov
(9) |
Dec
(43) |
2007 |
Jan
(52) |
Feb
(45) |
Mar
(20) |
Apr
(12) |
May
(59) |
Jun
(39) |
Jul
(35) |
Aug
(31) |
Sep
(17) |
Oct
(20) |
Nov
(4) |
Dec
(4) |
2008 |
Jan
(28) |
Feb
(111) |
Mar
(4) |
Apr
(27) |
May
(40) |
Jun
(27) |
Jul
(32) |
Aug
(94) |
Sep
(87) |
Oct
(153) |
Nov
(336) |
Dec
(331) |
2009 |
Jan
(298) |
Feb
(127) |
Mar
(20) |
Apr
(8) |
May
|
Jun
(10) |
Jul
(6) |
Aug
|
Sep
(2) |
Oct
(2) |
Nov
|
Dec
(1) |
2010 |
Jan
(7) |
Feb
(1) |
Mar
|
Apr
|
May
(15) |
Jun
(4) |
Jul
(3) |
Aug
(28) |
Sep
(1) |
Oct
(19) |
Nov
(16) |
Dec
(6) |
2011 |
Jan
(2) |
Feb
(18) |
Mar
(17) |
Apr
(12) |
May
(5) |
Jun
(11) |
Jul
(7) |
Aug
(2) |
Sep
(2) |
Oct
(4) |
Nov
(4) |
Dec
|
2012 |
Jan
(6) |
Feb
(2) |
Mar
|
Apr
(8) |
May
(4) |
Jun
(3) |
Jul
(13) |
Aug
(27) |
Sep
(8) |
Oct
(9) |
Nov
(3) |
Dec
(2) |
2013 |
Jan
|
Feb
(1) |
Mar
(5) |
Apr
(10) |
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(9) |
2014 |
Jan
(2) |
Feb
(4) |
Mar
(4) |
Apr
(1) |
May
(4) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(1) |
2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
(6) |
May
(2) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
(3) |
Feb
(2) |
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: <pyw...@li...> - 2012-08-20 06:28:21
|
changeset 54ec13f605a5 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=54ec13f605a5 summary: Fix a couple of places where BSTR used for WCHAR, and fix error cleanup logic diffstat: com/win32comext/shell/src/PyIShellFolder.cpp | 97 +++++++++++++-------------- 1 files changed, 47 insertions(+), 50 deletions(-) diffs (169 lines): diff -r 757d893bb5c0 -r 54ec13f605a5 com/win32comext/shell/src/PyIShellFolder.cpp --- a/com/win32comext/shell/src/PyIShellFolder.cpp Sun Aug 19 23:18:55 2012 -0400 +++ b/com/win32comext/shell/src/PyIShellFolder.cpp Mon Aug 20 02:23:41 2012 -0400 @@ -36,36 +36,34 @@ return NULL; // @pyparm <o PyHANDLE>|hwndOwner||Window in which to display any dialogs or message boxes, can be 0 // @pyparm <o PyIBindCtx>|pbc||Bind context that affects how parsing is performed, can be None - // @pyparm <o PyUNICODE>|DisplayName||Display name to parse, format is dependent on the shell folder. + // @pyparm str|DisplayName||Display name to parse, format is dependent on the shell folder. // Desktop folder will accept a file path, as well as guids of the form ::{guid} // Example: '::%s\\::%s' %(shell.CLSID_MyComputer,shell.CLSID_ControlPanel) // @pyparm int|Attributes|0|Combination of shellcon.SFGAO_* constants specifying which attributes should be returned - PyObject *obpbcReserved; - PyObject *oblpszDisplayName; + PyObject *obpbc; + PyObject *obDisplayName; HWND hwndOwner; PyObject *obhwndOwner; - IBindCtx * pbcReserved; - LPOLESTR lpszDisplayName; + IBindCtx * pbc; + TmpWCHAR DisplayName; ULONG pchEaten = (ULONG)-1; ITEMIDLIST *ppidl; - ULONG pdwAttributes = 0; - if ( !PyArg_ParseTuple(args, "OOO|k:ParseDisplayName", &obhwndOwner, &obpbcReserved, - &oblpszDisplayName, &pdwAttributes) ) + ULONG dwAttributes = 0; + if ( !PyArg_ParseTuple(args, "OOO|k:ParseDisplayName", &obhwndOwner, &obpbc, + &obDisplayName, &dwAttributes) ) return NULL; if (!PyWinObject_AsHANDLE(obhwndOwner, (HANDLE *)&hwndOwner)) return NULL; - BOOL bPythonIsHappy = TRUE; - if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpbcReserved, IID_IBindCtx, (void **)&pbcReserved, TRUE /* bNoneOK */)) - bPythonIsHappy = FALSE; - if (bPythonIsHappy && !PyWinObject_AsBstr(oblpszDisplayName, &lpszDisplayName)) bPythonIsHappy = FALSE; - if (!bPythonIsHappy) return NULL; + if (!PyWinObject_AsWCHAR(obDisplayName, &DisplayName)) + return NULL; + if (!PyCom_InterfaceFromPyInstanceOrObject(obpbc, IID_IBindCtx, (void **)&pbc, TRUE /* bNoneOK */)) + return NULL; + HRESULT hr; PY_INTERFACE_PRECALL; - hr = pISF->ParseDisplayName(hwndOwner, pbcReserved, lpszDisplayName, &pchEaten, - &ppidl, &pdwAttributes ); - if (pbcReserved) pbcReserved->Release(); - SysFreeString(lpszDisplayName); - + hr = pISF->ParseDisplayName(hwndOwner, pbc, DisplayName, &pchEaten, + &ppidl, &dwAttributes ); + if (pbc) pbc->Release(); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) @@ -73,7 +71,7 @@ PyObject *obppidl; obppidl = PyObject_FromPIDL(ppidl, TRUE); - PyObject *pyretval = Py_BuildValue("lOl", pchEaten, obppidl, pdwAttributes); + PyObject *pyretval = Py_BuildValue("lOl", pchEaten, obppidl, dwAttributes); Py_XDECREF(obppidl); return pyretval; } @@ -125,12 +123,15 @@ void * out; if ( !PyArg_ParseTuple(args, "OOO:BindToObject", &obpidl, &obpbcReserved, &obriid) ) return NULL; - BOOL bPythonIsHappy = TRUE; - if (bPythonIsHappy && !PyObject_AsPIDL(obpidl, &pidl)) bPythonIsHappy = FALSE; - if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpbcReserved, IID_IBindCtx, (void **)&pbcReserved, TRUE /* bNoneOK */)) - bPythonIsHappy = FALSE; - if (!PyWinObject_AsIID(obriid, &riid)) bPythonIsHappy = FALSE; - if (!bPythonIsHappy) return NULL; // this could leak the pidl + if (!PyWinObject_AsIID(obriid, &riid)) + return NULL; + if (!PyObject_AsPIDL(obpidl, &pidl)) + return NULL; + if (!PyCom_InterfaceFromPyInstanceOrObject(obpbcReserved, IID_IBindCtx, (void **)&pbcReserved, TRUE /* bNoneOK */)){ + PyObject_FreePIDL(pidl); + return NULL; + } + HRESULT hr; PY_INTERFACE_PRECALL; hr = pISF->BindToObject( pidl, pbcReserved, riid, &out ); @@ -250,9 +251,8 @@ return NULL; if (!PyWinObject_AsHANDLE(obhwndOwner, (HANDLE *)&hwndOwner)) return NULL; - BOOL bPythonIsHappy = TRUE; - if (!PyWinObject_AsIID(obriid, &riid)) bPythonIsHappy = FALSE; - if (!bPythonIsHappy) return NULL; + if (!PyWinObject_AsIID(obriid, &riid)) + return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISF->CreateViewObject( hwndOwner, riid, &out ); @@ -280,9 +280,9 @@ ULONG rgfInOut; if ( !PyArg_ParseTuple(args, "Ol:GetAttributesOf", &obpidl, &rgfInOut) ) return NULL; - BOOL bPythonIsHappy = TRUE; - if (bPythonIsHappy && !PyObject_AsPIDLArray(obpidl, &cidl, &pidl)) bPythonIsHappy = FALSE; - if (!bPythonIsHappy) return NULL; + + if (!PyObject_AsPIDLArray(obpidl, &cidl, &pidl)) + return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISF->GetAttributesOf( cidl, pidl, &rgfInOut ); @@ -383,40 +383,37 @@ return NULL; // @pyparm HWND|hwndOwner||Window in which to display any message boxes or dialogs, can be 0 // @pyparm <o PyIDL>|pidl||PIDL that identifies the item relative to the parent folder - // @pyparm <o unicode>|lpszName||New name for the item + // @pyparm str|Name||New name for the item // @pyparm int|Flags||Combination of shellcon.SHGDM_* values PyObject *obpidl=NULL, *ret=NULL; - PyObject *oblpszName=NULL; + PyObject *obName=NULL; PyObject *obhwndOwner; HWND hwndOwner; ITEMIDLIST *pidl=NULL; ITEMIDLIST *pidlRet = NULL; - LPOLESTR lpszName=NULL; + TmpWCHAR Name; DWORD flags; - if ( !PyArg_ParseTuple(args, "OOOl:SetNameOf", &obhwndOwner, &obpidl, &oblpszName, &flags) ) + if ( !PyArg_ParseTuple(args, "OOOl:SetNameOf", &obhwndOwner, &obpidl, &obName, &flags) ) return NULL; if (!PyWinObject_AsHANDLE(obhwndOwner, (HANDLE *)&hwndOwner)) return NULL; + if (!PyWinObject_AsWCHAR(obName, &Name)) + return NULL; + if (!PyObject_AsPIDL(obpidl, &pidl)) + return NULL; - if (PyObject_AsPIDL(obpidl, &pidl)&& - PyWinObject_AsBstr(oblpszName, &lpszName)){ - HRESULT hr; - PY_INTERFACE_PRECALL; - hr = pISF->SetNameOf( hwndOwner, pidl, lpszName, (SHGDNF)flags, &pidlRet ); - PY_INTERFACE_POSTCALL; - if ( FAILED(hr) ) - PyCom_BuildPyException(hr, pISF, IID_IShellFolder ); - else - ret = PyObject_FromPIDL(pidlRet, TRUE); - } - + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = pISF->SetNameOf( hwndOwner, pidl, Name, (SHGDNF)flags, &pidlRet ); + PY_INTERFACE_POSTCALL; PyObject_FreePIDL(pidl); - SysFreeString(lpszName); - return ret; + if ( FAILED(hr) ) + return PyCom_BuildPyException(hr, pISF, IID_IShellFolder ); + return PyObject_FromPIDL(pidlRet, TRUE); } -// @object PyIShellFolder|Description of the interface +// @object PyIShellFolder|Interface that represents an Explorer folder static struct PyMethodDef PyIShellFolder_methods[] = { { "ParseDisplayName", PyIShellFolder::ParseDisplayName, 1 }, // @pymeth ParseDisplayName|Returns the PIDL of an item in a shell folder |
From: <pyw...@li...> - 2012-08-20 03:27:08
|
changeset 757d893bb5c0 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=757d893bb5c0 summary: Allow PyIStorage to be iterated; Don't use BSTR for WCHAR parameters diffstat: com/win32com/src/extensions/PyIEnumSTATSTG.cpp | 4 +- com/win32com/src/extensions/PyIStorage.cpp | 206 ++++++++++-------------- com/win32com/src/include/PyIStorage.h | 2 +- com/win32com/storagecon.py | 5 + 4 files changed, 93 insertions(+), 124 deletions(-) diffs (truncated from 445 to 300 lines): diff -r f48937c1d707 -r 757d893bb5c0 com/win32com/src/extensions/PyIEnumSTATSTG.cpp --- a/com/win32com/src/extensions/PyIEnumSTATSTG.cpp Sun Aug 19 12:55:25 2012 -0400 +++ b/com/win32com/src/extensions/PyIEnumSTATSTG.cpp Sun Aug 19 23:18:55 2012 -0400 @@ -27,7 +27,7 @@ return (IEnumSTATSTG *)PyIUnknown::GetI(self); } -// @pymethod object|PyIEnumSTATSTG|Next|Retrieves a specified number of items in the enumeration sequence. +// @pymethod (<o STATSTG>, ...)|PyIEnumSTATSTG|Next|Retrieves a specified number of items in the enumeration sequence. PyObject *PyIEnumSTATSTG::Next(PyObject *self, PyObject *args) { long celt = 1; @@ -139,7 +139,7 @@ return PyCom_PyObjectFromIUnknown(pClone, IID_IEnumSTATSTG, FALSE); } -// @object PyIEnumSTATSTG|A Python interface to IEnumVARIANT +// @object PyIEnumSTATSTG|An enumerator for elements contained in a <o PyIStorage> object static struct PyMethodDef PyIEnumSTATSTG_methods[] = { { "Next", PyIEnumSTATSTG::Next, 1 }, // @pymeth Next|Retrieves a specified number of items in the enumeration sequence. diff -r f48937c1d707 -r 757d893bb5c0 com/win32com/src/extensions/PyIStorage.cpp --- a/com/win32com/src/extensions/PyIStorage.cpp Sun Aug 19 12:55:25 2012 -0400 +++ b/com/win32com/src/extensions/PyIStorage.cpp Sun Aug 19 23:18:55 2012 -0400 @@ -33,8 +33,8 @@ IStorage *pIS = GetI(self); if ( pIS == NULL ) return NULL; - // @pyparm string|pwcsName||Name of the new stream - // @pyparm int|grfMode||Specifies the access mode to use when opening the newly created stream. + // @pyparm str|Name||Name of the new stream + // @pyparm int|Mode||Access mode, storagecon.STGM_* // @pyparm int|reserved1|0|Reserved - must be zero. // @pyparm int|reserved2|0|Reserved - must be zero. DWORD grfMode; @@ -44,13 +44,12 @@ if ( !PyArg_ParseTuple(args, "Oi|ii:CreateStream", &obName, &grfMode, &reserved1, &reserved2) ) return NULL; IStream *ppstm; - BOOL bPythonIsHappy = TRUE; - BSTR bstrName; - bPythonIsHappy = PyWinObject_AsBstr(obName, &bstrName); - if (!bPythonIsHappy) return NULL; + TmpWCHAR Name; + if (!PyWinObject_AsWCHAR(obName, &Name)) + return NULL; + PY_INTERFACE_PRECALL; - HRESULT hr = pIS->CreateStream( bstrName, grfMode, reserved1, reserved2, &ppstm ); - PyWinObject_FreeBstr(bstrName); + HRESULT hr = pIS->CreateStream(Name, grfMode, reserved1, reserved2, &ppstm ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIS, IID_IStorage); @@ -64,9 +63,9 @@ IStorage *pIS = GetI(self); if ( pIS == NULL ) return NULL; - // @pyparm string|pwcsName||Description for pwcsName + // @pyparm str|Name||Name of stream to be opened // @pyparm object|reserved1||A reserved param. Always pass None. NULL is always passed to the COM function - // @pyparm int|grfMode||Specifies the access mode to be assigned to the open stream. See the STGM enumeration values for descriptions of the possible values. . Whatever other modes you may choose, you must at least specify STGM_SHARE_EXCLUSIVE when calling this method. + // @pyparm int|Mode||Access mode, storagecon.STGM_* // @pyparm int|reserved2|0|Reserved - must be zero. PyObject *obName; DWORD grfMode; @@ -78,19 +77,17 @@ PyErr_SetString(PyExc_TypeError, "The 'reserved' parameter (param 2) must be None"); return NULL; } - IStream *ppstm; - BOOL bPythonIsHappy = TRUE; - BSTR name; - bPythonIsHappy = PyWinObject_AsBstr(obName, &name); - if (!bPythonIsHappy) return NULL; + IStream *pstm; + TmpWCHAR name; + if (!PyWinObject_AsWCHAR(obName, &name)) + return NULL; + PY_INTERFACE_PRECALL; - HRESULT hr = pIS->OpenStream( name, NULL, grfMode, reserved2, &ppstm ); - PyWinObject_FreeBstr(name); + HRESULT hr = pIS->OpenStream( name, NULL, grfMode, reserved2, &pstm ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIS, IID_IStorage); - - return PyCom_PyObjectFromIUnknown(ppstm, IID_IStream, FALSE); + return PyCom_PyObjectFromIUnknown(pstm, IID_IStream, FALSE); } // @pymethod <o PyIStorage>|PyIStorage|CreateStorage|Creates and opens a new storage object nested within this storage object. @@ -99,9 +96,9 @@ IStorage *pIS = GetI(self); if ( pIS == NULL ) return NULL; - // @pyparm string|pwcsName||The name of the newly created stream. - // @pyparm int|grfMode||Specifies the access mode to use when opening the newly created storage object. - // @pyparm int|dwStgFmt||Documented as "reserved"! + // @pyparm str|Name||The name of the newly created stream. + // @pyparm int|Mode||Access mode - combination of storagecon.STGM_* flags + // @pyparm int|StgFmt||Documented as "reserved"! // @pyparm int|reserved2|0|Description for reserved2 PyObject *obName; DWORD grfMode; @@ -109,19 +106,17 @@ DWORD reserved2 = 0; if ( !PyArg_ParseTuple(args, "Oii|i:CreateStorage", &obName, &grfMode, &dwStgFmt, &reserved2) ) return NULL; - IStorage *ppstg; - BOOL bPythonIsHappy = TRUE; - BSTR name; - bPythonIsHappy = PyWinObject_AsBstr(obName, &name); - if (!bPythonIsHappy) return NULL; + IStorage *pstg; + TmpWCHAR name; + if (!PyWinObject_AsWCHAR(obName, &name)) + return NULL; + PY_INTERFACE_PRECALL; - HRESULT hr = pIS->CreateStorage( name, grfMode, dwStgFmt, reserved2, &ppstg ); + HRESULT hr = pIS->CreateStorage( name, grfMode, dwStgFmt, reserved2, &pstg ); PY_INTERFACE_POSTCALL; - PyWinObject_FreeBstr(name); if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIS, IID_IStorage); - - return PyCom_PyObjectFromIUnknown(ppstg, IID_IStorage, FALSE); + return PyCom_PyObjectFromIUnknown(pstg, IID_IStorage, FALSE); } // @pymethod <o PyIStorage>|PyIStorage|OpenStorage|Opens an existing storage object with the specified name in the specified access mode. @@ -130,12 +125,12 @@ IStorage *pIS = GetI(self); if ( pIS == NULL ) return NULL; - // @pyparm string|pwcsName||Name of the storage, or None. - // @pyparm <o PyIStorage>|pstgPriority||If the pstgPriority parameter is not None, it is a <o PyIStorage> object to a previous opening of an element of the storage object, + // @pyparm str|Name||Name of the storage, or None. + // @pyparm <o PyIStorage>|Priority||If the pstgPriority parameter is not None, it is a <o PyIStorage> object to a previous opening of an element of the storage object, // usually one that was opened in priority mode. The storage object should be closed and re-opened // according to grfMode. When the <om PyIStorage.OpenStorage> method returns, pstgPriority is no longer valid - use the result value. // If the pstgPriority parameter is None, it is ignored. - // @pyparm int|grfMode||Specifies the access mode to use when opening the storage object. See the STGM enumeration values for descriptions of the possible values. Whatever other modes you may choose, you must at least specify STGM_SHARE_EXCLUSIVE when calling this method. + // @pyparm int|Mode||Access mode - combination of storagecon.STGM_* flags (must include STGM_SHARE_EXCLUSIVE) // @pyparm <o SNB>|snbExclude||Reserved for later - Must be None // @pyparm int|reserved|0|Reserved integer param. PyObject *obName; @@ -146,23 +141,22 @@ if ( !PyArg_ParseTuple(args, "OOi|zi:OpenStorage", &obName, &obpstgPriority, &grfMode, &temp, &reserved) ) return NULL; IStorage *pstgPriority; - IStorage *ppstg; - BOOL bPythonIsHappy = TRUE; - BSTR bstrName; - bPythonIsHappy = PyWinObject_AsBstr(obName, &bstrName, TRUE); + IStorage *pstg; + TmpWCHAR Name; + if (!PyWinObject_AsWCHAR(obName, &Name, TRUE)) + return NULL; if (!PyCom_InterfaceFromPyObject(obpstgPriority, IID_IStorage, (void **)&pstgPriority, TRUE /* bNoneOK */)) - bPythonIsHappy = FALSE; - if (!bPythonIsHappy) return NULL; + return NULL; + PY_INTERFACE_PRECALL; - HRESULT hr = pIS->OpenStorage( bstrName, pstgPriority, grfMode, NULL, reserved, &ppstg ); + HRESULT hr = pIS->OpenStorage(Name, pstgPriority, grfMode, NULL, reserved, &pstg ); if ( pstgPriority != NULL ) pstgPriority->Release(); - PyWinObject_FreeBstr(bstrName); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIS, IID_IStorage); - return PyCom_PyObjectFromIUnknown(ppstg, IID_IStorage, FALSE); + return PyCom_PyObjectFromIUnknown(pstg, IID_IStorage, FALSE); } // @pymethod |PyIStorage|CopyTo|Copies the entire contents of an open storage object to another storage object. @@ -171,56 +165,35 @@ IStorage *pIS = GetI(self); if ( pIS == NULL ) return NULL; - // @pyparm [<o PyIID>,]|rgiidExclude||List of IID's to be excluded. + // @pyparm [<o PyIID>,]|rgiidExclude||List of IID's to be excluded. Use empty seq to exclude all objects, or None to indicate no excludes. // @pyparm <o SNB>|snbExclude||Reserved for later - Must be None // @pyparm <o PyIStorage>|stgDest||The open storage object into which this storage object is to be copied. // The destination storage object can be a different implementation of the <o PyIStorage> interface from the source storage object. // Thus, <om IStorage::CopyTo> can only use publicly available methods of the destination storage object. // If stgDest is open in transacted mode, it can be reverted by calling its <om PyIStorage::Revert> method. - DWORD ciidExclude = 0; PyObject *obSeqExclude; PyObject *obpstgDest; char *temp; if ( !PyArg_ParseTuple(args, "OzO:CopyTo", &obSeqExclude, &temp, &obpstgDest) ) return NULL; - IID *pExclude; - if (obSeqExclude==Py_None) - pExclude = NULL; - else { - if (!PySequence_Check(obSeqExclude)) { - PyErr_SetString(PyExc_TypeError, "Argument 1 must be a sequence of IID's, or None"); + DWORD ciidExclude = 0; + IID *pExclude = NULL; + if (obSeqExclude != Py_None) + if (!SeqToVector(obSeqExclude, &pExclude, &ciidExclude, PyWinObject_AsIID)) return NULL; - } - ciidExclude = PySequence_Length(obSeqExclude); - pExclude = new IID[ciidExclude]; - if (pExclude==NULL) { - PyErr_SetString(PyExc_MemoryError, "Allocating array of IID's"); - return NULL; - } - for (DWORD i=0;i<ciidExclude;i++) { - PyObject *ob = PySequence_GetItem(obSeqExclude, (int)i); - BOOL ok = PyWinObject_AsIID(ob, pExclude+i); - Py_XDECREF(ob); - if (!ok) { - delete [] pExclude; - return NULL; - } - } + IStorage *pstgDest; + if (!PyCom_InterfaceFromPyObject(obpstgDest, IID_IStorage, (void **)&pstgDest, FALSE /* bNoneOK */)){ + if (pExclude) + CoTaskMemFree(pExclude); + return NULL; } - IStorage *pstgDest; - BOOL bPythonIsHappy = TRUE; - if (!PyCom_InterfaceFromPyObject(obpstgDest, IID_IStorage, (void **)&pstgDest, FALSE /* bNoneOK */)) - bPythonIsHappy = FALSE; - if (!bPythonIsHappy) { - return NULL; - delete [] pExclude; - } + PY_INTERFACE_PRECALL; HRESULT hr = pIS->CopyTo( ciidExclude, pExclude, NULL, pstgDest ); - delete [] pExclude; pstgDest->Release(); PY_INTERFACE_POSTCALL; - + if (pExclude) + CoTaskMemFree(pExclude); if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIS, IID_IStorage); Py_INCREF(Py_None); @@ -233,35 +206,32 @@ IStorage *pIS = GetI(self); if ( pIS == NULL ) return NULL; - // @pyparm string|name||A string that contains the name of the element in this storage object to be moved or copied. + // @pyparm str|Name||A string that contains the name of the element in this storage object to be moved or copied. // @pyparm <o PyIStorage>|stgDest||<o PyIStorage> for the destination storage object. - // @pyparm string|newName||A string that contains the new name for the element in its new storage object. - // @pyparm int|grfFlags||Specifies whether the operation should be a move (STGMOVE_MOVE) or a copy (STGMOVE_COPY). See the STGMOVE enumeration. + // @pyparm str|NewName||A string that contains the new name for the element in its new storage object. + // @pyparm int|Flags||Specifies whether to move or copy (storagecon.STGMOVE_MOVE or STGMOVE_COPY) PyObject *obName, *obNewName; PyObject *obpstgDest; DWORD grfFlags; if ( !PyArg_ParseTuple(args, "OOOi:MoveElementTo", &obName, &obpstgDest, &obNewName, &grfFlags) ) return NULL; IStorage *pstgDest; - BOOL bPythonIsHappy = TRUE; - BSTR bstrName, bstrNewName; - bPythonIsHappy = PyWinObject_AsBstr(obName, &bstrName); - if (!PyWinObject_AsBstr(obNewName, &bstrNewName)) - bPythonIsHappy = FALSE; + TmpWCHAR Name, NewName; + if (!PyWinObject_AsWCHAR(obName, &Name)) + return NULL; + if (!PyWinObject_AsWCHAR(obNewName, &NewName)) + return NULL; if (!PyCom_InterfaceFromPyObject(obpstgDest, IID_IStorage, (void **)&pstgDest, FALSE /* bNoneOK */)) - bPythonIsHappy = FALSE; - if (!bPythonIsHappy) return NULL; + return NULL; PY_INTERFACE_PRECALL; - HRESULT hr = pIS->MoveElementTo( bstrName, pstgDest, bstrNewName, grfFlags ); + HRESULT hr = pIS->MoveElementTo(Name, pstgDest, NewName, grfFlags ); pstgDest->Release(); PY_INTERFACE_POSTCALL; - PyWinObject_FreeBstr(bstrName); - PyWinObject_FreeBstr(bstrNewName); + if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIS, IID_IStorage); Py_INCREF(Py_None); return Py_None; - } // @pymethod |PyIStorage|Commit|Ensures that any changes made to a storage object open in transacted mode are reflected in the parent storage; @@ -338,19 +308,16 @@ PyObject *obName; |
From: <pyw...@li...> - 2012-08-19 16:56:17
|
changeset f48937c1d707 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=f48937c1d707 summary: Add recent changes diffstat: CHANGES.txt | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diffs (22 lines): diff -r 158fa5384a45 -r f48937c1d707 CHANGES.txt --- a/CHANGES.txt Sat Aug 18 22:08:05 2012 -0400 +++ b/CHANGES.txt Sun Aug 19 12:55:25 2012 -0400 @@ -30,10 +30,17 @@ * Python 3.3 version is built with VS2010. -* win32com.shell - IShellItem2 added +* win32com.shell - added function SHCreateStreamOnFileEx and + interfaces IShellItem2, IEnumShellItems * win32com.propsys - Many Property System interfaces and functions added +* pythoncom - added StgCreateStorageEx + +* win32com.client - + Fix iteration of objects that don't declare an enumerator in their typelib + Validate syntax of constants written to makepy generated files + Since build 216: ---------------- * ISAPI extension works with Python 3.x |
From: <pyw...@li...> - 2012-08-19 02:11:26
|
changeset 158fa5384a45 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=158fa5384a45 summary: Add StgCreateStorageEx, convert StgOpenStorageEx to keyword args diffstat: com/win32com/src/PyStorage.cpp | 105 ++++++++++++++++++++++++++++++++-------- com/win32com/src/PythonCOM.cpp | 6 +- 2 files changed, 86 insertions(+), 25 deletions(-) diffs (159 lines): diff -r 93262002f506 -r 158fa5384a45 com/win32com/src/PyStorage.cpp --- a/com/win32com/src/PyStorage.cpp Sat Aug 18 12:54:34 2012 -0400 +++ b/com/win32com/src/PyStorage.cpp Sat Aug 18 22:08:05 2012 -0400 @@ -244,7 +244,9 @@ } // @pymethod <o PyIStorage>|pythoncom|StgOpenStorageEx|Advanced version of StgOpenStorage, win2k or better -PyObject *pythoncom_StgOpenStorageEx(PyObject *self, PyObject *args) +// @comm Requires Win2k or later +// @comm Accepts keyword args +PyObject *pythoncom_StgOpenStorageEx(PyObject *self, PyObject *args, PyObject *kwargs) { #ifndef NO_PYCOM_STGOPENSTORAGEEX typedef HRESULT (WINAPI *PFNStgOpenStorageEx)(WCHAR *, DWORD, DWORD, DWORD, @@ -262,42 +264,99 @@ } if (myStgOpenStorageEx == (PFNStgOpenStorageEx)-1) return PyErr_Format(PyExc_NotImplementedError,"StgOpenStorageEx not supported by this version of Windows"); - PyObject *obfname=NULL, *obriid=NULL, *obstgoptions=NULL; - WCHAR *fname; - DWORD mode=0, attrs=0; + PyObject *obfname, *obstgoptions=Py_None; + TmpWCHAR fname; + DWORD mode, attrs, stgfmt; VOID *reserved=NULL; - DWORD stgfmt; IID riid; STGOPTIONS *pstgoptions=NULL; - HRESULT err; - void *intptr; - if (!PyArg_ParseTuple(args, "OiiiO|O:StgOpenStorageEx", - &obfname, //@pyparm string|name||Name of the stream or file to open - &mode, // @pyparm int|grfmode||open flags + HRESULT hr; + void *ret; + + static char *keywords[] = {"Name", "Mode", "stgfmt", "Attrs", "riid", "StgOptions", NULL}; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiiiO&|O:StgOpenStorageEx", keywords, + &obfname, //@pyparm string|Name||Name of the stream or file to open + &mode, // @pyparm int|Mode||Access mode, combination of storagecon.STGM_* flags &stgfmt, // @pyparm int|stgfmt||Storage format (STGFMT_STORAGE,STGFMT_FILE,STGFMT_ANY, or STGFMT_DOCFILE) - &attrs, // @pyparm int|grfAttrs||Reserved, must be 0 - &obriid, // @pyparm IID|riid||Interface id to return, IStorage or IPropertySetStorage - &obstgoptions)) //@pyparm <o dict>|pStgOptions||Dictionary representing STGOPTIONS struct (only used with STGFMT_DOCFILE) + &attrs, // @pyparm int|Attrs||File flags and attributes, only used with STGFMT_DOCFILE + PyWinObject_AsIID, &riid, // @pyparm <o PyIID>|riid||Interface id to return, IStorage or IPropertySetStorage + &obstgoptions)) //@pyparm dict|StgOptions|None|Dictionary representing STGOPTIONS struct (only used with STGFMT_DOCFILE) return NULL; - if (!PyWinObject_AsIID(obriid, &riid)) + if (!PyWinObject_AsWCHAR(obfname, &fname)) return NULL; if(!PyCom_PyObjectAsSTGOPTIONS(obstgoptions, &pstgoptions)) return NULL; - if (!PyWinObject_AsWCHAR(obfname,&fname)) + + PY_INTERFACE_PRECALL; + hr = (*myStgOpenStorageEx)(fname, mode, stgfmt, attrs, pstgoptions, reserved, riid, &ret); + PY_INTERFACE_POSTCALL; + if (pstgoptions) + delete(pstgoptions); + if (FAILED(hr)) + return PyCom_BuildPyException(hr); + return PyCom_PyObjectFromIUnknown((IUnknown *)ret, riid, FALSE); +#else + return PyErr_Format(PyExc_NotImplementedError,"StgOpenStorageEx not supported by this version of Windows"); +#endif // NO_PYCOM_STGOPENSTORAGEEX +} + +// @pymethod <o PyIStorage>|pythoncom|StgCreateStorageEx|Creates a new structured storage file or property set +// @comm Requires Win2k or later +// @comm Accepts keyword args +PyObject *pythoncom_StgCreateStorageEx(PyObject *self, PyObject *args, PyObject *kwargs) +{ + // MSDN mistakenly shows the security descriptor as PSECURITY_DESCRIPTOR * + typedef HRESULT (WINAPI *PFNStgCreateStorageEx)(WCHAR *, DWORD, DWORD, DWORD, + STGOPTIONS *, PSECURITY_DESCRIPTOR, REFIID, void **); + static PFNStgCreateStorageEx myStgCreateStorageEx = NULL; + if (myStgCreateStorageEx==NULL) { // Haven't tried to fetch it yet. + myStgCreateStorageEx = (PFNStgCreateStorageEx)-1; + if (ole32==NULL) + ole32=GetModuleHandle(_T("Ole32.dll")); + if (ole32!=NULL){ + FARPROC fp = GetProcAddress(ole32,"StgCreateStorageEx"); + if (fp!=NULL) + myStgCreateStorageEx=(PFNStgCreateStorageEx)fp; + } + } + if (myStgCreateStorageEx == (PFNStgCreateStorageEx)-1) + return PyErr_Format(PyExc_NotImplementedError,"StgCreateStorageEx not supported by this version of Windows"); + + PyObject *obfname, *obstgoptions=Py_None, *obsd=Py_None; + TmpWCHAR fname; + DWORD mode, attrs, stgfmt; + IID riid; + STGOPTIONS *pstgoptions=NULL; + PSECURITY_DESCRIPTOR psd=NULL; + HRESULT hr; + void *ret; + static char *keywords[] = {"Name", "Mode", "stgfmt", "Attrs", "riid", "StgOptions", "SecurityDescriptor", NULL}; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiiiO&|OO:StgCreateStorageEx", keywords, + &obfname, //@pyparm string|Name||Name of the stream or file to open + &mode, // @pyparm int|Mode||Access mode, combination of storagecon.STGM_* flags + &stgfmt, // @pyparm int|stgfmt||Storage format, storagecon.STGFMT_* + &attrs, // @pyparm int|Attrs||File flags and attributes, only used with STGFMT_DOCFILE + PyWinObject_AsIID, &riid, // @pyparm <o PyIID>|riid||Interface id to return, IStorage or IPropertySetStorage + &obstgoptions, //@pyparm dict|StgOptions|None|Dictionary representing STGOPTIONS struct (only used with STGFMT_DOCFILE) + &obsd)) // @pyparm <o PySECURITY_DESCRIPTOR>|SecurityDescriptor|None|Specifies security for the new file. Must be None on Windows XP. + return NULL; + + if (!PyWinObject_AsSECURITY_DESCRIPTOR(obsd, &psd, TRUE)) + return NULL; + if (!PyWinObject_AsWCHAR(obfname, &fname, TRUE)) + return NULL; + if(!PyCom_PyObjectAsSTGOPTIONS(obstgoptions, &pstgoptions)) return NULL; PY_INTERFACE_PRECALL; - err = (*myStgOpenStorageEx)(fname, mode, stgfmt, attrs, NULL, reserved, riid, &intptr); + hr = (*myStgCreateStorageEx)(fname, mode, stgfmt, attrs, pstgoptions, psd, riid, &ret); + // hr = StgCreateStorageEx(fname, mode, stgfmt, attrs, pstgoptions, psd, riid, &ret); PY_INTERFACE_POSTCALL; if (pstgoptions) delete(pstgoptions); - PyWinObject_FreeWCHAR(fname); - if (FAILED(err)) - return PyCom_BuildPyException(err); - return PyCom_PyObjectFromIUnknown((IUnknown *)intptr, riid, FALSE); -#else - return PyErr_Format(PyExc_NotImplementedError,"StgOpenStorageEx not supported by this version of Windows"); -#endif // NO_PYCOM_STGOPENSTORAGEEX + if (FAILED(hr)) + return PyCom_BuildPyException(hr); + return PyCom_PyObjectFromIUnknown((IUnknown *)ret, riid, FALSE); } // @pymethod <o PyUNICODE>|pythoncom|FmtIdToPropStgName|Converts a FMTID to its stream name diff -r 93262002f506 -r 158fa5384a45 com/win32com/src/PythonCOM.cpp --- a/com/win32com/src/PythonCOM.cpp Sat Aug 18 12:54:34 2012 -0400 +++ b/com/win32com/src/PythonCOM.cpp Sat Aug 18 22:08:05 2012 -0400 @@ -38,7 +38,8 @@ // Storage related functions. extern PyObject *pythoncom_StgOpenStorage(PyObject *self, PyObject *args); -extern PyObject *pythoncom_StgOpenStorageEx(PyObject *self, PyObject *args); +extern PyObject *pythoncom_StgOpenStorageEx(PyObject *self, PyObject *args, PyObject *kwargs); +extern PyObject *pythoncom_StgCreateStorageEx(PyObject *self, PyObject *args, PyObject *kwargs); extern PyObject *pythoncom_FmtIdToPropStgName(PyObject *self, PyObject *args); extern PyObject *pythoncom_PropStgNameToFmtId(PyObject *self, PyObject *args); @@ -1958,7 +1959,8 @@ #endif // MS_WINCE { "STGMEDIUM", Py_NewSTGMEDIUM, 1}, // @pymeth STGMEDIUM|Creates a new <o PySTGMEDIUM> object suitable for the <o PyIDataObject> interface. { "StgOpenStorage", pythoncom_StgOpenStorage, 1 }, // @pymeth StgOpenStorage|Opens an existing root storage object in the file system. - { "StgOpenStorageEx", pythoncom_StgOpenStorageEx, 1 }, // @pymeth StgOpenStorageEx|Access IStorage and IPropertySetStorage interfaces for normal files + { "StgOpenStorageEx", (PyCFunction)pythoncom_StgOpenStorageEx, METH_KEYWORDS|METH_VARARGS}, // @pymeth StgOpenStorageEx|Access IStorage and IPropertySetStorage interfaces for normal files + { "StgCreateStorageEx", (PyCFunction)pythoncom_StgCreateStorageEx, METH_KEYWORDS|METH_VARARGS}, // @pymeth StgCreateStorageEx|Creates a new structured storage file or property set { "TYPEATTR", Py_NewTYPEATTR, 1}, // @pymeth TYPEATTR|Returns a new <o TYPEATTR> object. { "VARDESC", Py_NewVARDESC, 1}, // @pymeth VARDESC|Returns a new <o VARDESC> object. { "WrapObject", pythoncom_WrapObject, 1 }, // @pymeth WrapObject|Wraps an object in a gateway. |
From: <pyw...@li...> - 2012-08-18 16:59:41
|
changeset 93262002f506 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=93262002f506 summary: Add SHCreateStreamOnFileEx diffstat: com/win32comext/shell/src/shell.cpp | 43 +++++++++++++++++++++++++++++++++++++ 1 files changed, 43 insertions(+), 0 deletions(-) diffs (74 lines): diff -r 1f6c4ba7e469 -r 93262002f506 com/win32comext/shell/src/shell.cpp --- a/com/win32comext/shell/src/shell.cpp Thu Aug 16 17:55:01 2012 -0400 +++ b/com/win32comext/shell/src/shell.cpp Sat Aug 18 12:54:34 2012 -0400 @@ -163,6 +163,8 @@ typedef HRESULT (WINAPI *PFNSHOpenFolderAndSelectItems)(PCIDLIST_ABSOLUTE,UINT,PCUITEMID_CHILD_ARRAY,DWORD); static PFNSHOpenFolderAndSelectItems pfnSHOpenFolderAndSelectItems = NULL; +typedef HRESULT (WINAPI *PFNSHCreateStreamOnFileEx)(LPCWSTR, DWORD, DWORD, BOOL, IStream *, IStream **); +static PFNSHCreateStreamOnFileEx pfnSHCreateStreamOnFileEx = NULL; // Some magic hackery macros :-) #define _ILSkip(pidl, cb) ((LPITEMIDLIST)(((BYTE*)(pidl))+cb)) @@ -3247,6 +3249,45 @@ return ret; } +// @pymethod <o PyIStream>|shell|SHCreateStreamOnFileEx|Creates an IStream interface that reads and writes to a file +static PyObject *PySHCreateStreamOnFileEx(PyObject *self, PyObject *args, PyObject *kwargs) +{ + // @comm Accepts keyword args. + // @comm This function is only available on WinXP and later. + // COM exception with E_NOTIMPL will be thrown if the function can't be located. + if (pfnSHCreateStreamOnFileEx==NULL) + return PyCom_BuildPyException(E_NOTIMPL); + static char *keywords[] = {"File", "Mode", "Attributes", "Create", "Template", NULL}; + PyObject *obfname, *obtemplate = Py_None; + TmpWCHAR fname; + DWORD mode, attributes; + BOOL create; + IStream *ret; + // @pyparm str|File||Name of file to be connected to the stream + // @pyparm int|Mode||Combination of storagecon.STGM_* flags specifying the access mode + // @pyparm int|Attributes||Combination of win32con.FILE_ATTRIBUTE_* flags + // @pyparm bool|Create||Determines if function should fail when file exists (see MSDN docs for full explanation) + // @pyparm None|Template|None|Reserved, use only None + + if(!PyArg_ParseTupleAndKeywords(args, kwargs, "Okkl|O:SHCreateStreamOnFileEx", keywords, + &obfname, &mode, &attributes, &create, &obtemplate)) + return NULL; + if (obtemplate != Py_None){ + PyErr_SetString(PyExc_ValueError, "Template is reserved and must be None"); + return NULL; + } + if (!PyWinObject_AsWCHAR(obfname, &fname, FALSE)) + return NULL; + + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = (*pfnSHCreateStreamOnFileEx)(fname, mode, attributes, create, NULL, &ret); + PY_INTERFACE_POSTCALL; + if (FAILED(hr)) + return PyCom_BuildPyException(hr); + return PyCom_PyObjectFromIUnknown(ret, IID_IStream, FALSE); +} + /* List of module functions */ // @module shell|A module wrapping Windows Shell functions and interfaces @@ -3306,6 +3347,7 @@ { "SHILCreateFromPath", PySHILCreateFromPath, METH_VARARGS}, // @pymeth SHILCreateFromPath|Returns the PIDL and attributes of a path { "SHCreateShellItem", PySHCreateShellItem, METH_VARARGS}, // @pymeth SHCreateShellItem|Creates an IShellItem interface from a PIDL { "SHOpenFolderAndSelectItems", (PyCFunction)PySHOpenFolderAndSelectItems, METH_VARARGS|METH_KEYWORDS}, // @pymeth SHOpenFolderAndSelectItems|Displays a shell folder with items pre-selected + { "SHCreateStreamOnFileEx", (PyCFunction)PySHCreateStreamOnFileEx, METH_VARARGS|METH_KEYWORDS}, // @pymeth SHCreateStreamOnFileEx|Creates a <o PyIStream> that reads and writes to a file { NULL, NULL }, }; @@ -3458,6 +3500,7 @@ if (shlwapi!=NULL){ pfnSHGetViewStatePropertyBag=(PFNSHGetViewStatePropertyBag)GetProcAddress(shlwapi, "SHGetViewStatePropertyBag"); pfnAssocCreate=(PFNAssocCreate)GetProcAddress(shlwapi, "AssocCreate"); + pfnSHCreateStreamOnFileEx = (PFNSHCreateStreamOnFileEx)GetProcAddress(shlwapi, "SHCreateStreamOnFileEx"); } ADD_CONSTANT(SLR_NO_UI); |
From: <pyw...@li...> - 2012-08-18 16:19:57
|
changeset 1f6c4ba7e469 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=1f6c4ba7e469 summary: Move TmpWCHAR into Pywintypes.h diffstat: com/win32comext/propsys/src/PyPROPVARIANT.h | 17 ----------------- win32/src/PyWinTypes.h | 19 +++++++++++++++++++ win32/src/win32evtlog.i | 18 ------------------ win32/src/win32service.i | 17 ----------------- 4 files changed, 19 insertions(+), 52 deletions(-) diffs (111 lines): diff -r 7db23de8daa7 -r 1f6c4ba7e469 com/win32comext/propsys/src/PyPROPVARIANT.h --- a/com/win32comext/propsys/src/PyPROPVARIANT.h Mon Aug 13 18:24:08 2012 -0400 +++ b/com/win32comext/propsys/src/PyPROPVARIANT.h Thu Aug 16 17:55:01 2012 -0400 @@ -4,23 +4,6 @@ #include "structmember.h" #include "propsys.h" -// Automatically freed WCHAR that can be used anywhere WCHAR * is required -class TmpWCHAR -{ -public: - WCHAR *tmp; - TmpWCHAR() { tmp=NULL; } - TmpWCHAR(WCHAR *t) { tmp=t; } - WCHAR * operator= (WCHAR *t){ - PyWinObject_FreeWCHAR(tmp); - tmp=t; - return t; - } - WCHAR ** operator& () {return &tmp;} - boolean operator== (WCHAR *t) { return tmp==t; } - operator WCHAR *() { return tmp; } - ~TmpWCHAR() { PyWinObject_FreeWCHAR(tmp); } -}; extern BOOL PyWin_NewPROPVARIANT(PyObject *ob, VARTYPE vt, PROPVARIANT *ppv); extern BOOL PyWinObject_AsPROPVARIANT(PyObject *ob, PROPVARIANT **pppv); diff -r 7db23de8daa7 -r 1f6c4ba7e469 win32/src/PyWinTypes.h --- a/win32/src/PyWinTypes.h Mon Aug 13 18:24:08 2012 -0400 +++ b/win32/src/PyWinTypes.h Thu Aug 16 17:55:01 2012 -0400 @@ -287,6 +287,25 @@ PYWINTYPES_EXPORT void PyWinObject_FreeString(char *pResult); PYWINTYPES_EXPORT void PyWinObject_FreeString(WCHAR *pResult); +// Automatically freed WCHAR that can be used anywhere WCHAR * is required +class TmpWCHAR +{ +public: + WCHAR *tmp; + TmpWCHAR() { tmp=NULL; } + TmpWCHAR(WCHAR *t) { tmp=t; } + WCHAR * operator= (WCHAR *t){ + PyWinObject_FreeWCHAR(tmp); + tmp=t; + return t; + } + WCHAR ** operator& () {return &tmp;} + boolean operator== (WCHAR *t) { return tmp==t; } + operator WCHAR *() { return tmp; } + ~TmpWCHAR() { PyWinObject_FreeWCHAR(tmp); } +}; + + // Buffer functions that can be used in place of 's#' input format or PyString_AsStringAndSize // for 64-bit compatibility and API consistency PYWINTYPES_EXPORT BOOL PyWinObject_AsReadBuffer(PyObject *ob, void **buf, DWORD *buf_len, BOOL bNoneOk=FALSE); diff -r 7db23de8daa7 -r 1f6c4ba7e469 win32/src/win32evtlog.i --- a/win32/src/win32evtlog.i Mon Aug 13 18:24:08 2012 -0400 +++ b/win32/src/win32evtlog.i Thu Aug 16 17:55:01 2012 -0400 @@ -15,24 +15,6 @@ #include "PyWinObjects.h" #include "WinEvt.h" -// Automatically freed WCHAR that can be used anywhere WCHAR * is required -class TmpWCHAR -{ -public: - WCHAR *tmp; - TmpWCHAR() { tmp=NULL; } - TmpWCHAR(WCHAR *t) { tmp=t; } - WCHAR * operator= (WCHAR *t){ - PyWinObject_FreeWCHAR(tmp); - tmp=t; - return t; - } - WCHAR ** operator& () {return &tmp;} - boolean operator== (WCHAR *t) { return tmp==t; } - operator WCHAR *() { return tmp; } - ~TmpWCHAR() { PyWinObject_FreeWCHAR(tmp); } -}; - // @object PyEVTLOG_HANDLE|Object representing a handle to the windows event log. // Identical to <o PyHANDLE>, but calls CloseEventLog() on destruction class PyEVTLOG_HANDLE: public PyHANDLE diff -r 7db23de8daa7 -r 1f6c4ba7e469 win32/src/win32service.i --- a/win32/src/win32service.i Mon Aug 13 18:24:08 2012 -0400 +++ b/win32/src/win32service.i Thu Aug 16 17:55:01 2012 -0400 @@ -24,23 +24,6 @@ // according to msdn, 256 is limit for service names and service display names #define MAX_SERVICE_NAME_LEN 256 -// Automatically freed WCHAR that can be used anywhere WCHAR * is required -class TmpWCHAR -{ -public: - WCHAR *tmp; - TmpWCHAR() { tmp=NULL; } - TmpWCHAR(WCHAR *t) { tmp=t; } - WCHAR * operator= (WCHAR *t){ - PyWinObject_FreeWCHAR(tmp); - tmp=t; - return t; - } - WCHAR ** operator& () {return &tmp;} - boolean operator== (WCHAR *t) { return tmp==t; } - operator WCHAR *() { return tmp; } - ~TmpWCHAR() { PyWinObject_FreeWCHAR(tmp); } -}; %} %init %{ |
From: <pyw...@li...> - 2012-08-13 22:27:22
|
changeset 7db23de8daa7 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=7db23de8daa7 summary: A couple of optimizations for where an object is already PyIDispatch diffstat: com/win32com/client/dynamic.py | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-) diffs (47 lines): diff -r 2ad7e595084e -r 7db23de8daa7 com/win32com/client/dynamic.py --- a/com/win32com/client/dynamic.py Mon Aug 13 15:04:21 2012 -0400 +++ b/com/win32com/client/dynamic.py Mon Aug 13 18:24:08 2012 -0400 @@ -71,13 +71,19 @@ MakeMethod = types.MethodType # all args used in py2k. # get the type objects for IDispatch and IUnknown -dispatchType = pythoncom.TypeIIDs[pythoncom.IID_IDispatch] -iunkType = pythoncom.TypeIIDs[pythoncom.IID_IUnknown] +PyIDispatchType = pythoncom.TypeIIDs[pythoncom.IID_IDispatch] +PyIUnknownType = pythoncom.TypeIIDs[pythoncom.IID_IUnknown] -_GoodDispatchTypes=(str, IIDType, unicode) +if py3k: + _GoodDispatchTypes=(str, IIDType) +else: + _GoodDispatchTypes=(str, IIDType, unicode) _defaultDispatchItem=build.DispatchItem def _GetGoodDispatch(IDispatch, clsctx = pythoncom.CLSCTX_SERVER): + # quick return for most common case + if isinstance(IDispatch, PyIDispatchType): + return IDispatch if isinstance(IDispatch, _GoodDispatchTypes): try: IDispatch = pythoncom.connect(IDispatch) @@ -282,15 +288,15 @@ return Dispatch(ob, userName) def _get_good_single_object_(self,ob,userName = None, ReturnCLSID=None): - if iunkType==type(ob): + if isinstance(ob, PyIDispatchType): + # make a new instance of (probably this) class. + return self._wrap_dispatch_(ob, userName, ReturnCLSID) + if isinstance(ob, PyIUnknownType): try: ob = ob.QueryInterface(pythoncom.IID_IDispatch) - # If this works, we then enter the "is dispatch" test below. except pythoncom.com_error: # It is an IUnknown, but not an IDispatch, so just let it through. - pass - if dispatchType==type(ob): - # make a new instance of (probably this) class. + return ob return self._wrap_dispatch_(ob, userName, ReturnCLSID) return ob |
From: <pyw...@li...> - 2012-08-13 20:05:39
|
changeset 2ad7e595084e in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=2ad7e595084e summary: Always check for an enumerator (DISPID_NEWENUM), and remove support for diffstat: com/win32com/client/genpy.py | 57 ++++++++++++++++++++++++------------------- 1 files changed, 32 insertions(+), 25 deletions(-) diffs (70 lines): diff -r 9c79bdb51505 -r 2ad7e595084e com/win32com/client/genpy.py --- a/com/win32com/client/genpy.py Wed Aug 08 11:58:06 2012 -0400 +++ b/com/win32com/client/genpy.py Mon Aug 13 15:04:21 2012 -0400 @@ -510,34 +510,41 @@ print >> stream, "\tdef __int__(self, *args):" print >> stream, "\t\treturn int(self.__call__(*args))" - + # _NewEnum (DISPID_NEWENUM) does not appear in typelib for many office objects, + # but it can still be retrieved at runtime, so always create __iter__. + # Also, some of those same objects use 1-based indexing, causing the old-style + # __getitem__ iteration to fail for index 0 where the dynamic iteration succeeds. if specialItems["_newenum"]: enumEntry, invoketype, propArgs = specialItems["_newenum"] + invkind = enumEntry.desc[4] + # ??? Wouldn't this be the resultCLSID for the iterator itself, rather than the resultCLSID + # for the result of each Next() call, which is what it's used for ??? resultCLSID = enumEntry.GetResultCLSIDStr() - # If we dont have a good CLSID for the enum result, assume it is the same as the Item() method. - if resultCLSID == "None" and "Item" in self.mapFuncs: - resultCLSID = self.mapFuncs["Item"].GetResultCLSIDStr() - # "Native" Python iterator support - print >> stream, '\tdef __iter__(self):' - print >> stream, '\t\t"Return a Python iterator for this object"' - print >> stream, '\t\tob = self._oleobj_.InvokeTypes(%d,LCID,%d,(13, 10),())' % (pythoncom.DISPID_NEWENUM, enumEntry.desc[4]) - print >> stream, '\t\treturn win32com.client.util.Iterator(ob, %s)' % resultCLSID - # And 'old style' iterator support - magically used to simulate iterators - # before Python grew them - print >> stream, '\tdef _NewEnum(self):' - print >> stream, '\t\t"Create an enumerator from this object"' - print >> stream, '\t\treturn win32com.client.util.WrapEnum(self._oleobj_.InvokeTypes(%d,LCID,%d,(13, 10),()),%s)' % (pythoncom.DISPID_NEWENUM, enumEntry.desc[4], resultCLSID) - print >> stream, '\tdef __getitem__(self, index):' - print >> stream, '\t\t"Allow this class to be accessed as a collection"' - print >> stream, "\t\tif '_enum_' not in self.__dict__:" - print >> stream, "\t\t\tself.__dict__['_enum_'] = self._NewEnum()" - print >> stream, "\t\treturn self._enum_.__getitem__(index)" - else: # Not an Enumerator, but may be an "Item/Count" based collection - if specialItems["item"]: - entry, invoketype, propArgs = specialItems["item"] - print >> stream, '\t#This class has Item property/method which may take args - allow indexed access' - print >> stream, '\tdef __getitem__(self, item):' - print >> stream, '\t\treturn self._get_good_object_(self._oleobj_.Invoke(*(%d, LCID, %d, 1, item)), "Item")' % (entry.desc[0], invoketype) + else: + invkind = pythoncom.DISPATCH_METHOD | pythoncom.DISPATCH_PROPERTYGET + resultCLSID = "None" + # If we dont have a good CLSID for the enum result, assume it is the same as the Item() method. + if resultCLSID == "None" and "Item" in self.mapFuncs: + resultCLSID = self.mapFuncs["Item"].GetResultCLSIDStr() + print >> stream, '\tdef __iter__(self):' + print >> stream, '\t\t"Return a Python iterator for this object"' + print >> stream, '\t\ttry:' + print >> stream, '\t\t\tob = self._oleobj_.InvokeTypes(%d,LCID,%d,(13, 10),())' % (pythoncom.DISPID_NEWENUM, invkind) + print >> stream, '\t\texcept pythoncom.error:' + print >> stream, '\t\t\traise TypeError("This object does not support enumeration")' + # Iterator is wrapped as PyIEnumVariant, and each result of __next__ is Dispatch'ed if necessary + print >> stream, '\t\treturn win32com.client.util.Iterator(ob, %s)' %resultCLSID + + if specialItems["item"]: + entry, invoketype, propArgs = specialItems["item"] + resultCLSID = entry.GetResultCLSIDStr() + print >> stream, '\t#This class has Item property/method which allows indexed access with the object[key] syntax.' + print >> stream, '\t#Some objects will accept a string or other type of key in addition to integers.' + print >> stream, '\t#Note that many Office objects do not use zero-based indexing.' + print >> stream, '\tdef __getitem__(self, key):' + print >> stream, '\t\treturn self._get_good_object_(self._oleobj_.Invoke(*(%d, LCID, %d, 1, key)), "Item", %s)' \ + % (entry.desc[0], invoketype, resultCLSID) + if specialItems["count"]: entry, invoketype, propArgs = specialItems["count"] if propArgs is None: |
From: <pyw...@li...> - 2012-08-08 15:58:48
|
changeset 9c79bdb51505 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=9c79bdb51505 summary: Validate syntax for constants created using repr diffstat: com/win32com/client/genpy.py | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diffs (20 lines): diff -r 702451ba44f2 -r 9c79bdb51505 com/win32com/client/genpy.py --- a/com/win32com/client/genpy.py Tue Aug 07 04:32:52 2012 -0400 +++ b/com/win32com/client/genpy.py Wed Aug 08 11:58:06 2012 -0400 @@ -214,6 +214,16 @@ use = hex(val) else: use = repr(val) + # Make sure the repr of the value is valid python syntax + # still could cause an error on import if it contains a module or type name + # not available in the global namespace + try: + compile(use, '<makepy>', 'eval') + except SyntaxError: + # At least add the repr as a string, so it can be investigated further + # Sanitize it, in case the repr contains its own quotes. (??? line breaks too ???) + use = use.replace('"',"'") + use = '"' + use + '"' + ' # This VARIANT type cannot be converted automatically' print >> stream, "\t%-30s=%-10s # from enum %s" % \ (build.MakePublicAttributeName(name, True), use, enumName) num += 1 |
From: <pyw...@li...> - 2012-08-07 08:33:42
|
changeset 702451ba44f2 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=702451ba44f2 summary: Autoduck fixes diffstat: win32/src/win32security.i | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diffs (30 lines): diff -r aa89dec6e110 -r 702451ba44f2 win32/src/win32security.i --- a/win32/src/win32security.i Tue Aug 07 04:13:56 2012 -0400 +++ b/win32/src/win32security.i Tue Aug 07 04:32:52 2012 -0400 @@ -2851,7 +2851,7 @@ } %} -// @pyswig |LsaEnumerateAccountsWithUserRight|Return SIDs that hold specified priv +// @pyswig (<o PySID>,...)|LsaEnumerateAccountsWithUserRight|Return SIDs that hold specified priv %native(LsaEnumerateAccountsWithUserRight) PyLsaEnumerateAccountsWithUserRight; %{ static PyObject *PyLsaEnumerateAccountsWithUserRight(PyObject *self, PyObject *args) @@ -3931,7 +3931,7 @@ } %} -// @pyswig |TranslateName|Converts a directory service object name from one format to another. +// @pyswig <o PyUnicode>|TranslateName|Converts a directory service object name from one format to another. %native(TranslateName) PyTranslateName; %{ static PyObject *PyTranslateName(PyObject *self, PyObject *args) @@ -3971,7 +3971,7 @@ } %} -// @pyswig |CreateWellKnownSid|Returns one of the predefined well known sids +// @pyswig <o PySID>|CreateWellKnownSid|Returns one of the predefined well known sids %native(CreateWellKnownSid) PyCreateWellKnownSid; %{ static PyObject *PyCreateWellKnownSid(PyObject *self, PyObject *args) |
From: <pyw...@li...> - 2012-08-07 08:25:27
|
changeset aa89dec6e110 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=aa89dec6e110 summary: Move SeqToVector into PythonCOM.h diffstat: com/win32com/src/include/PythonCOM.h | 20 ++++++++++++++++++++ com/win32comext/propsys/src/PyPROPVARIANT.cpp | 21 --------------------- com/win32comext/shell/src/PyIShellItem2.cpp | 21 --------------------- 3 files changed, 20 insertions(+), 42 deletions(-) diffs (90 lines): diff -r a7098757376f -r aa89dec6e110 com/win32com/src/include/PythonCOM.h --- a/com/win32com/src/include/PythonCOM.h Tue Aug 07 00:16:07 2012 -0400 +++ b/com/win32com/src/include/PythonCOM.h Tue Aug 07 04:13:56 2012 -0400 @@ -755,4 +755,24 @@ PYCOM_EXPORT void PyCom_LogF(const char *fmt, ...); +// Generic conversion from python sequence to VT_VECTOR array +// Resulting array must be freed with CoTaskMemFree +template <typename arraytype> +BOOL SeqToVector(PyObject *ob, arraytype **pA, ULONG *pcount, BOOL (*converter)(PyObject *, arraytype *)){ + TmpPyObject seq = PyWinSequence_Tuple(ob, pcount); + if (seq == NULL) + return FALSE; + *pA = (arraytype *)CoTaskMemAlloc(*pcount * sizeof(arraytype)); + if (*pA == NULL){ + PyErr_NoMemory(); + return FALSE; + } + for (ULONG i=0; i<*pcount; i++){ + PyObject *item = PyTuple_GET_ITEM((PyObject *)seq, i); + if (!(*converter)(item, &(*pA)[i])) + return FALSE; + } + return TRUE; +} + #endif // __PYTHONCOM_H__ diff -r a7098757376f -r aa89dec6e110 com/win32comext/propsys/src/PyPROPVARIANT.cpp --- a/com/win32comext/propsys/src/PyPROPVARIANT.cpp Tue Aug 07 00:16:07 2012 -0400 +++ b/com/win32comext/propsys/src/PyPROPVARIANT.cpp Tue Aug 07 04:13:56 2012 -0400 @@ -163,27 +163,6 @@ return PyWinObject_FromPROPVARIANT(&pv); } - -// Generic conversion from python sequence to VT_VECTOR array -template <typename arraytype> -BOOL SeqToVector(PyObject *ob, arraytype **pA, ULONG *pcount, BOOL (*converter)(PyObject *, arraytype *)){ - TmpPyObject seq = PyWinSequence_Tuple(ob, pcount); - if (seq == NULL) - return FALSE; - *pA = (arraytype *)CoTaskMemAlloc(*pcount * sizeof(arraytype)); - if (*pA == NULL){ - PyErr_NoMemory(); - return FALSE; - } - for (ULONG i=0; i<*pcount; i++){ - PyObject *item = PyTuple_GET_ITEM((PyObject *)seq, i); - if (!(*converter)(item, &(*pA)[i])) - return FALSE; - } - return TRUE; -} - - // @pymethod object|PyPROPVARIANT|GetValue|Returns an object representing the variant value PyObject* PyPROPVARIANT::GetValue(PyObject *self, PyObject *args) { diff -r a7098757376f -r aa89dec6e110 com/win32comext/shell/src/PyIShellItem2.cpp --- a/com/win32comext/shell/src/PyIShellItem2.cpp Tue Aug 07 00:16:07 2012 -0400 +++ b/com/win32comext/shell/src/PyIShellItem2.cpp Tue Aug 07 04:13:56 2012 -0400 @@ -82,27 +82,6 @@ return PyCom_PyObjectFromIUnknown((IUnknown *)ret, riid); } - -// ??? Also in PyPROPVARIANT.cpp, should move into a header somewhere ??? -// Generic conversion from python sequence to VT_VECTOR array -template <typename arraytype> -BOOL SeqToVector(PyObject *ob, arraytype **pA, ULONG *pcount, BOOL (*converter)(PyObject *, arraytype *)){ - TmpPyObject seq = PyWinSequence_Tuple(ob, pcount); - if (seq == NULL) - return FALSE; - *pA = (arraytype *)CoTaskMemAlloc(*pcount * sizeof(arraytype)); - if (*pA == NULL){ - PyErr_NoMemory(); - return FALSE; - } - for (ULONG i=0; i<*pcount; i++){ - PyObject *item = PyTuple_GET_ITEM((PyObject *)seq, i); - if (!(*converter)(item, &(*pA)[i])) - return FALSE; - } - return TRUE; -} - // @pymethod <o PyIPropertyStore>|PyIShellItem2|GetPropertyStoreForKeys|Creates a property store containing just the specified properties of the item PyObject *PyIShellItem2::GetPropertyStoreForKeys(PyObject *self, PyObject *args) { |
From: <pyw...@li...> - 2012-08-07 04:16:53
|
changeset a7098757376f in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=a7098757376f summary: Autoduck fix diffstat: com/win32comext/shell/src/PyIEnumShellItems.cpp | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r e4c928c7150e -r a7098757376f com/win32comext/shell/src/PyIEnumShellItems.cpp --- a/com/win32comext/shell/src/PyIEnumShellItems.cpp Mon Aug 06 23:40:03 2012 -0400 +++ b/com/win32comext/shell/src/PyIEnumShellItems.cpp Tue Aug 07 00:16:07 2012 -0400 @@ -25,7 +25,7 @@ return (IEnumShellItems *)PyIUnknown::GetI(self); } -// @pymethod (o <PyIShellItem>,...)|PyIEnumShellItems|Next|Retrieves a specified number of items in the enumeration sequence. +// @pymethod (<o PyIShellItem>,...)|PyIEnumShellItems|Next|Retrieves a specified number of items in the enumeration sequence. PyObject *PyIEnumShellItems::Next(PyObject *self, PyObject *args) { long celt = 1; |
From: <pyw...@li...> - 2012-08-07 03:42:58
|
changeset e4c928c7150e in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=e4c928c7150e summary: Fix PyIDispatch.GetMemberName, and some autoduck improvements diffstat: com/win32com/src/PyIDispatch.cpp | 37 ++++++++++++++++++------------------- 1 files changed, 18 insertions(+), 19 deletions(-) diffs (111 lines): diff -r a81ece0ec74d -r e4c928c7150e com/win32com/src/PyIDispatch.cpp --- a/com/win32com/src/PyIDispatch.cpp Mon Aug 06 01:40:54 2012 -0400 +++ b/com/win32com/src/PyIDispatch.cpp Mon Aug 06 23:40:03 2012 -0400 @@ -571,7 +571,7 @@ return (IDispatchEx *)PyIDispatch::GetI(self); } -// @method int|PyIDispatchEx|GetDispID| +// @pymethod int|PyIDispatchEx|GetDispID|Returns the member id for a name PyObject *PyIDispatchEx::GetDispID(PyObject *self, PyObject *args) { long fdex; @@ -593,7 +593,7 @@ return PyInt_FromLong(dispid); } -// @method object|PyIDispatchEx|InvokeEx|Provides access to properties and methods exposed by a <o PyIDispatchEx> object. +// @pymethod object|PyIDispatchEx|InvokeEx|Provides access to properties and methods exposed by a <o PyIDispatchEx> object. PyObject *PyIDispatchEx::InvokeEx(PyObject *self, PyObject *args) { long dispid; @@ -673,7 +673,7 @@ } return result; } -// @method |PyIDispatchEx|DeleteMemberByName| +// @pymethod |PyIDispatchEx|DeleteMemberByName| PyObject *PyIDispatchEx::DeleteMemberByName(PyObject *self, PyObject *args) { long fdex; @@ -694,7 +694,7 @@ Py_INCREF(Py_None); return Py_None; } -// @method |PyIDispatchEx|DeleteMemberByDispID| +// @pymethod |PyIDispatchEx|DeleteMemberByDispID| PyObject *PyIDispatchEx::DeleteMemberByDispID(PyObject *self, PyObject *args) { long dispid; @@ -710,14 +710,14 @@ Py_INCREF(Py_None); return Py_None; } -// @method int|PyIDispatchEx|GetMemberProperties| +// @pymethod int|PyIDispatchEx|GetMemberProperties|Returns mask of fdex* flags describing a member PyObject *PyIDispatchEx::GetMemberProperties(PyObject *self, PyObject *args) { long fdex; long dispid; if (!PyArg_ParseTuple(args, "ll:GetMemberProperties", - &dispid, // @pyparm int|dispid|| - &fdex)) // @pyparm int|fdex||Determines the options + &dispid, // @pyparm int|dispid||The member id + &fdex)) // @pyparm int|fdex||fdex* flags specifying which properties to return return NULL; IDispatchEx *pMyDispatchEx = GetI(self); if (pMyDispatchEx==NULL) return NULL; @@ -728,33 +728,32 @@ if (FAILED(hr)) return SetPythonCOMError(self, hr); return PyInt_FromLong(props); } -// @method int|PyIDispatchEx|GetMemberName| +// @pymethod str|PyIDispatchEx|GetMemberName|Returns the name associated with a member id PyObject *PyIDispatchEx::GetMemberName(PyObject *self, PyObject *args) { - long fdex; long dispid; - if (!PyArg_ParseTuple(args, "ll:GetMemberName", - &dispid, // @pyparm int|dispid|| - &fdex)) // @pyparm int|fdex||Determines the options + BSTR name; + if (!PyArg_ParseTuple(args, "l:GetMemberName", + &dispid)) // @pyparm int|dispid||The member id return NULL; IDispatchEx *pMyDispatchEx = GetI(self); if (pMyDispatchEx==NULL) return NULL; - DWORD props; + PY_INTERFACE_PRECALL; - HRESULT hr = pMyDispatchEx->GetMemberProperties((DISPID)dispid, (DWORD)fdex, &props); + HRESULT hr = pMyDispatchEx->GetMemberName(dispid, &name); PY_INTERFACE_POSTCALL; if (FAILED(hr)) return SetPythonCOMError(self, hr); - return PyInt_FromLong(props); + return PyWinObject_FromBstr(name, TRUE); } -// @method int|PyIDispatchEx|GetNextDispID| +// @pymethod int|PyIDispatchEx|GetNextDispID|Enumerates member ids. PyObject *PyIDispatchEx::GetNextDispID(PyObject *self, PyObject *args) { long fdex; long dispid; if (!PyArg_ParseTuple(args, "ll:GetNextDispID", &fdex, // @pyparm int|fdex||Determines the options - &dispid)) // @pyparm int|dispid||Identifies the current member. GetNextDispID will retrieve the item in the enumeration after this one. + &dispid)) // @pyparm int|dispid||Current member, or DISPID_STARTENUM to begin enumeration. GetNextDispID will retrieve the item in the enumeration after this one. return NULL; IDispatchEx *pMyDispatchEx = GetI(self); if (pMyDispatchEx==NULL) return NULL; @@ -774,8 +773,8 @@ {"DeleteMemberByName", PyIDispatchEx::DeleteMemberByName, 1 }, // @pymeth DeleteMemberByName| {"DeleteMemberByDispID",PyIDispatchEx::DeleteMemberByDispID, 1 }, // @pymeth DeleteMemberByDispID| {"GetMemberProperties", PyIDispatchEx::GetMemberProperties, 1 }, // @pymeth GetMemberProperties| - {"GetMemberName", PyIDispatchEx::GetMemberName, 1 }, // @pymeth GetMemberName| - {"GetNextDispID", PyIDispatchEx::GetNextDispID, 1 }, // @pymeth GetNextDispID| + {"GetMemberName", PyIDispatchEx::GetMemberName, 1 }, // @pymeth GetMemberName|Returns the name associated with a member id + {"GetNextDispID", PyIDispatchEx::GetNextDispID, 1 }, // @pymeth GetNextDispID|Enumerates member ids. {NULL, NULL} }; |
From: <pyw...@li...> - 2012-08-06 05:44:41
|
changeset a81ece0ec74d in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=a81ece0ec74d summary: Add a set of braces diffstat: com/win32com/src/PythonCOM.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diffs (20 lines): diff -r 02686d59297d -r a81ece0ec74d com/win32com/src/PythonCOM.cpp --- a/com/win32com/src/PythonCOM.cpp Mon Aug 06 12:04:10 2012 +1000 +++ b/com/win32com/src/PythonCOM.cpp Mon Aug 06 01:40:54 2012 -0400 @@ -267,7 +267,7 @@ if (result==NULL) goto done; for (i=0;i<numIIDs;i++) { PyObject *obNew; - if (mqi[i].hr==0) + if (mqi[i].hr==0){ obNew = PyCom_PyObjectFromIUnknown(mqi[i].pItf, *mqi[i].pIID, FALSE); mqi[i].pItf = NULL; if (!obNew) { @@ -275,6 +275,7 @@ result = NULL; goto done; } + } else { obNew = Py_None; Py_INCREF(Py_None); |
From: <pyw...@li...> - 2012-08-06 02:10:23
|
changeset c7cffbcd27e5 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=c7cffbcd27e5 summary: Prevent pythoncom.WrapObject() double releasing a reference now PyCom_PyObjectFromIUnknown has saner error behaviour changeset dafd0153cb25 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=dafd0153cb25 summary: Avoid temp objects when making result values, mainly in makepy generated code changeset 53d276dfdc4b in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=53d276dfdc4b summary: Ensure IEnum* interfaces release references on error changeset 3d96807807b5 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=3d96807807b5 summary: a couple more minor cleanups while reviewing PyCom_PyObjectFromIUnknown error handling change changeset 02686d59297d in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=02686d59297d summary: Use PYCOM_RELEASE() in more places diffstat: com/win32com/src/ErrorUtils.cpp | 4 +- com/win32com/src/PyComHelpers.cpp | 6 +- com/win32com/src/PyIUnknown.cpp | 6 +- com/win32com/src/PythonCOM.cpp | 61 ++++----- com/win32com/src/extensions/PyIEnumConnectionPoints.cpp | 8 +- com/win32com/src/extensions/PyIEnumConnections.cpp | 11 +- com/win32com/src/extensions/PyIMoniker.cpp | 22 +-- com/win32com/src/extensions/PyIPropertyStorage.cpp | 7 +- com/win32com/src/extensions/PyIStorage.cpp | 5 +- com/win32com/src/extensions/PyIType.cpp | 6 +- com/win32com/src/include/PythonCOM.h | 12 + com/win32com/src/oleargs.cpp | 12 +- com/win32com/src/univgw.cpp | 10 +- com/win32comext/axcontrol/src/PyIObjectWithSite.cpp | 7 +- com/win32comext/axcontrol/src/PyIOleClientSite.cpp | 14 +- com/win32comext/axcontrol/src/PyIOleInPlaceSite.cpp | 12 +- com/win32comext/axcontrol/src/PyIOleObject.cpp | 35 +---- com/win32comext/axcontrol/src/PyIViewObject.cpp | 8 +- com/win32comext/axdebug/src/PyIActiveScriptDebug.cpp | 5 +- com/win32comext/axdebug/src/PyIActiveScriptErrorDebug.cpp | 14 +- com/win32comext/axdebug/src/PyIActiveScriptSiteDebug.cpp | 19 +-- com/win32comext/axdebug/src/PyIApplicationDebugger.cpp | 7 +- com/win32comext/axdebug/src/PyIDebugApplication.cpp | 19 +-- com/win32comext/axdebug/src/PyIDebugApplicationNode.cpp | 14 +- com/win32comext/axdebug/src/PyIDebugCodeContext.cpp | 7 +- com/win32comext/axdebug/src/PyIDebugDocumentContext.cpp | 14 +- com/win32comext/axdebug/src/PyIDebugDocumentHelper.cpp | 22 +-- com/win32comext/axdebug/src/PyIDebugDocumentHost.cpp | 7 +- com/win32comext/axdebug/src/PyIDebugDocumentProvider.cpp | 5 +- com/win32comext/axdebug/src/PyIDebugDocumentText.cpp | 7 +- com/win32comext/axdebug/src/PyIDebugExpression.cpp | 6 +- com/win32comext/axdebug/src/PyIDebugExpressionContext.cpp | 7 +- com/win32comext/axdebug/src/PyIDebugProperties.cpp | 20 +-- com/win32comext/axdebug/src/PyIDebugStackFrame.cpp | 21 +-- com/win32comext/axdebug/src/PyIDebugStackFrameSniffer.cpp | 7 +- com/win32comext/axdebug/src/PyIDebugSyncOperation.cpp | 14 +- com/win32comext/axdebug/src/PyIEnumDebugApplicationNodes.cpp | 6 +- com/win32comext/axdebug/src/PyIEnumDebugCodeContexts.cpp | 6 +- com/win32comext/axdebug/src/PyIEnumDebugExpressionContexts.cpp | 6 +- com/win32comext/axdebug/src/PyIEnumDebugStackFrames.cpp | 7 +- com/win32comext/axdebug/src/PyIEnumRemoteDebugApplicationThreads.cpp | 6 +- com/win32comext/axdebug/src/PyIEnumRemoteDebugApplications.cpp | 6 +- com/win32comext/axdebug/src/PyIMachineDebugManager.cpp | 5 +- com/win32comext/axdebug/src/PyIProcessDebugManager.cpp | 14 +- com/win32comext/axdebug/src/PyIProvideExpressionContexts.cpp | 7 +- com/win32comext/axdebug/src/PyIRemoteDebugApplication.cpp | 11 +- com/win32comext/bits/src/PyIBackgroundCopyManager.cpp | 21 +-- com/win32comext/bits/src/PyIEnumBackgroundCopyFiles.cpp | 6 +- com/win32comext/bits/src/PyIEnumBackgroundCopyJobs.cpp | 6 +- com/win32comext/shell/src/PyIEnumExplorerCommand.cpp | 6 +- com/win32comext/shell/src/PyIShellView.cpp | 6 +- com/win32comext/shell/src/shell.cpp | 49 +------ com/win32comext/taskscheduler/src/PyITaskScheduler.cpp | 8 +- 53 files changed, 150 insertions(+), 487 deletions(-) diffs (truncated from 1571 to 300 lines): diff -r eb5c1ebf9472 -r 02686d59297d com/win32com/src/ErrorUtils.cpp --- a/com/win32com/src/ErrorUtils.cpp Sat Aug 04 20:35:38 2012 -0400 +++ b/com/win32com/src/ErrorUtils.cpp Mon Aug 06 12:04:10 2012 +1000 @@ -596,9 +596,7 @@ Py_END_ALLOW_THREADS if (hr==S_OK) { obEI = PyCom_PyObjectFromIErrorInfo(pEI, errorhr); - Py_BEGIN_ALLOW_THREADS - pEI->Release(); - Py_END_ALLOW_THREADS + PYCOM_RELEASE(pEI); } } } diff -r eb5c1ebf9472 -r 02686d59297d com/win32com/src/PyComHelpers.cpp --- a/com/win32com/src/PyComHelpers.cpp Sat Aug 04 20:35:38 2012 -0400 +++ b/com/win32com/src/PyComHelpers.cpp Mon Aug 06 12:04:10 2012 +1000 @@ -104,11 +104,7 @@ // caller is asking us to take ownership of the COM reference. If we // fail to create a Python object, we must release the reference. #define POFIU_RELEASE_ON_FAILURE \ - if (!bAddRef) { \ - PY_INTERFACE_PRECALL; \ - punk->Release(); \ - PY_INTERFACE_POSTCALL; \ - } + if (!bAddRef) PYCOM_RELEASE(punk) // Interface conversions diff -r eb5c1ebf9472 -r 02686d59297d com/win32com/src/PyIUnknown.cpp --- a/com/win32com/src/PyIUnknown.cpp Sat Aug 04 20:35:38 2012 -0400 +++ b/com/win32com/src/PyIUnknown.cpp Mon Aug 06 12:04:10 2012 +1000 @@ -245,11 +245,7 @@ PyErr_Clear(); rc = PyCom_PyObjectFromIUnknown(punk, useIID, TRUE); } - { - PY_INTERFACE_PRECALL; - punk->Release(); - PY_INTERFACE_POSTCALL; - } + PYCOM_RELEASE(punk); return rc; } diff -r eb5c1ebf9472 -r 02686d59297d com/win32com/src/PythonCOM.cpp --- a/com/win32com/src/PythonCOM.cpp Sat Aug 04 20:35:38 2012 -0400 +++ b/com/win32com/src/PythonCOM.cpp Mon Aug 06 12:04:10 2012 +1000 @@ -269,6 +269,12 @@ PyObject *obNew; if (mqi[i].hr==0) obNew = PyCom_PyObjectFromIUnknown(mqi[i].pItf, *mqi[i].pIID, FALSE); + mqi[i].pItf = NULL; + if (!obNew) { + Py_DECREF(result); + result = NULL; + goto done; + } else { obNew = Py_None; Py_INCREF(Py_None); @@ -276,14 +282,11 @@ PyTuple_SET_ITEM(result, i, obNew); } done: - if (punk) { - PY_INTERFACE_PRECALL; - punk->Release(); - PY_INTERFACE_POSTCALL; - } + PYCOM_RELEASE(punk); if (serverInfo.pwszName) PyWinObject_FreeWCHAR(serverInfo.pwszName); + for (i=0;i<numIIDs;i++) PYCOM_RELEASE(mqi[i].pItf) delete [] iids; delete [] mqi; return result; @@ -734,19 +737,8 @@ PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr); - - /* pass the pDispatch reference into this thing */ - /* ### this guy should always AddRef() ... */ - PyObject *result = PyCom_PyObjectFromIUnknown(pDispatch, iidInterface, FALSE); - if ( !result ) - { - PY_INTERFACE_PRECALL; - pDispatch->Release(); - PY_INTERFACE_POSTCALL; - return NULL; - } - - return result; + /* return a PyObject wrapping it */ + return PyCom_PyObjectFromIUnknown(pDispatch, iidInterface, FALSE); } static PyObject *pythoncom_MakeIID(PyObject *self, PyObject *args) @@ -794,7 +786,10 @@ } /* pass the pBC ref into obBindCtx */ - obBindCtx = PyCom_PyObjectFromIUnknown(pBC, IID_IBindCtx, FALSE); + if (!(obBindCtx = PyCom_PyObjectFromIUnknown(pBC, IID_IBindCtx, FALSE))) { + PyWinObject_FreeWCHAR(displayName); + return NULL; + } } else { @@ -807,7 +802,10 @@ Py_INCREF(obBindCtx); pBC->Release(); } - /* at this point: we own a ref to obBindCtx, but not pBC */ + /* at this point: we own a ref to obBindCtx, but not a direct one on pBC + (obBindCtx itself has an indirect reference to pBC though, so it is still + safe to use ...) + */ ULONG chEaten; IMoniker *pmk; PY_INTERFACE_PRECALL; @@ -819,18 +817,11 @@ Py_DECREF(obBindCtx); return PyCom_BuildPyException(hr); } - - /* pass ownership of the moniker into the result */ - PyObject *obMoniker = PyCom_PyObjectFromIUnknown(pmk, IID_IMoniker, FALSE); - /* build the result */ - PyObject *result = Py_BuildValue("OiO", obMoniker, chEaten, obBindCtx); - - /* done with these obs */ - Py_XDECREF(obMoniker); - Py_DECREF(obBindCtx); - - return result; + return Py_BuildValue("NiN", + PyCom_PyObjectFromIUnknown(pmk, IID_IMoniker, FALSE), + chEaten, + obBindCtx); } // @pymethod <o PyIMoniker>|pythoncom|CreatePointerMoniker|Creates a new <o PyIMoniker> object. @@ -942,7 +933,7 @@ PyCom_BuildPyException(hr); else ret=PyCom_PyObjectFromIUnknown(output_moniker, IID_IMoniker, FALSE); - } + } PyWinObject_FreeWCHAR(url); return ret; } @@ -1259,7 +1250,7 @@ PyCom_BuildPyException(hr); else ret=PyCom_PyObjectFromIUnknown(pIUnknown, riid, FALSE); - } + } return ret; } @@ -1402,9 +1393,7 @@ IStream *pStream; if (!PyCom_InterfaceFromPyObject(obStream, IID_IStream, (void **)&pStream, FALSE)) { - PY_INTERFACE_PRECALL; - if(pPersist) pPersist->Release(); - PY_INTERFACE_POSTCALL; + PYCOM_RELEASE(pPersist); return NULL; } diff -r eb5c1ebf9472 -r 02686d59297d com/win32com/src/extensions/PyIEnumConnectionPoints.cpp --- a/com/win32com/src/extensions/PyIEnumConnectionPoints.cpp Sat Aug 04 20:35:38 2012 -0400 +++ b/com/win32com/src/extensions/PyIEnumConnectionPoints.cpp Mon Aug 06 12:04:10 2012 +1000 @@ -58,13 +58,12 @@ } PyObject *result = PyTuple_New(celtFetched); - if ( result != NULL ) - { + if (result) { for ( i = celtFetched; i--; ) { PyObject *ob = PyCom_PyObjectFromIUnknown(rgVar[i], IID_IConnectionPoint, FALSE); - if ( ob == NULL ) - { + rgVar[i] = NULL; + if ( ob == NULL ) { Py_DECREF(result); result = NULL; break; @@ -72,6 +71,7 @@ PyTuple_SET_ITEM(result, i, ob); } } + for ( i = celtFetched; i--; ) PYCOM_RELEASE(rgVar[i]); delete [] rgVar; return result; } diff -r eb5c1ebf9472 -r 02686d59297d com/win32com/src/extensions/PyIEnumConnections.cpp --- a/com/win32com/src/extensions/PyIEnumConnections.cpp Sat Aug 04 20:35:38 2012 -0400 +++ b/com/win32com/src/extensions/PyIEnumConnections.cpp Mon Aug 06 12:04:10 2012 +1000 @@ -56,21 +56,20 @@ } PyObject *result = PyTuple_New(celtFetched); - if ( result != NULL ) - { + if (result) { for ( i = celtFetched; i--; ) { PyObject *ob = PyCom_PyObjectFromIUnknown(rgVar[i].pUnk, IID_IUnknown, FALSE); - if ( ob == NULL ) - { + rgVar[i].pUnk = NULL; + if ( ob == NULL ) { Py_DECREF(result); result = NULL; break; } - PyTuple_SET_ITEM(result, i, Py_BuildValue("Ol",ob, rgVar[i].dwCookie)); - Py_DECREF(ob); + PyTuple_SET_ITEM(result, i, Py_BuildValue("Nl",ob, rgVar[i].dwCookie)); } } + for ( i = celtFetched; i--; ) PYCOM_RELEASE(rgVar[i].pUnk); delete [] rgVar; return result; } diff -r eb5c1ebf9472 -r 02686d59297d com/win32com/src/extensions/PyIMoniker.cpp --- a/com/win32com/src/extensions/PyIMoniker.cpp Sat Aug 04 20:35:38 2012 -0400 +++ b/com/win32com/src/extensions/PyIMoniker.cpp Mon Aug 06 12:04:10 2012 +1000 @@ -53,13 +53,12 @@ } PyObject *result = PyTuple_New(celtFetched); - if ( result != NULL ) - { + if (result) { for ( i = celtFetched; i--; ) { PyObject *ob = PyCom_PyObjectFromIUnknown(rgVar[i], IID_IMoniker, FALSE); - if ( ob == NULL ) - { + rgVar[i] = NULL; + if ( ob == NULL ) { Py_DECREF(result); result = NULL; break; @@ -67,6 +66,7 @@ PyTuple_SET_ITEM(result, i, ob); } } + for ( i = celtFetched; i--; ) PYCOM_RELEASE(rgVar[i]); delete [] rgVar; return result; // @rdesc The result is a tuple of <o PyIID> objects, @@ -183,10 +183,7 @@ IMoniker *pMonLeft = NULL; if (obMoniker!=Py_None) { if (!PyCom_InterfaceFromPyInstanceOrObject(obMoniker, IID_IMoniker, (void **)&pMonLeft, FALSE)) { - PY_INTERFACE_PRECALL; - pBindCtx->Release(); - PY_INTERFACE_POSTCALL; - + PYCOM_RELEASE(pBindCtx); return NULL; } } @@ -234,10 +231,7 @@ IMoniker *pMonLeft = NULL; if (obMoniker!=Py_None) { if (!PyCom_InterfaceFromPyInstanceOrObject(obMoniker, IID_IMoniker, (void **)&pMonLeft, FALSE)) { - PY_INTERFACE_PRECALL; - pBindCtx->Release(); - PY_INTERFACE_POSTCALL; - + PYCOM_RELEASE(pBindCtx); return NULL; } } @@ -284,9 +278,7 @@ IMoniker *pMonLeft = NULL; if (obMoniker!=Py_None) { if (!PyCom_InterfaceFromPyInstanceOrObject(obMoniker, IID_IMoniker, (void **)&pMonLeft, FALSE)) { - PY_INTERFACE_PRECALL; - pBindCtx->Release(); - PY_INTERFACE_POSTCALL; + PYCOM_RELEASE(pBindCtx); return NULL; } } diff -r eb5c1ebf9472 -r 02686d59297d com/win32com/src/extensions/PyIPropertyStorage.cpp --- a/com/win32com/src/extensions/PyIPropertyStorage.cpp Sat Aug 04 20:35:38 2012 -0400 |
From: <pyw...@li...> - 2012-08-05 00:38:49
|
changeset eb5c1ebf9472 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=eb5c1ebf9472 summary: Fix error cleanup in PyIEnumShellItems.Next() diffstat: com/win32comext/shell/src/PyIEnumShellItems.cpp | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-) diffs (36 lines): diff -r 2e3f7a91ef48 -r eb5c1ebf9472 com/win32comext/shell/src/PyIEnumShellItems.cpp --- a/com/win32comext/shell/src/PyIEnumShellItems.cpp Sat Aug 04 17:56:22 2012 -0400 +++ b/com/win32comext/shell/src/PyIEnumShellItems.cpp Sat Aug 04 20:35:38 2012 -0400 @@ -64,6 +64,9 @@ for ( i = celtFetched; i--; ) { PyObject *ob = PyCom_PyObjectFromIUnknown(rgVar[i], IID_IShellItem, FALSE); + // PyCom_PyObjectFromIUnknown always consumes the COM reference, so set the + // pointer to NULL allowing any remaining interfaces to be released on error. + rgVar[i] = NULL; if ( ob == NULL ) { Py_DECREF(result); @@ -73,14 +76,15 @@ PyTuple_SET_ITEM(result, i, ob); } } - /* ??? Could leak some of the returned interfaces if conversion fails, but how to tell - which ones have already been released when result is DECREF'd ? - Maybe always AddRef and always Release when done ??? - */ - if (result == NULL) + + // Release any remaining interfaces if conversion fails + if (result == NULL){ + PY_INTERFACE_PRECALL; for ( i = celtFetched; i--; ) - rgVar[1]->Release(); - + if (rgVar[i]) + rgVar[i]->Release(); + PY_INTERFACE_POSTCALL; + } delete [] rgVar; return result; } |
From: <pyw...@li...> - 2012-08-04 21:59:09
|
changeset 2e3f7a91ef48 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=2e3f7a91ef48 summary: Ensure that PyCom_PyObjectFromIUnknown always consumes the COM reference when bAddRef is FALSE diffstat: com/win32com/src/PyComHelpers.cpp | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diffs (25 lines): diff -r 8031b6d1b4dd -r 2e3f7a91ef48 com/win32com/src/PyComHelpers.cpp --- a/com/win32com/src/PyComHelpers.cpp Sun Jul 29 00:05:52 2012 -0400 +++ b/com/win32com/src/PyComHelpers.cpp Sat Aug 04 17:56:22 2012 -0400 @@ -122,8 +122,10 @@ // Look up the map, and create the object. PyObject *obiid = PyWinObject_FromIID(riid); - if (!obiid) return NULL; - + if (!obiid){ + POFIU_RELEASE_ON_FAILURE + return NULL; + } PyObject *createType = PyDict_GetItem(g_obPyCom_MapIIDToType, obiid); Py_DECREF(obiid); if (createType==NULL) { @@ -153,7 +155,7 @@ PyCom_LogF("Object %s created at 0x%0xld, IUnknown at 0x%0xld", myCreateType->tp_name, ret, ret->m_obj); #endif - if (ret && bAddRef && punk) punk->AddRef(); + if (ret && bAddRef) punk->AddRef(); return ret; } |
From: <pyw...@li...> - 2012-07-29 04:09:58
|
changeset 8031b6d1b4dd in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=8031b6d1b4dd summary: Add IEnumShellItems, and allow PyIShellItemArray to act as an iterator thru it diffstat: com/win32com/src/extensions/PyIDataObject.cpp | 11 +- com/win32com/src/include/PyIDataObject.h | 2 +- com/win32comext/shell/src/PyIEnumShellItems.cpp | 270 +++++++++++++++++++++++ com/win32comext/shell/src/PyIEnumShellItems.h | 51 ++++ com/win32comext/shell/src/PyIExplorerCommand.cpp | 6 +- com/win32comext/shell/src/PyIShellFolder.cpp | 4 +- com/win32comext/shell/src/PyIShellFolder2.cpp | 2 +- com/win32comext/shell/src/PyIShellItem.cpp | 2 +- com/win32comext/shell/src/PyIShellItemArray.cpp | 96 ++++---- com/win32comext/shell/src/PyIShellItemArray.h | 2 +- com/win32comext/shell/src/shell.cpp | 50 ++-- com/win32comext/shell/src/shell_pch.h | 2 - setup.py | 1 + win32/src/PyWinTypes.h | 6 +- 14 files changed, 414 insertions(+), 91 deletions(-) diffs (truncated from 855 to 300 lines): diff -r 06fd2a416c94 -r 8031b6d1b4dd com/win32com/src/extensions/PyIDataObject.cpp --- a/com/win32com/src/extensions/PyIDataObject.cpp Thu Jul 26 11:01:58 2012 -0400 +++ b/com/win32com/src/extensions/PyIDataObject.cpp Sun Jul 29 00:05:52 2012 -0400 @@ -299,11 +299,13 @@ return PyCom_PyObjectFromIUnknown(ppenumAdvise, IID_IEnumSTATDATA, FALSE); } -// @object PyIDataObject|Description of the interface +// @object PyIDataObject|Used to transfer data in various formats throughout the shell +// @comm Can be enumerated to return a series of <o PyFORMATETC> describing the formats +// that the object can render. static struct PyMethodDef PyIDataObject_methods[] = { { "GetData", PyIDataObject::GetData, 1 }, // @pymeth GetData|Retrieves data from the object in specified format - { "GetDataHere", PyIDataObject::GetDataHere, 1 }, // @pymeth GetDataHere|Retunrs a copy of the object's data in specified format + { "GetDataHere", PyIDataObject::GetDataHere, 1 }, // @pymeth GetDataHere|Returns a copy of the object's data in specified format { "QueryGetData", PyIDataObject::QueryGetData, 1 }, // @pymeth QueryGetData|Checks if the object supports returning data in a particular format { "GetCanonicalFormatEtc", PyIDataObject::GetCanonicalFormatEtc, 1 }, // @pymeth GetCanonicalFormatEtc|Transforms a FORMATECT data description into a general format that the object supports { "SetData", PyIDataObject::SetData, 1 }, // @pymeth SetData|Sets the data that the object will return. @@ -314,11 +316,12 @@ { NULL } }; -PyComTypeObject PyIDataObject::type("PyIDataObject", +PyComEnumProviderTypeObject PyIDataObject::type("PyIDataObject", &PyIUnknown::type, sizeof(PyIDataObject), PyIDataObject_methods, - GET_PYCOM_CTOR(PyIDataObject)); + GET_PYCOM_CTOR(PyIDataObject), + "EnumFormatEtc"); // --------------------------------------------------- // // Gateway Implementation diff -r 06fd2a416c94 -r 8031b6d1b4dd com/win32com/src/include/PyIDataObject.h --- a/com/win32com/src/include/PyIDataObject.h Thu Jul 26 11:01:58 2012 -0400 +++ b/com/win32com/src/include/PyIDataObject.h Sun Jul 29 00:05:52 2012 -0400 @@ -9,7 +9,7 @@ public: MAKE_PYCOM_CTOR(PyIDataObject); static IDataObject *GetI(PyObject *self); - static PyComTypeObject type; + static PyComEnumProviderTypeObject type; // The Python methods static PyObject *GetData(PyObject *self, PyObject *args); diff -r 06fd2a416c94 -r 8031b6d1b4dd com/win32comext/shell/src/PyIEnumShellItems.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com/win32comext/shell/src/PyIEnumShellItems.cpp Sun Jul 29 00:05:52 2012 -0400 @@ -0,0 +1,270 @@ +// This file implements the IEnumShellItems Interface and Gateway for Python. +// Generated by makegw.py + +#include "shell_pch.h" +#include "PyIEnumShellItems.h" + +// @doc - This file contains autoduck documentation + +// --------------------------------------------------- +// +// Interface Implementation + +PyIEnumShellItems::PyIEnumShellItems(IUnknown *pdisp): + PyIUnknown(pdisp) +{ + ob_type = &type; +} + +PyIEnumShellItems::~PyIEnumShellItems() +{ +} + +/* static */ IEnumShellItems *PyIEnumShellItems::GetI(PyObject *self) +{ + return (IEnumShellItems *)PyIUnknown::GetI(self); +} + +// @pymethod (o <PyIShellItem>,...)|PyIEnumShellItems|Next|Retrieves a specified number of items in the enumeration sequence. +PyObject *PyIEnumShellItems::Next(PyObject *self, PyObject *args) +{ + long celt = 1; + // @pyparm int|num|1|Number of items to retrieve. + if ( !PyArg_ParseTuple(args, "|l:Next", &celt) ) + return NULL; + + IEnumShellItems *pIEShellItems = GetI(self); + if ( pIEShellItems == NULL ) + return NULL; + + IShellItem **rgVar = new IShellItem *[celt]; + if ( rgVar == NULL ) { + PyErr_SetString(PyExc_MemoryError, "allocating result ShellItemss"); + return NULL; + } + + int i; +/* for ( i = celt; i--; ) + // *** possibly init each structure element??? +*/ + + ULONG celtFetched = 0; + PY_INTERFACE_PRECALL; + HRESULT hr = pIEShellItems->Next(celt, rgVar, &celtFetched); + PY_INTERFACE_POSTCALL; + if ( HRESULT_CODE(hr) != ERROR_NO_MORE_ITEMS && FAILED(hr) ) + { + delete [] rgVar; + return PyCom_BuildPyException(hr,pIEShellItems, IID_IEnumShellItems); + } + + PyObject *result = PyTuple_New(celtFetched); + if ( result != NULL ) + { + for ( i = celtFetched; i--; ) + { + PyObject *ob = PyCom_PyObjectFromIUnknown(rgVar[i], IID_IShellItem, FALSE); + if ( ob == NULL ) + { + Py_DECREF(result); + result = NULL; + break; + } + PyTuple_SET_ITEM(result, i, ob); + } + } + /* ??? Could leak some of the returned interfaces if conversion fails, but how to tell + which ones have already been released when result is DECREF'd ? + Maybe always AddRef and always Release when done ??? + */ + if (result == NULL) + for ( i = celtFetched; i--; ) + rgVar[1]->Release(); + + delete [] rgVar; + return result; +} + +// @pymethod |PyIEnumShellItems|Skip|Skips over the next specified elementes. +PyObject *PyIEnumShellItems::Skip(PyObject *self, PyObject *args) +{ + long celt; + if ( !PyArg_ParseTuple(args, "l:Skip", &celt) ) + return NULL; + + IEnumShellItems *pIEShellItems = GetI(self); + if ( pIEShellItems == NULL ) + return NULL; + + PY_INTERFACE_PRECALL; + HRESULT hr = pIEShellItems->Skip(celt); + PY_INTERFACE_POSTCALL; + if ( FAILED(hr) ) + return PyCom_BuildPyException(hr, pIEShellItems, IID_IEnumShellItems); + + Py_INCREF(Py_None); + return Py_None; +} + +// @pymethod |PyIEnumShellItems|Reset|Resets the enumeration sequence to the beginning. +PyObject *PyIEnumShellItems::Reset(PyObject *self, PyObject *args) +{ + if ( !PyArg_ParseTuple(args, ":Reset") ) + return NULL; + + IEnumShellItems *pIEShellItems = GetI(self); + if ( pIEShellItems == NULL ) + return NULL; + + PY_INTERFACE_PRECALL; + HRESULT hr = pIEShellItems->Reset(); + PY_INTERFACE_POSTCALL; + if ( FAILED(hr) ) + return PyCom_BuildPyException(hr, pIEShellItems, IID_IEnumShellItems); + + Py_INCREF(Py_None); + return Py_None; +} + +// @pymethod <o PyIEnumShellItems>|PyIEnumShellItems|Clone|Creates another enumerator that contains the same enumeration state as the current one +PyObject *PyIEnumShellItems::Clone(PyObject *self, PyObject *args) +{ + if ( !PyArg_ParseTuple(args, ":Clone") ) + return NULL; + + IEnumShellItems *pIEShellItems = GetI(self); + if ( pIEShellItems == NULL ) + return NULL; + + IEnumShellItems *pClone; + PY_INTERFACE_PRECALL; + HRESULT hr = pIEShellItems->Clone(&pClone); + PY_INTERFACE_POSTCALL; + if ( FAILED(hr) ) + return PyCom_BuildPyException(hr, pIEShellItems, IID_IEnumShellItems); + + return PyCom_PyObjectFromIUnknown(pClone, IID_IEnumShellItems, FALSE); +} + +// @object PyIEnumShellItems|A Python interface to IEnumShellItems +static struct PyMethodDef PyIEnumShellItems_methods[] = +{ + { "Next", PyIEnumShellItems::Next, 1 }, // @pymeth Next|Retrieves a specified number of items in the enumeration sequence. + { "Skip", PyIEnumShellItems::Skip, 1 }, // @pymeth Skip|Skips over the next specified elementes. + { "Reset", PyIEnumShellItems::Reset, 1 }, // @pymeth Reset|Resets the enumeration sequence to the beginning. + { "Clone", PyIEnumShellItems::Clone, 1 }, // @pymeth Clone|Creates another enumerator that contains the same enumeration state as the current one. + { NULL } +}; + +PyComEnumTypeObject PyIEnumShellItems::type("PyIEnumShellItems", + &PyIUnknown::type, + sizeof(PyIEnumShellItems), + PyIEnumShellItems_methods, + GET_PYCOM_CTOR(PyIEnumShellItems)); + +// --------------------------------------------------- +// +// Gateway Implementation +STDMETHODIMP PyGEnumShellItems::Next( + /* [in] */ ULONG celt, + /* [length_is][size_is][out] */ IShellItem __RPC_FAR * __RPC_FAR *rgVar, + /* [out] */ ULONG __RPC_FAR *pCeltFetched) +{ + PY_GATEWAY_METHOD; + PyObject *result; + HRESULT hr = InvokeViaPolicy("Next", &result, "i", celt); + if ( FAILED(hr) ) + return hr; + + if ( !PySequence_Check(result) ) + goto error; + int len; + len = PyObject_Length(result); + if ( len == -1 ) + goto error; + if ( len > (int)celt) + len = celt; + + if ( pCeltFetched ) + *pCeltFetched = len; + + int i; + for ( i = 0; i < len; ++i ) + { + PyObject *ob = PySequence_GetItem(result, i); + if ( ob == NULL ) + goto error; + + if ( !PyCom_InterfaceFromPyObject(ob, IID_IShellItem, (void **)&rgVar[i], FALSE) ) + { + Py_DECREF(result); + return PyCom_SetCOMErrorFromPyException(IID_IEnumShellItems); + } + } + + Py_DECREF(result); + + return len < (int)celt ? S_FALSE : S_OK; + + error: + PyErr_Clear(); // just in case + Py_DECREF(result); + return PyCom_SetCOMErrorFromSimple(E_FAIL, IID_IEnumShellItems, "Next() did not return a sequence of objects"); +} + +STDMETHODIMP PyGEnumShellItems::Skip( + /* [in] */ ULONG celt) +{ + PY_GATEWAY_METHOD; + return InvokeViaPolicy("Skip", NULL, "i", celt); +} + +STDMETHODIMP PyGEnumShellItems::Reset(void) +{ + PY_GATEWAY_METHOD; + return InvokeViaPolicy("Reset"); +} + +STDMETHODIMP PyGEnumShellItems::Clone( + /* [out] */ IEnumShellItems __RPC_FAR *__RPC_FAR *ppEnum) +{ + PY_GATEWAY_METHOD; + PyObject * result; + HRESULT hr = InvokeViaPolicy("Clone", &result); + if ( FAILED(hr) ) + return hr; + + /* + ** Make sure we have the right kind of object: we should have some kind + ** of IUnknown subclass wrapped into a PyIUnknown instance. + */ + if ( !PyIBase::is_object(result, &PyIUnknown::type) ) + { + /* the wrong kind of object was returned to us */ + Py_DECREF(result); + return PyCom_SetCOMErrorFromSimple(E_FAIL, IID_IEnumShellItems); + } + + /* + ** Get the IUnknown out of the thing. note that the Python ob maintains + ** a reference, so we don't have to explicitly AddRef() here. |
From: <pyw...@li...> - 2012-07-26 15:06:44
|
changeset 06fd2a416c94 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=06fd2a416c94 summary: Add IPersistSerializedPropStorage, PSGetPropertyFromPropertyStorage, and PSGetNamedPropertyFromPropertyStorage to propsys diffstat: com/win32comext/propsys/pscon.py | 3 + com/win32comext/propsys/src/PyIPersistSerializedPropStorage.cpp | 106 ++++++++++ com/win32comext/propsys/src/PyIPersistSerializedPropStorage.h | 22 ++ com/win32comext/propsys/src/propsys.cpp | 62 +++++- com/win32comext/shell/src/PyIShellFolder.cpp | 30 +- setup.py | 2 + 6 files changed, 209 insertions(+), 16 deletions(-) diffs (truncated from 343 to 300 lines): diff -r 170f15c339fb -r 06fd2a416c94 com/win32comext/propsys/pscon.py --- a/com/win32comext/propsys/pscon.py Tue Jul 24 21:58:50 2012 -0400 +++ b/com/win32comext/propsys/pscon.py Thu Jul 26 11:01:58 2012 -0400 @@ -138,6 +138,9 @@ COP_WORD_STARTSWITH = 13 COP_APPLICATION_SPECIFIC = 14 +## PERSIST_SPROPSTORE_FLAGS, used with IPersistSerializedPropStorage +FPSPS_READONLY = 1 + PKEY_PIDSTR_MAX = 10 # will take care of any long integer value #define GUIDSTRING_MAX (1 + 8 + 1 + 4 + 1 + 4 + 1 + 4 + 1 + 12 + 1 + 1) // "{12345678-1234-1234-1234-123456789012}" GUIDSTRING_MAX = (1 + 8 + 1 + 4 + 1 + 4 + 1 + 4 + 1 + 12 + 1 + 1) # hrm ??? diff -r 170f15c339fb -r 06fd2a416c94 com/win32comext/propsys/src/PyIPersistSerializedPropStorage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com/win32comext/propsys/src/PyIPersistSerializedPropStorage.cpp Thu Jul 26 11:01:58 2012 -0400 @@ -0,0 +1,106 @@ +// This file implements the IPersistSerializedPropStorage Interface for Python. +// Generated by makegw.py +#include "PythonCOM.h" +#include "propsys.h" +#include "PyIPersistSerializedPropStorage.h" + +// @doc - This file contains autoduck documentation +// --------------------------------------------------- +// +// Interface Implementation + +PyIPersistSerializedPropStorage::PyIPersistSerializedPropStorage(IUnknown *pdisp): + PyIUnknown(pdisp) +{ + ob_type = &type; +} + +PyIPersistSerializedPropStorage::~PyIPersistSerializedPropStorage() +{ +} + +/* static */ IPersistSerializedPropStorage *PyIPersistSerializedPropStorage::GetI(PyObject *self) +{ + return (IPersistSerializedPropStorage *)PyIUnknown::GetI(self); +} + +// @pymethod |PyIPersistSerializedPropStorage|SetFlags|Sets flags for the store +PyObject *PyIPersistSerializedPropStorage::SetFlags(PyObject *self, PyObject *args) +{ + IPersistSerializedPropStorage *pIPSPS = GetI(self); + if ( pIPSPS == NULL ) + return NULL; + PERSIST_SPROPSTORE_FLAGS flags; + // @pyparm int|flags||Combination of pscon.FPSPS_* values + if (!PyArg_ParseTuple(args, "i:SetFlags", &flags)) + return NULL; + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = pIPSPS->SetFlags( flags ); + PY_INTERFACE_POSTCALL; + + if ( FAILED(hr) ) + return PyCom_BuildPyException(hr, pIPSPS, IID_IPersistSerializedPropStorage ); + Py_INCREF(Py_None); + return Py_None; +} + +// @pymethod |PyIPersistSerializedPropStorage|SetPropertyStorage|Initializes the store with a serialized buffer +PyObject *PyIPersistSerializedPropStorage::SetPropertyStorage(PyObject *self, PyObject *args) +{ + IPersistSerializedPropStorage *pIPSPS = GetI(self); + if ( pIPSPS == NULL ) + return NULL; + PyObject *obbuf; + void *buf; + DWORD bufsize; + // @pyparm buffer|ps||Bytes or buffer object containing a serialized property store + if (!PyArg_ParseTuple(args, "O:SetPropertyStorage", &obbuf)) + return NULL; + if (!PyWinObject_AsReadBuffer(obbuf, &buf, &bufsize)) + return NULL; + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = pIPSPS->SetPropertyStorage((PUSERIALIZEDPROPSTORAGE)buf, bufsize); + PY_INTERFACE_POSTCALL; + + if ( FAILED(hr) ) + return PyCom_BuildPyException(hr, pIPSPS, IID_IPersistSerializedPropStorage ); + Py_INCREF(Py_None); + return Py_None; +} + +// @pymethod buffer|PyIPersistSerializedPropStorage|GetPropertyStorage|Retrieves the current contents of the property store +PyObject *PyIPersistSerializedPropStorage::GetPropertyStorage(PyObject *self, PyObject *args) +{ + IPersistSerializedPropStorage *pIPSPS = GetI(self); + if ( pIPSPS == NULL ) + return NULL; + PUSERIALIZEDPROPSTORAGE buf; + DWORD bufsize; + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = pIPSPS->GetPropertyStorage(&buf, &bufsize); + PY_INTERFACE_POSTCALL; + if ( FAILED(hr) ) + return PyCom_BuildPyException(hr, pIPSPS, IID_IPersistSerializedPropStorage ); + PyObject *ret = PyString_FromStringAndSize((char *)buf, bufsize); + CoTaskMemFree(buf); + return ret; +} + +// @object PyIPersistSerializedPropStorage|Allows a property store to be marshalled into a single buffer. +// Primarily used with property stores created using <om propsys.PSCreateMemoryPropertyStore>. +static struct PyMethodDef PyIPersistSerializedPropStorage_methods[] = +{ + { "SetFlags", PyIPersistSerializedPropStorage::SetFlags, 1 }, // @pymeth SetFlags|Sets flags for the store + { "SetPropertyStorage", PyIPersistSerializedPropStorage::SetPropertyStorage, 1 }, // @pymeth SetPropertyStorage|Initializes the store with a serialized buffer + { "GetPropertyStorage", PyIPersistSerializedPropStorage::GetPropertyStorage, METH_NOARGS }, // @pymeth GetPropertyStorage|Retrieves the current contents of the property store + { NULL } +}; + +PyComTypeObject PyIPersistSerializedPropStorage::type("PyIPersistSerializedPropStorage", + &PyIUnknown::type, + sizeof(PyIPersistSerializedPropStorage), + PyIPersistSerializedPropStorage_methods, + GET_PYCOM_CTOR(PyIPersistSerializedPropStorage)); diff -r 170f15c339fb -r 06fd2a416c94 com/win32comext/propsys/src/PyIPersistSerializedPropStorage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com/win32comext/propsys/src/PyIPersistSerializedPropStorage.h Thu Jul 26 11:01:58 2012 -0400 @@ -0,0 +1,22 @@ +// This file declares the IPersistSerializedPropStorage Interface for Python. +// Generated by makegw.py +// --------------------------------------------------- +// +// Interface Declaration + +class PyIPersistSerializedPropStorage : public PyIUnknown +{ +public: + MAKE_PYCOM_CTOR(PyIPersistSerializedPropStorage); + static IPersistSerializedPropStorage *GetI(PyObject *self); + static PyComTypeObject type; + + // The Python methods + static PyObject *SetFlags(PyObject *self, PyObject *args); + static PyObject *SetPropertyStorage(PyObject *self, PyObject *args); + static PyObject *GetPropertyStorage(PyObject *self, PyObject *args); + +protected: + PyIPersistSerializedPropStorage(IUnknown *pdisp); + ~PyIPersistSerializedPropStorage(); +}; diff -r 170f15c339fb -r 06fd2a416c94 com/win32comext/propsys/src/propsys.cpp --- a/com/win32comext/propsys/src/propsys.cpp Tue Jul 24 21:58:50 2012 -0400 +++ b/com/win32comext/propsys/src/propsys.cpp Thu Jul 26 11:01:58 2012 -0400 @@ -29,6 +29,7 @@ #include "PyIPropertyDescriptionAliasInfo.h" #include "PyIPropertyEnumType.h" #include "PyIPropertyEnumTypeList.h" +#include "PyIPersistSerializedPropStorage.h" #include "delayimp.h" #include "propvarutil.h" @@ -344,7 +345,7 @@ DWORD mode; IID riid = IID_IPropertyStore; void *ret; - // @pyparm <o PyIPropertySetStorage>||Property container to be adapted + // @pyparm <o PyIPropertySetStorage>|pss||Property container to be adapted // @pyparm int|Mode||Read or write mode, shellcon.STGM_*. Must match mode used to open input interface. // @pyparm <o PyIID>|riid|IID_IPropertyStore|The interface to create if (!PyArg_ParseTuple(args, "Ok|O&:PSCreatePropertyStoreFromPropertySetStorage", @@ -397,7 +398,7 @@ HWND hwnd; IID riid = IID_IPropertyStore; void *ret; - // @pyparm <o PyHANDLE>||Handle to a window + // @pyparm <o PyHANDLE>|hwnd||Handle to a window // @pyparm <o PyIID>|riid|IID_IPropertyStore|The interface to create if (!PyArg_ParseTuple(args, "O&|O&:SHGetPropertyStoreForWindow", PyWinObject_AsHANDLE, &hwnd, @@ -414,6 +415,60 @@ }; +// @pymethod <o PyPROPVARIANT>|propsys|PSGetPropertyFromPropertyStorage|Extracts a property value from a serialized buffer by key +static PyObject *PyPSGetPropertyFromPropertyStorage(PyObject *self, PyObject *args) +{ + PROPERTYKEY key; + void *buf; + DWORD bufsize; + PROPVARIANT val; + PyObject *obbuf; + // @pyparm buffer|ps||Bytes or buffer (or str in python 2) containing a serialized property set (see <om PyIPersistSerializedPropStorage.GetPropertyStorage>) + // @pyparm <o PyPROPERTYKEY>|key||Property to return + if (!PyArg_ParseTuple(args, "OO&:PSGetPropertyFromPropertyStorage", + &obbuf, PyWinObject_AsPROPERTYKEY, &key)) + return NULL; + if (!PyWinObject_AsReadBuffer(obbuf, &buf, &bufsize, FALSE)) + return NULL; + + HRESULT hr; + PY_INTERFACE_PRECALL; + // PCUSERIALIZEDPROPSTORAGE psps, // IPersistSerializedPropStorage::GetPropertyStorage + hr = PSGetPropertyFromPropertyStorage((PCUSERIALIZEDPROPSTORAGE)buf, bufsize, key, &val); + PY_INTERFACE_POSTCALL; + if (FAILED(hr)) + return PyCom_BuildPyException(hr); + return PyWinObject_FromPROPVARIANT(val); +} + +// @pymethod <o PyPROPVARIANT>|propsys|PSGetNamedPropertyFromPropertyStorage|Extracts a property value from a serialized buffer by name +static PyObject *PyPSGetNamedPropertyFromPropertyStorage(PyObject *self, PyObject *args) +{ + TmpWCHAR name; + void *buf; + DWORD bufsize; + PROPVARIANT val; + PyObject *obname, *obbuf; + // @pyparm buffer|ps||Bytes or buffer (or str in python 2) containing a serialized property set (see <om PyIPersistSerializedPropStorage.GetPropertyStorage>) + // @pyparm str|name||Property to return + if (!PyArg_ParseTuple(args, "OO:PSGetNamedPropertyFromPropertyStorage", + &obbuf, &obname)) + return NULL; + if (!PyWinObject_AsReadBuffer(obbuf, &buf, &bufsize, FALSE)) + return NULL; + if (!PyWinObject_AsWCHAR(obname, &name, FALSE)) + return NULL; + + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = PSGetNamedPropertyFromPropertyStorage((PCUSERIALIZEDPROPSTORAGE)buf, bufsize, name, &val); + PY_INTERFACE_POSTCALL; + if (FAILED(hr)) + return PyCom_BuildPyException(hr); + return PyWinObject_FromPROPVARIANT(val); +} + + /* List of module functions */ // @module propsys|A module, encapsulating the Vista Property System interfaces static struct PyMethodDef propsys_methods[]= @@ -433,6 +488,8 @@ { "PSCreatePropertyStoreFromPropertySetStorage", PyPSCreatePropertyStoreFromPropertySetStorage, 1 }, // @pymeth PSCreatePropertyStoreFromPropertySetStorage|Wraps a <o PyIPropertySetStorage> interface in a <o PyIPropertyStore> object { "PSLookupPropertyHandlerCLSID", PyPSLookupPropertyHandlerCLSID, 1 }, // @pymeth PSLookupPropertyHandlerCLSID|Returns the GUID of the property handler for a file { "SHGetPropertyStoreForWindow", PySHGetPropertyStoreForWindow, 1 }, // @pymeth SHGetPropertyStoreForWindow|Retrieves a collection of a window's properties + { "PSGetPropertyFromPropertyStorage", PyPSGetPropertyFromPropertyStorage, 1 }, // @pymeth PSGetPropertyFromPropertyStorage|Extracts a property from a serialized buffer by key + { "PSGetNamedPropertyFromPropertyStorage", PyPSGetNamedPropertyFromPropertyStorage, 1 }, // @pymeth PSGetNamedPropertyFromPropertyStorage|Extracts a property from a serialized buffer by name { NULL, NULL }, }; @@ -452,6 +509,7 @@ PYCOM_INTERFACE_CLIENT_ONLY (PropertySystem), PYCOM_INTERFACE_CLIENT_ONLY (PropertyEnumType), PYCOM_INTERFACE_CLIENT_ONLY (PropertyEnumTypeList), + PYCOM_INTERFACE_CLIENT_ONLY (PersistSerializedPropStorage), }; /* Module initialisation */ diff -r 170f15c339fb -r 06fd2a416c94 com/win32comext/shell/src/PyIShellFolder.cpp --- a/com/win32comext/shell/src/PyIShellFolder.cpp Tue Jul 24 21:58:50 2012 -0400 +++ b/com/win32comext/shell/src/PyIShellFolder.cpp Thu Jul 26 11:01:58 2012 -0400 @@ -298,6 +298,7 @@ } // @pymethod int, <o PyIUnknown>|PyIShellFolder|GetUIObjectOf|Creates an interface to one or more items in a shell folder +// @rdesc Returns the Reserved parameter and the requested interface PyObject *PyIShellFolder::GetUIObjectOf(PyObject *self, PyObject *args) { IShellFolder *pISF = GetI(self); @@ -306,7 +307,11 @@ // @pyparm <o PyHANDLE>|hwndOwner||Specifies a window in which to display any required dialogs or errors, can be 0 // @pyparm (<o PyIDL>,...)|pidl||A sequence of single-level pidls identifying items in the folder // @pyparm <o PyIID>|riid||The interface to create, one of IID_IContextMenu, IID_IContextMenu2, IID_IDataObject, IID_IDropTarget, IID_IExtractIcon, IID_IQueryInfo - // @pyparm int|rgfReserved|0|Reserved, use 0 if passed in + // @pyparm int|Reserved|0|Reserved, use 0 if passed in + // @pyparm <o PyIID>|iidout|riid|The interface to return. Can be used in the case where there is not a + // python wrapper for the desired interface. You must make certain that the interface identified by riid + // actually supports the iidout interface, or Bad Things Will Happen. + // It should always be safe to return <o PyIUnknown>, which is the base for all interfaces. PyObject *obpidl; PyObject *obriid; PyObject *obiidout = NULL; @@ -315,20 +320,22 @@ UINT cidl; LPCITEMIDLIST *pidl; IID riid, iidout; - UINT rgfInOut; + UINT rgfInOut = 0; void * out; - if ( !PyArg_ParseTuple(args, "OOOl|O:GetUIObjectOf", &obhwndOwner, &obpidl, &obriid, &rgfInOut, &obiidout) ) + if ( !PyArg_ParseTuple(args, "OOO|lO:GetUIObjectOf", &obhwndOwner, &obpidl, &obriid, &rgfInOut, &obiidout) ) return NULL; if (!PyWinObject_AsHANDLE(obhwndOwner, (HANDLE *)&hwndOwner)) return NULL; - BOOL bPythonIsHappy = TRUE; - if (!PyWinObject_AsIID(obriid, &riid)) bPythonIsHappy = FALSE; + if (!PyWinObject_AsIID(obriid, &riid)) + return NULL; if (obiidout==NULL) iidout = riid; else - if (!PyWinObject_AsIID(obiidout, &iidout)) bPythonIsHappy = FALSE; |
From: <pyw...@li...> - 2012-07-25 02:01:21
|
changeset 170f15c339fb in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=170f15c339fb summary: When registering a COM server from Pythonwin and elevation is required, run diffstat: com/win32com/server/register.py | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-) diffs (31 lines): diff -r 433b264e9fbe -r 170f15c339fb com/win32com/server/register.py --- a/com/win32com/server/register.py Mon Jul 23 23:13:52 2012 -0400 +++ b/com/win32com/server/register.py Tue Jul 24 21:58:50 2012 -0400 @@ -517,6 +517,18 @@ tempbase = tempfile.mktemp("pycomserverreg") outfile = tempbase + ".out" batfile = tempbase + ".bat" + + # If registering from pythonwin, need to run python console instead since + # pythonwin will just open script for editting + current_exe = os.path.split(sys.executable)[1].lower() + exe_to_run = None + if current_exe == 'pythonwin.exe': + exe_to_run = os.path.join(sys.prefix, 'python.exe') + elif current_exe == 'pythonwin_d.exe': + exe_to_run = os.path.join(sys.prefix, 'python_d.exe') + if not exe_to_run or not os.path.exists(exe_to_run): + exe_to_run = sys.executable + try: batf = open(batfile, "w") try: @@ -528,7 +540,7 @@ # may be on a different drive - select that before attempting to CD. print >> batf, os.path.splitdrive(cwd)[0] print >> batf, 'cd "%s"' % os.getcwd() - print >> batf, '%s %s > "%s" 2>&1' % (win32api.GetShortPathName(sys.executable), new_params, outfile) + print >> batf, '%s %s > "%s" 2>&1' % (win32api.GetShortPathName(exe_to_run), new_params, outfile) finally: batf.close() executable = os.environ.get('COMSPEC', 'cmd.exe') |
From: <pyw...@li...> - 2012-07-24 04:48:36
|
changeset 433b264e9fbe in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=433b264e9fbe summary: Add PSCreatePropertyStoreFromPropertySetStorage, PSLookupPropertyHandlerCLSID, and SHGetPropertyStoreForWindow to propsys diffstat: com/win32comext/propsys/pscon.py | 9 ++ com/win32comext/propsys/src/propsys.cpp | 101 ++++++++++++++++++++++++++- com/win32comext/shell/shellcon.py | 42 +++++++++++ com/win32comext/shell/src/PyIContextMenu.cpp | 13 ++- 4 files changed, 160 insertions(+), 5 deletions(-) diffs (256 lines): diff -r 7a8b207998e0 -r 433b264e9fbe com/win32comext/propsys/pscon.py --- a/com/win32comext/propsys/pscon.py Fri Jul 20 10:23:03 2012 -0400 +++ b/com/win32comext/propsys/pscon.py Mon Jul 23 23:13:52 2012 -0400 @@ -705,3 +705,12 @@ PKEY_Volume_FileSystem = (IID('{9B174B35-40FF-11D2-A27E-00C04FC30871}'), 4) PKEY_Volume_IsMappedDrive = (IID('{149C0B69-2C2D-48FC-808F-D318D78C4636}'), 2) PKEY_Volume_IsRoot = (IID('{9B174B35-40FF-11D2-A27E-00C04FC30871}'), 10) + +PKEY_AppUserModel_RelaunchCommand = (IID('{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}'), 2) +PKEY_AppUserModel_RelaunchIconResource = (IID('{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}'), 3) +PKEY_AppUserModel_RelaunchDisplayNameResource = (IID('{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}'), 4) +PKEY_AppUserModel_ID = (IID('{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}'), 5) +PKEY_AppUserModel_IsDestListSeparator = (IID('{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}'), 6) +PKEY_AppUserModel_ExcludeFromShowInNewInstall = (IID('{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}'), 8) +PKEY_AppUserModel_PreventPinning = (IID('{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}'), 9) + diff -r 7a8b207998e0 -r 433b264e9fbe com/win32comext/propsys/src/propsys.cpp --- a/com/win32comext/propsys/src/propsys.cpp Fri Jul 20 10:23:03 2012 -0400 +++ b/com/win32comext/propsys/src/propsys.cpp Mon Jul 23 23:13:52 2012 -0400 @@ -34,6 +34,11 @@ #include "propvarutil.h" #include "Shobjidl.h" +#define CHECK_PFN(fname)if (pfn##fname==NULL) return PyErr_Format(PyExc_NotImplementedError,"%s is not available on this platform", #fname); +// Not available on Vista or earlier +typedef HRESULT (WINAPI *PFNSHGetPropertyStoreForWindow)(HWND, REFIID, void **); +static PFNSHGetPropertyStoreForWindow pfnSHGetPropertyStoreForWindow = NULL; + // @object PyPROPERTYKEY|A tuple of a fmtid and property id (IID, int) that uniquely identifies a property BOOL PyWinObject_AsPROPERTYKEY(PyObject *obkey, PROPERTYKEY *pkey) { @@ -280,7 +285,9 @@ // @pyparm <o PyPROPVARIANT>|propvar||The value to serialize if (!PyArg_ParseTuple(args, "O&:StgSerializePropVariant", PyWinObject_AsPROPVARIANT, &pv)) return NULL; + PY_INTERFACE_PRECALL; hr = StgSerializePropVariant(pv, &pspv, &bufsize); + PY_INTERFACE_POSTCALL; if (FAILED(hr)) return PyCom_BuildPyException(hr); PyObject *ret = PyString_FromStringAndSize((char *)pspv, bufsize); @@ -301,7 +308,9 @@ // @pyparm bytes|prop||Buffer or bytes object (or str in Python 2) containing a serialized value if (!PyWinObject_AsReadBuffer(ob, (void **)&pspv, &bufsize)) return NULL; + PY_INTERFACE_PRECALL; hr = StgDeserializePropVariant(pspv, bufsize, &pv); + PY_INTERFACE_POSTCALL; if (FAILED(hr)) return PyCom_BuildPyException(hr); return PyWinObject_FromPROPVARIANT(&pv); @@ -316,7 +325,89 @@ // @pyparm <o PyIID>|riid|IID_IPropertyStore|The interface to create if (!PyArg_ParseTuple(args, "|O&:PSCreateMemoryPropertyStore", PyWinObject_AsIID, &riid)) return NULL; - HRESULT hr = PSCreateMemoryPropertyStore(riid, &ret); + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = PSCreateMemoryPropertyStore(riid, &ret); + PY_INTERFACE_POSTCALL; + if (FAILED(hr)) + return PyCom_BuildPyException(hr); + return PyCom_PyObjectFromIUnknown((IUnknown *) ret, riid); +}; + +// @pymethod <o PyIPropertyStore>|propsys|PSCreatePropertyStoreFromPropertySetStorage|Wraps a <o PyIPropertySetStorage> interface in a <o PyIPropertyStore> object +// @comm This function does not work for the NTFS property storage implementation based on +// alternate data streams. +static PyObject *PyPSCreatePropertyStoreFromPropertySetStorage(PyObject *self, PyObject *args) +{ + PyObject *obpss; + IPropertySetStorage *pipss; + DWORD mode; + IID riid = IID_IPropertyStore; + void *ret; + // @pyparm <o PyIPropertySetStorage>||Property container to be adapted + // @pyparm int|Mode||Read or write mode, shellcon.STGM_*. Must match mode used to open input interface. + // @pyparm <o PyIID>|riid|IID_IPropertyStore|The interface to create + if (!PyArg_ParseTuple(args, "Ok|O&:PSCreatePropertyStoreFromPropertySetStorage", + &obpss, &mode, + PyWinObject_AsIID, &riid)) + return NULL; + if (!PyCom_InterfaceFromPyInstanceOrObject(obpss, IID_IPropertySetStorage, (void **)&pipss, FALSE)) + return NULL; + + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = PSCreateMemoryPropertyStore(riid, &ret); + pipss->Release(); + PY_INTERFACE_POSTCALL; + if (FAILED(hr)) + return PyCom_BuildPyException(hr); + return PyCom_PyObjectFromIUnknown((IUnknown *) ret, riid); +}; + +// @pymethod <o PyIID>|propsys|PSLookupPropertyHandlerCLSID|Returns the GUID of the property handler for a file +// @comm If no handler is found, the returned error code can be deceptive as it seems to indicate +// that the file itself was not found +static PyObject *PyPSLookupPropertyHandlerCLSID(PyObject *self, PyObject *args) +{ + PyObject *obfname; + TmpWCHAR fname; + // @pyparm str|FilePath||Name of file + IID iid; + if (!PyArg_ParseTuple(args, "O:PSLookupPropertyHandlerCLSID", &obfname)) + return NULL; + if (!PyWinObject_AsWCHAR(obfname, &fname, FALSE)) + return NULL; + + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = PSLookupPropertyHandlerCLSID(fname, &iid); + PY_INTERFACE_POSTCALL; + if (FAILED(hr)) + return PyCom_BuildPyException(hr); + return PyWinObject_FromIID(iid); +}; + +// @pymethod <o PyIPropertyStore>|propsys|SHGetPropertyStoreForWindow|Retrieves a collection of a window's properties +// @comm Requires Windows 7 or later. +// @rdesc The returned store can be used to set the System.AppUserModel.ID property that determines how windows +// are grouped on the taskbar +static PyObject *PySHGetPropertyStoreForWindow(PyObject *self, PyObject *args) +{ + CHECK_PFN(SHGetPropertyStoreForWindow); + HWND hwnd; + IID riid = IID_IPropertyStore; + void *ret; + // @pyparm <o PyHANDLE>||Handle to a window + // @pyparm <o PyIID>|riid|IID_IPropertyStore|The interface to create + if (!PyArg_ParseTuple(args, "O&|O&:SHGetPropertyStoreForWindow", + PyWinObject_AsHANDLE, &hwnd, + PyWinObject_AsIID, &riid)) + return NULL; + + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = (*pfnSHGetPropertyStoreForWindow)(hwnd, riid, &ret); + PY_INTERFACE_POSTCALL; if (FAILED(hr)) return PyCom_BuildPyException(hr); return PyCom_PyObjectFromIUnknown((IUnknown *) ret, riid); @@ -339,6 +430,9 @@ { "StgSerializePropVariant", PyStgSerializePropVariant, 1 }, // @pymeth StgSerializePropVariant|Serializes a <o PyPROPVARIANT> { "StgDeserializePropVariant", PyStgDeserializePropVariant, 1 }, // @pymeth StgDeserializePropVariant|Creates a <o PyPROPVARIANT> from a serialized buffer { "PSCreateMemoryPropertyStore", PyPSCreateMemoryPropertyStore, 1 }, // @pymeth PSCreateMemoryPropertyStore|Creates a temporary property store that is not connected to any backing storage + { "PSCreatePropertyStoreFromPropertySetStorage", PyPSCreatePropertyStoreFromPropertySetStorage, 1 }, // @pymeth PSCreatePropertyStoreFromPropertySetStorage|Wraps a <o PyIPropertySetStorage> interface in a <o PyIPropertyStore> object + { "PSLookupPropertyHandlerCLSID", PyPSLookupPropertyHandlerCLSID, 1 }, // @pymeth PSLookupPropertyHandlerCLSID|Returns the GUID of the property handler for a file + { "SHGetPropertyStoreForWindow", PySHGetPropertyStoreForWindow, 1 }, // @pymeth SHGetPropertyStoreForWindow|Retrieves a collection of a window's properties { NULL, NULL }, }; @@ -380,5 +474,10 @@ if (PyCom_RegisterExtensionSupport(dict, g_interfaceSupportData, sizeof(g_interfaceSupportData)/sizeof(PyCom_InterfaceSupportInfo)) != 0) PYWIN_MODULE_INIT_RETURN_ERROR; + + HMODULE hmod = GetModuleHandle(L"shell32.dll"); + if (hmod) + pfnSHGetPropertyStoreForWindow = (PFNSHGetPropertyStoreForWindow)GetProcAddress(hmod, "SHGetPropertyStoreForWindow"); + PYWIN_MODULE_INIT_RETURN_SUCCESS; } diff -r 7a8b207998e0 -r 433b264e9fbe com/win32comext/shell/shellcon.py --- a/com/win32comext/shell/shellcon.py Fri Jul 20 10:23:03 2012 -0400 +++ b/com/win32comext/shell/shellcon.py Mon Jul 23 23:13:52 2012 -0400 @@ -1244,3 +1244,45 @@ GPS_DELAYCREATION = 0x20 GPS_BESTEFFORT = 0x40 GPS_MASK_VALID = 0x7f + +## Bind context parameter names, used with IBindCtx::RegisterObjectParam +STR_AVOID_DRIVE_RESTRICTION_POLICY = "Avoid Drive Restriction Policy" +STR_BIND_DELEGATE_CREATE_OBJECT = "Delegate Object Creation" +STR_BIND_FOLDERS_READ_ONLY = "Folders As Read Only" +STR_BIND_FOLDER_ENUM_MODE = "Folder Enum Mode" +STR_BIND_FORCE_FOLDER_SHORTCUT_RESOLVE = "Force Folder Shortcut Resolve" +STR_DONT_PARSE_RELATIVE = "Don't Parse Relative" +STR_DONT_RESOLVE_LINK = "Don't Resolve Link" +## STR_ENUM_ITEMS_FLAGS +STR_FILE_SYS_BIND_DATA = "File System Bind Data" +STR_GET_ASYNC_HANDLER = "GetAsyncHandler" +STR_GPS_BESTEFFORT = "GPS_BESTEFFORT" +STR_GPS_DELAYCREATION = "GPS_DELAYCREATION" +STR_GPS_FASTPROPERTIESONLY = "GPS_FASTPROPERTIESONLY" +STR_GPS_HANDLERPROPERTIESONLY = "GPS_HANDLERPROPERTIESONLY" +STR_GPS_NO_OPLOCK = "GPS_NO_OPLOCK" +STR_GPS_OPENSLOWITEM = "GPS_OPENSLOWITEM" +STR_IFILTER_FORCE_TEXT_FILTER_FALLBACK = "Always bind persistent handlers" +STR_IFILTER_LOAD_DEFINED_FILTER = "Only bind registered persistent handlers" +STR_INTERNAL_NAVIGATE = "Internal Navigation" +STR_INTERNETFOLDER_PARSE_ONLY_URLMON_BINDABLE = "Validate URL" +STR_ITEM_CACHE_CONTEXT = "ItemCacheContext" +STR_NO_VALIDATE_FILENAME_CHARS = "NoValidateFilenameChars" +STR_PARSE_ALLOW_INTERNET_SHELL_FOLDERS = "Allow binding to Internet shell folder handlers and negate STR_PARSE_PREFER_WEB_BROWSING" +STR_PARSE_AND_CREATE_ITEM = "ParseAndCreateItem" +STR_PARSE_DONT_REQUIRE_VALIDATED_URLS = "Do not require validated URLs" +STR_PARSE_EXPLICIT_ASSOCIATION_SUCCESSFUL = "ExplicitAssociationSuccessful" +STR_PARSE_PARTIAL_IDLIST = "ParseOriginalItem" +STR_PARSE_PREFER_FOLDER_BROWSING = "Parse Prefer Folder Browsing" +STR_PARSE_PREFER_WEB_BROWSING = "Do not bind to Internet shell folder handlers" +STR_PARSE_PROPERTYSTORE = "DelegateNamedProperties" +STR_PARSE_SHELL_PROTOCOL_TO_FILE_OBJECTS = "Parse Shell Protocol To File Objects" +STR_PARSE_SHOW_NET_DIAGNOSTICS_UI = "Show network diagnostics UI" +STR_PARSE_SKIP_NET_CACHE = "Skip Net Resource Cache" +STR_PARSE_TRANSLATE_ALIASES = "Parse Translate Aliases" +STR_PARSE_WITH_EXPLICIT_ASSOCAPP = "ExplicitAssociationApp" +STR_PARSE_WITH_EXPLICIT_PROGID = "ExplicitProgid" +STR_PARSE_WITH_PROPERTIES = "ParseWithProperties" +## STR_PROPERTYBAG_PARAM +STR_SKIP_BINDING_CLSID = "Skip Binding CLSID" +STR_TRACK_CLSID = "Track the CLSID" diff -r 7a8b207998e0 -r 433b264e9fbe com/win32comext/shell/src/PyIContextMenu.cpp --- a/com/win32comext/shell/src/PyIContextMenu.cpp Fri Jul 20 10:23:03 2012 -0400 +++ b/com/win32comext/shell/src/PyIContextMenu.cpp Mon Jul 23 23:13:52 2012 -0400 @@ -24,7 +24,7 @@ return (IContextMenu *)PyIUnknown::GetI(self); } -// @pymethod |PyIContextMenu|QueryContextMenu|Adds options to a context menu +// @pymethod int|PyIContextMenu|QueryContextMenu|Adds options to a context menu PyObject *PyIContextMenu::QueryContextMenu(PyObject *self, PyObject *args) { IContextMenu *pICM = GetI(self); @@ -83,7 +83,7 @@ } -// @pymethod |PyIContextMenu|GetCommandString|Retrieves verb or help text for a context menu option +// @pymethod str|PyIContextMenu|GetCommandString|Retrieves verb or help text for a context menu option PyObject *PyIContextMenu::GetCommandString(PyObject *self, PyObject *args) { IContextMenu *pICM = GetI(self); @@ -97,7 +97,8 @@ UINT cchMax = 2048; if ( !PyArg_ParseTuple(args, "OI|I:GetCommandString", &obCmd, &uType, &cchMax) ) return NULL; - + if (uType & GCS_UNICODE) + cchMax *= sizeof(WCHAR); // buffer size is in characters UINT_PTR idCmd; if (!PyWinLong_AsULONG_PTR(obCmd, (ULONG_PTR *)&idCmd)) return NULL; @@ -114,7 +115,11 @@ free(buf); return PyCom_BuildPyException(hr, pICM, IID_IContextMenu ); } - PyObject *ret = PyString_FromString(buf); + PyObject *ret; + if (uType & GCS_UNICODE) + ret = PyWinObject_FromWCHAR((WCHAR *)buf); + else + ret = PyString_FromString(buf); free(buf); return ret; |
From: <pyw...@li...> - 2012-07-20 14:33:47
|
changeset 7a8b207998e0 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=7a8b207998e0 summary: More autoduck fixes diffstat: com/win32comext/propsys/src/PyIPropertyDescription.cpp | 5 +++-- com/win32comext/propsys/src/PyIPropertyEnumType.cpp | 2 +- com/win32comext/propsys/src/propsys.cpp | 3 +-- 3 files changed, 5 insertions(+), 5 deletions(-) diffs (61 lines): diff -r ae4aec079b11 -r 7a8b207998e0 com/win32comext/propsys/src/PyIPropertyDescription.cpp --- a/com/win32comext/propsys/src/PyIPropertyDescription.cpp Thu Jul 19 15:53:27 2012 +1000 +++ b/com/win32comext/propsys/src/PyIPropertyDescription.cpp Fri Jul 20 10:23:03 2012 -0400 @@ -264,6 +264,8 @@ PROPVARIANT *v1, *v2; PyObject *obv1, *obv2; WCHAR *desc1=NULL, *desc2=NULL; + // @pyparm <o PyPROPVARIANT>|var1||The first value + // @pyparm <o PyPROPVARIANT>|var2||The second value if ( !PyArg_ParseTuple(args, "OO:GetRelativeDescription", &obv1, &obv2)) return NULL; if (!PyWinObject_AsPROPVARIANT(obv1, &v1)) @@ -365,7 +367,6 @@ } // @pymethod <o PyIPropertyEnumTypeList>|PyIPropertyDescription|GetEnumTypeList|Returns an interface used for querying valid property range -// @comm IPropertyEnumTypeList is not supported yet PyObject *PyIPropertyDescription::GetEnumTypeList(PyObject *self, PyObject *args) { IPropertyDescription *pIPD = GetI(self); @@ -421,7 +422,7 @@ PROPDESC_FORMAT_FLAGS flags = PDFF_DEFAULT; WCHAR *display=NULL; PyObject *obval; - // @pyparm PROPVARIANT|Value||The value to be formatted + // @pyparm <o PyPROPVARIANT>|Value||The value to be formatted // @pyparm int|Flags|PDFF_DEFAULT|Combination of PROPDESC_FORMAT_FLAGS (PDFF_*) if (!PyArg_ParseTuple(args, "O|i:FormatForDisplay", &obval, &flags)) return NULL; diff -r ae4aec079b11 -r 7a8b207998e0 com/win32comext/propsys/src/PyIPropertyEnumType.cpp --- a/com/win32comext/propsys/src/PyIPropertyEnumType.cpp Thu Jul 19 15:53:27 2012 +1000 +++ b/com/win32comext/propsys/src/PyIPropertyEnumType.cpp Fri Jul 20 10:23:03 2012 -0400 @@ -109,7 +109,7 @@ return ret; } -// @object PyIPropertyEnumType|Description of the interface +// @object PyIPropertyEnumType|Contains information about an allowable value or range for a property static struct PyMethodDef PyIPropertyEnumType_methods[] = { { "GetEnumType", PyIPropertyEnumType::GetEnumType, METH_NOARGS }, // @pymeth GetEnumType|Retrieves the type (PROPENUMTYPE) diff -r ae4aec079b11 -r 7a8b207998e0 com/win32comext/propsys/src/propsys.cpp --- a/com/win32comext/propsys/src/propsys.cpp Thu Jul 19 15:53:27 2012 +1000 +++ b/com/win32comext/propsys/src/propsys.cpp Fri Jul 20 10:23:03 2012 -0400 @@ -191,7 +191,7 @@ PyWinObject_AsIID, &riid)) return NULL; if (!PyWinObject_AsWCHAR(obpath, &path, FALSE)) - return FALSE; + return NULL; if (!PyCom_InterfaceFromPyInstanceOrObject(obbindctx, IID_IBindCtx, (void **)&bindctx)) return NULL; @@ -273,7 +273,6 @@ // @pymethod bytes|propsys|StgSerializePropVariant|Serializes a <o PyPROPVARIANT> static PyObject *PyStgSerializePropVariant(PyObject *self, PyObject *args) { - int tmp = sizeof(PROPDESC_DISPLAYTYPE); PROPVARIANT *pv; SERIALIZEDPROPERTYVALUE *pspv=NULL; ULONG bufsize; |
From: <pyw...@li...> - 2012-07-19 05:53:32
|
changeset ae4aec079b11 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=ae4aec079b11 summary: fix compile error attempting to use 0 as the default value for an enum diffstat: com/win32comext/propsys/src/PyIPropertyDescription.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (17 lines): diff -r 686032d6a1d3 -r ae4aec079b11 com/win32comext/propsys/src/PyIPropertyDescription.cpp --- a/com/win32comext/propsys/src/PyIPropertyDescription.cpp Tue Jul 17 22:13:45 2012 -0400 +++ b/com/win32comext/propsys/src/PyIPropertyDescription.cpp Thu Jul 19 15:53:27 2012 +1000 @@ -418,11 +418,11 @@ if ( pIPD == NULL ) return NULL; PROPVARIANT *val; - PROPDESC_FORMAT_FLAGS flags = 0; + PROPDESC_FORMAT_FLAGS flags = PDFF_DEFAULT; WCHAR *display=NULL; PyObject *obval; // @pyparm PROPVARIANT|Value||The value to be formatted - // @pyparm int|Flags|0|Combination of PROPDESC_FORMAT_FLAGS (PDFF_*) + // @pyparm int|Flags|PDFF_DEFAULT|Combination of PROPDESC_FORMAT_FLAGS (PDFF_*) if (!PyArg_ParseTuple(args, "O|i:FormatForDisplay", &obval, &flags)) return NULL; if (!PyWinObject_AsPROPVARIANT(obval, &val)) |
From: <pyw...@li...> - 2012-07-18 02:18:31
|
changeset 686032d6a1d3 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=686032d6a1d3 summary: Add handler id's for BindToHandler, more autoduck improvements diffstat: com/win32comext/shell/src/PyIShellItem.cpp | 58 +++++++++++++++--------------- com/win32comext/shell/src/shell.cpp | 15 +++++++ 2 files changed, 44 insertions(+), 29 deletions(-) diffs (168 lines): diff -r fb67af61d37a -r 686032d6a1d3 com/win32comext/shell/src/PyIShellItem.cpp --- a/com/win32comext/shell/src/PyIShellItem.cpp Tue Jul 17 00:18:49 2012 -0400 +++ b/com/win32comext/shell/src/PyIShellItem.cpp Tue Jul 17 22:13:45 2012 -0400 @@ -24,15 +24,15 @@ return (IShellItem *)PyIUnknown::GetI(self); } -// @pymethod |PyIShellItem|BindToHandler|Description of BindToHandler. +// @pymethod interface|PyIShellItem|BindToHandler|Creates an instance of one of the item's handlers PyObject *PyIShellItem::BindToHandler(PyObject *self, PyObject *args) { IShellItem *pISI = GetI(self); if ( pISI == NULL ) return NULL; - // @pyparm <o PyIBindCtx>|pbc||Description for pbc - // @pyparm <o PyIID>|bhid||Description for bhid - // @pyparm <o PyIID>|riid||Description for riid + // @pyparm <o PyIBindCtx>|pbc||Used to pass parameters that influence the binding operation, can be None + // @pyparm <o PyIID>|bhid||GUID that identifies a handler (shell.BHID_*) + // @pyparm <o PyIID>|riid||The interface to return PyObject *obpbc; PyObject *obbhid; PyObject *obriid; @@ -42,12 +42,12 @@ void *pv; if ( !PyArg_ParseTuple(args, "OOO:BindToHandler", &obpbc, &obbhid, &obriid) ) return NULL; - BOOL bPythonIsHappy = TRUE; - if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpbc, IID_IBindCtx, (void **)&pbc, TRUE /* bNoneOK */)) - bPythonIsHappy = FALSE; - if (!PyWinObject_AsIID(obbhid, &bhid)) bPythonIsHappy = FALSE; - if (!PyWinObject_AsIID(obriid, &riid)) bPythonIsHappy = FALSE; - if (!bPythonIsHappy) return NULL; + if (!PyWinObject_AsIID(obbhid, &bhid)) + return NULL; + if (!PyWinObject_AsIID(obriid, &riid)) + return NULL; + if (!PyCom_InterfaceFromPyInstanceOrObject(obpbc, IID_IBindCtx, (void **)&pbc, TRUE /* bNoneOK */)) + return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISI->BindToHandler( pbc, bhid, riid, &pv ); @@ -60,7 +60,7 @@ return PyCom_PyObjectFromIUnknown((IUnknown *)pv, riid, FALSE); } -// @pymethod |PyIShellItem|GetParent|Description of GetParent. +// @pymethod <o PyIShellItem>|PyIShellItem|GetParent|Retrieves the parent of this item PyObject *PyIShellItem::GetParent(PyObject *self, PyObject *args) { IShellItem *pISI = GetI(self); @@ -80,14 +80,14 @@ return PyCom_PyObjectFromIUnknown(psi, IID_IShellItem, FALSE); } -// @pymethod |PyIShellItem|GetDisplayName|Description of GetDisplayName. +// @pymethod str|PyIShellItem|GetDisplayName|Returns the display name of the item in the specified format PyObject *PyIShellItem::GetDisplayName(PyObject *self, PyObject *args) { IShellItem *pISI = GetI(self); if ( pISI == NULL ) return NULL; SIGDN sigdnName; - // @pyparm int|sigdnName||Description for sigdnName + // @pyparm int|sigdnName||Format of name to return, shellcon.SIGDN_* if ( !PyArg_ParseTuple(args, "k:GetDisplayName", &sigdnName) ) return NULL; HRESULT hr; @@ -103,7 +103,8 @@ return ret; } -// @pymethod |PyIShellItem|GetAttributes|Description of GetAttributes. +// @pymethod int|PyIShellItem|GetAttributes|Returns shell attributes of the item +// @rdesc Returns a combination of shellcon.SFGAO_* values PyObject *PyIShellItem::GetAttributes(PyObject *self, PyObject *args) { IShellItem *pISI = GetI(self); @@ -111,7 +112,7 @@ return NULL; SFGAOF sfgaoMask; SFGAOF ret; - // @pyparm <o PySFGAOF>|sfgaoMask||Description for sfgaoMask + // @pyparm int|Mask||Combination of shellcon.SFGAO_* values indicating the flags to return if ( !PyArg_ParseTuple(args, "k:GetAttributes", &sfgaoMask) ) return NULL; HRESULT hr; @@ -124,28 +125,27 @@ return PyLong_FromUnsignedLong(ret); } -// @pymethod |PyIShellItem|Compare|Description of Compare. +// @pymethod int|PyIShellItem|Compare|Compares another shell item with this item +// @rdesc Returns 0 if items compare as equal, nonzero otherwise PyObject *PyIShellItem::Compare(PyObject *self, PyObject *args) { IShellItem *pISI = GetI(self); if ( pISI == NULL ) return NULL; - // @pyparm <o PyIShellItem>|psi||Description for psi + // @pyparm <o PyIShellItem>|psi||A shell item to be compared with this item SICHINTF hint; - // @pyparm int|hint||Description for hint + // @pyparm int|hint||shellcon.SICHINT_* value indicating how the comparison is to be performed PyObject *obpsi; IShellItem *psi; if ( !PyArg_ParseTuple(args, "Oi:Compare", &obpsi, &hint) ) return NULL; - BOOL bPythonIsHappy = TRUE; - if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpsi, IID_IShellItem, (void **)&psi, TRUE /* bNoneOK */)) - bPythonIsHappy = FALSE; - if (!bPythonIsHappy) return NULL; + if (!PyCom_InterfaceFromPyInstanceOrObject(obpsi, IID_IShellItem, (void **)&psi, FALSE)) + return NULL; HRESULT hr; int iOrder; PY_INTERFACE_PRECALL; hr = pISI->Compare( psi, hint, &iOrder ); - if (psi) psi->Release(); + psi->Release(); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) @@ -153,14 +153,14 @@ return PyInt_FromLong(iOrder); } -// @object PyIShellItem|Description of the interface +// @object PyIShellItem|Interface that represents an item in the Explorer shell static struct PyMethodDef PyIShellItem_methods[] = { - { "BindToHandler", PyIShellItem::BindToHandler, 1 }, // @pymeth BindToHandler|Description of BindToHandler - { "GetParent", PyIShellItem::GetParent, 1 }, // @pymeth GetParent|Description of GetParent - { "GetDisplayName", PyIShellItem::GetDisplayName, 1 }, // @pymeth GetDisplayName|Description of GetDisplayName - { "GetAttributes", PyIShellItem::GetAttributes, 1 }, // @pymeth GetAttributes|Description of GetAttributes - { "Compare", PyIShellItem::Compare, 1 }, // @pymeth Compare|Description of Compare + { "BindToHandler", PyIShellItem::BindToHandler, 1 }, // @pymeth BindToHandler|Creates an instance of one of the item's handlers + { "GetParent", PyIShellItem::GetParent, 1 }, // @pymeth GetParent|Retrieves the parent of this item + { "GetDisplayName", PyIShellItem::GetDisplayName, 1 }, // @pymeth GetDisplayName|Returns the display name of the item in the specified format + { "GetAttributes", PyIShellItem::GetAttributes, 1 }, // @pymeth GetAttributes|Returns shell attributes of the item + { "Compare", PyIShellItem::Compare, 1 }, // @pymeth Compare|Compares another shell item with this item { NULL } }; diff -r fb67af61d37a -r 686032d6a1d3 com/win32comext/shell/src/shell.cpp --- a/com/win32comext/shell/src/shell.cpp Tue Jul 17 00:18:49 2012 -0400 +++ b/com/win32comext/shell/src/shell.cpp Tue Jul 17 22:13:45 2012 -0400 @@ -3598,5 +3598,20 @@ # pragma message("Please update your SDK headers - IE5 features missing!") #endif + ADD_IID(BHID_SFObject); + ADD_IID(BHID_SFUIObject); + ADD_IID(BHID_SFViewObject); + ADD_IID(BHID_Storage); + ADD_IID(BHID_Stream); + ADD_IID(BHID_LinkTargetItem); + ADD_IID(BHID_StorageEnum); + ADD_IID(BHID_Transfer); + ADD_IID(BHID_PropertyStore); + ADD_IID(BHID_ThumbnailHandler); + ADD_IID(BHID_EnumItems); + ADD_IID(BHID_DataObject); + ADD_IID(BHID_AssociationArray); + ADD_IID(BHID_Filter); + PYWIN_MODULE_INIT_RETURN_SUCCESS; } |
From: <pyw...@li...> - 2012-07-17 05:31:42
|
changeset fb67af61d37a in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=fb67af61d37a summary: Add a large number of Property System interfaces diffstat: CHANGES.txt | 4 + com/win32comext/propsys/pscon.py | 809 +++++++-- com/win32comext/propsys/src/PyIInitializeWithFile.cpp | 82 + com/win32comext/propsys/src/PyIInitializeWithFile.h | 41 + com/win32comext/propsys/src/PyIInitializeWithStream.cpp | 82 + com/win32comext/propsys/src/PyIInitializeWithStream.h | 41 + com/win32comext/propsys/src/PyINamedPropertyStore.cpp | 206 ++ com/win32comext/propsys/src/PyINamedPropertyStore.h | 49 + com/win32comext/propsys/src/PyIPropertyDescription.cpp | 497 ++++++ com/win32comext/propsys/src/PyIPropertyDescription.h | 45 + com/win32comext/propsys/src/PyIPropertyDescriptionAliasInfo.cpp | 82 + com/win32comext/propsys/src/PyIPropertyDescriptionAliasInfo.h | 25 + com/win32comext/propsys/src/PyIPropertyDescriptionList.cpp | 117 + com/win32comext/propsys/src/PyIPropertyDescriptionList.h | 44 + com/win32comext/propsys/src/PyIPropertyDescriptionSearchInfo.cpp | 121 + com/win32comext/propsys/src/PyIPropertyDescriptionSearchInfo.h | 25 + com/win32comext/propsys/src/PyIPropertyEnumType.cpp | 127 + com/win32comext/propsys/src/PyIPropertyEnumType.h | 24 + com/win32comext/propsys/src/PyIPropertyEnumTypeList.cpp | 128 + com/win32comext/propsys/src/PyIPropertyEnumTypeList.h | 23 + com/win32comext/propsys/src/PyIPropertyStore.cpp | 230 ++ com/win32comext/propsys/src/PyIPropertyStore.h | 55 + com/win32comext/propsys/src/PyIPropertyStoreCache.cpp | 139 + com/win32comext/propsys/src/PyIPropertyStoreCache.h | 25 + com/win32comext/propsys/src/PyIPropertyStoreCapabilities.cpp | 68 + com/win32comext/propsys/src/PyIPropertyStoreCapabilities.h | 37 + com/win32comext/propsys/src/PyIPropertySystem.cpp | 259 +++ com/win32comext/propsys/src/PyIPropertySystem.h | 31 + com/win32comext/propsys/src/PyPROPVARIANT.cpp | 572 +++++++ com/win32comext/propsys/src/PyPROPVARIANT.h | 55 + com/win32comext/propsys/src/propsys.cpp | 331 +++- setup.py | 16 +- 32 files changed, 4162 insertions(+), 228 deletions(-) diffs (truncated from 4666 to 300 lines): diff -r c8d9bd8b3ca9 -r fb67af61d37a CHANGES.txt --- a/CHANGES.txt Mon Jul 16 16:56:43 2012 +1000 +++ b/CHANGES.txt Tue Jul 17 00:18:49 2012 -0400 @@ -30,6 +30,10 @@ * Python 3.3 version is built with VS2010. +* win32com.shell - IShellItem2 added + +* win32com.propsys - Many Property System interfaces and functions added + Since build 216: ---------------- * ISAPI extension works with Python 3.x diff -r c8d9bd8b3ca9 -r fb67af61d37a com/win32comext/propsys/pscon.py --- a/com/win32comext/propsys/pscon.py Mon Jul 16 16:56:43 2012 +1000 +++ b/com/win32comext/propsys/pscon.py Tue Jul 17 00:18:49 2012 -0400 @@ -1,8 +1,11 @@ # hand generated from propsys.h + +## PROPENUMTYPE, used with IPropertyEnumType PET_DISCRETEVALUE = 0 PET_RANGEDVALUE = 1 PET_DEFAULTVALUE = 2 PET_ENDRANGE = 3 + PDTF_DEFAULT = 0 PDTF_MULTIPLEVALUES = 0x1 PDTF_ISINNATE = 0x2 @@ -15,6 +18,7 @@ PDTF_ISQUERYABLE = 0x100 PDTF_ISSYSTEMPROPERTY = 0x80000000 PDTF_MASK_ALL = 0x800001ff + PDVF_DEFAULT = 0 PDVF_CENTERALIGN = 0x1 PDVF_RIGHTALIGN = 0x2 @@ -29,11 +33,13 @@ PDVF_HIDDEN = 0x800 PDVF_CANWRAP = 0x1000 PDVF_MASK_ALL = 0x1bff + PDDT_STRING = 0 PDDT_NUMBER = 1 PDDT_BOOLEAN = 2 PDDT_DATETIME = 3 PDDT_ENUMERATED = 4 + PDGR_DISCRETE = 0 PDGR_ALPHANUMERIC = 1 PDGR_SIZE = 2 @@ -41,6 +47,8 @@ PDGR_DATE = 4 PDGR_PERCENT = 5 PDGR_ENUMERATED = 6 + +## PROPDESC_FORMAT_FLAGS PDFF_DEFAULT = 0 PDFF_PREFIXNAME = 0x1 PDFF_FILENAME = 0x2 @@ -56,11 +64,13 @@ PDFF_USEEDITINVITATION = 0x800 PDFF_READONLY = 0x1000 PDFF_NOAUTOREADINGORDER = 0x2000 + PDSD_GENERAL = 0 PDSD_A_Z = 1 PDSD_LOWEST_HIGHEST = 2 PDSD_SMALLEST_BIGGEST = 3 PDSD_OLDEST_NEWEST = 4 + PDRDT_GENERAL = 0 PDRDT_DATE = 1 PDRDT_SIZE = 2 @@ -72,6 +82,7 @@ PDRDT_RATE = 8 PDRDT_RATING = 9 PDRDT_PRIORITY = 10 + PDAT_DEFAULT = 0 PDAT_FIRST = 1 PDAT_SUM = 2 @@ -80,222 +91,14 @@ PDAT_UNION = 5 PDAT_MAX = 6 PDAT_MIN = 7 + PDCOT_NONE = 0 PDCOT_STRING = 1 PDCOT_SIZE = 2 PDCOT_DATETIME = 3 PDCOT_BOOLEAN = 4 PDCOT_NUMBER = 5 -PDTF_DEFAULT = 0 -PDTF_MULTIPLEVALUES = 0x1 -PDTF_ISINNATE = 0x2 -PDTF_ISGROUP = 0x4 -PDTF_CANGROUPBY = 0x8 -PDTF_CANSTACKBY = 0x10 -PDTF_ISTREEPROPERTY = 0x20 -PDTF_INCLUDEINFULLTEXTQUERY = 0x40 -PDTF_ISVIEWABLE = 0x80 -PDTF_ISQUERYABLE = 0x100 -PDTF_ISSYSTEMPROPERTY = 0x80000000 -PDTF_MASK_ALL = 0x800001ff -PDVF_DEFAULT = 0 -PDVF_CENTERALIGN = 0x1 -PDVF_RIGHTALIGN = 0x2 -PDVF_BEGINNEWGROUP = 0x4 -PDVF_FILLAREA = 0x8 -PDVF_SORTDESCENDING = 0x10 -PDVF_SHOWONLYIFPRESENT = 0x20 -PDVF_SHOWBYDEFAULT = 0x40 -PDVF_SHOWINPRIMARYLIST = 0x80 -PDVF_SHOWINSECONDARYLIST = 0x100 -PDVF_HIDELABEL = 0x200 -PDVF_HIDDEN = 0x800 -PDVF_CANWRAP = 0x1000 -PDVF_MASK_ALL = 0x1bff -PDDT_STRING = 0 -PDDT_NUMBER = 1 -PDDT_BOOLEAN = 2 -PDDT_DATETIME = 3 -PDDT_ENUMERATED = 4 -PDGR_DISCRETE = 0 -PDGR_ALPHANUMERIC = 1 -PDGR_SIZE = 2 -PDGR_DYNAMIC = 3 -PDGR_DATE = 4 -PDGR_PERCENT = 5 -PDGR_ENUMERATED = 6 -PDFF_DEFAULT = 0 -PDFF_PREFIXNAME = 0x1 -PDFF_FILENAME = 0x2 -PDFF_ALWAYSKB = 0x4 -PDFF_RESERVED_RIGHTTOLEFT = 0x8 -PDFF_SHORTTIME = 0x10 -PDFF_LONGTIME = 0x20 -PDFF_HIDETIME = 0x40 -PDFF_SHORTDATE = 0x80 -PDFF_LONGDATE = 0x100 -PDFF_HIDEDATE = 0x200 -PDFF_RELATIVEDATE = 0x400 -PDFF_USEEDITINVITATION = 0x800 -PDFF_READONLY = 0x1000 -PDFF_NOAUTOREADINGORDER = 0x2000 -PDSD_GENERAL = 0 -PDSD_A_Z = 1 -PDSD_LOWEST_HIGHEST = 2 -PDSD_SMALLEST_BIGGEST = 3 -PDSD_OLDEST_NEWEST = 4 -PDRDT_GENERAL = 0 -PDRDT_DATE = 1 -PDRDT_SIZE = 2 -PDRDT_COUNT = 3 -PDRDT_REVISION = 4 -PDRDT_LENGTH = 5 -PDRDT_DURATION = 6 -PDRDT_SPEED = 7 -PDRDT_RATE = 8 -PDRDT_RATING = 9 -PDRDT_PRIORITY = 10 -PDAT_DEFAULT = 0 -PDAT_FIRST = 1 -PDAT_SUM = 2 -PDAT_AVERAGE = 3 -PDAT_DATERANGE = 4 -PDAT_UNION = 5 -PDAT_MAX = 6 -PDAT_MIN = 7 -PDCOT_NONE = 0 -PDCOT_STRING = 1 -PDCOT_SIZE = 2 -PDCOT_DATETIME = 3 -PDCOT_BOOLEAN = 4 -PDCOT_NUMBER = 5 -PDDT_STRING = 0 -PDDT_NUMBER = 1 -PDDT_BOOLEAN = 2 -PDDT_DATETIME = 3 -PDDT_ENUMERATED = 4 -PDGR_DISCRETE = 0 -PDGR_ALPHANUMERIC = 1 -PDGR_SIZE = 2 -PDGR_DYNAMIC = 3 -PDGR_DATE = 4 -PDGR_PERCENT = 5 -PDGR_ENUMERATED = 6 -PDFF_DEFAULT = 0 -PDFF_PREFIXNAME = 0x1 -PDFF_FILENAME = 0x2 -PDFF_ALWAYSKB = 0x4 -PDFF_RESERVED_RIGHTTOLEFT = 0x8 -PDFF_SHORTTIME = 0x10 -PDFF_LONGTIME = 0x20 -PDFF_HIDETIME = 0x40 -PDFF_SHORTDATE = 0x80 -PDFF_LONGDATE = 0x100 -PDFF_HIDEDATE = 0x200 -PDFF_RELATIVEDATE = 0x400 -PDFF_USEEDITINVITATION = 0x800 -PDFF_READONLY = 0x1000 -PDFF_NOAUTOREADINGORDER = 0x2000 -PDSD_GENERAL = 0 -PDSD_A_Z = 1 -PDSD_LOWEST_HIGHEST = 2 -PDSD_SMALLEST_BIGGEST = 3 -PDSD_OLDEST_NEWEST = 4 -PDRDT_GENERAL = 0 -PDRDT_DATE = 1 -PDRDT_SIZE = 2 -PDRDT_COUNT = 3 -PDRDT_REVISION = 4 -PDRDT_LENGTH = 5 -PDRDT_DURATION = 6 -PDRDT_SPEED = 7 -PDRDT_RATE = 8 -PDRDT_RATING = 9 -PDRDT_PRIORITY = 10 -PDAT_DEFAULT = 0 -PDAT_FIRST = 1 -PDAT_SUM = 2 -PDAT_AVERAGE = 3 -PDAT_DATERANGE = 4 -PDAT_UNION = 5 -PDAT_MAX = 6 -PDAT_MIN = 7 -PDCOT_NONE = 0 -PDCOT_STRING = 1 -PDCOT_SIZE = 2 -PDCOT_DATETIME = 3 -PDCOT_BOOLEAN = 4 -PDCOT_NUMBER = 5 -PDFF_DEFAULT = 0 -PDFF_PREFIXNAME = 0x1 -PDFF_FILENAME = 0x2 -PDFF_ALWAYSKB = 0x4 -PDFF_RESERVED_RIGHTTOLEFT = 0x8 -PDFF_SHORTTIME = 0x10 -PDFF_LONGTIME = 0x20 -PDFF_HIDETIME = 0x40 -PDFF_SHORTDATE = 0x80 -PDFF_LONGDATE = 0x100 -PDFF_HIDEDATE = 0x200 -PDFF_RELATIVEDATE = 0x400 -PDFF_USEEDITINVITATION = 0x800 -PDFF_READONLY = 0x1000 -PDFF_NOAUTOREADINGORDER = 0x2000 -PDSD_GENERAL = 0 -PDSD_A_Z = 1 -PDSD_LOWEST_HIGHEST = 2 -PDSD_SMALLEST_BIGGEST = 3 -PDSD_OLDEST_NEWEST = 4 -PDRDT_GENERAL = 0 -PDRDT_DATE = 1 -PDRDT_SIZE = 2 -PDRDT_COUNT = 3 -PDRDT_REVISION = 4 -PDRDT_LENGTH = 5 -PDRDT_DURATION = 6 -PDRDT_SPEED = 7 -PDRDT_RATE = 8 -PDRDT_RATING = 9 -PDRDT_PRIORITY = 10 -PDAT_DEFAULT = 0 -PDAT_FIRST = 1 -PDAT_SUM = 2 -PDAT_AVERAGE = 3 -PDAT_DATERANGE = 4 -PDAT_UNION = 5 -PDAT_MAX = 6 -PDAT_MIN = 7 -PDCOT_NONE = 0 -PDCOT_STRING = 1 -PDCOT_SIZE = 2 -PDCOT_DATETIME = 3 -PDCOT_BOOLEAN = 4 -PDCOT_NUMBER = 5 -PDRDT_GENERAL = 0 -PDRDT_DATE = 1 -PDRDT_SIZE = 2 -PDRDT_COUNT = 3 -PDRDT_REVISION = 4 -PDRDT_LENGTH = 5 -PDRDT_DURATION = 6 -PDRDT_SPEED = 7 -PDRDT_RATE = 8 -PDRDT_RATING = 9 -PDRDT_PRIORITY = 10 -PDAT_DEFAULT = 0 -PDAT_FIRST = 1 -PDAT_SUM = 2 -PDAT_AVERAGE = 3 -PDAT_DATERANGE = 4 -PDAT_UNION = 5 -PDAT_MAX = 6 -PDAT_MIN = 7 -PDCOT_NONE = 0 -PDCOT_STRING = 1 -PDCOT_SIZE = 2 |