pywin32-checkins Mailing List for Python for Windows Extensions (Page 86)
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: Mark H. <mha...@us...> - 2007-09-02 10:35:34
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31995 Modified Files: PythonCOM.cpp Log Message: Use 'k' format string when parsing scodes in, eg, GetSCodeString(), so long hex constants work. Index: PythonCOM.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PythonCOM.cpp,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** PythonCOM.cpp 4 Jul 2007 18:40:46 -0000 1.47 --- PythonCOM.cpp 27 Aug 2007 05:12:11 -0000 1.48 *************** *** 599,603 **** TCHAR buf[512]; // @pyparm int|scode||The OLE error code for the scode string requested. ! if (!PyArg_ParseTuple(args, "i", &scode)) return NULL; GetScodeString(scode, buf, sizeof(buf)); --- 599,603 ---- TCHAR buf[512]; // @pyparm int|scode||The OLE error code for the scode string requested. ! if (!PyArg_ParseTuple(args, "k", &scode)) return NULL; GetScodeString(scode, buf, sizeof(buf)); *************** *** 613,617 **** SCODE scode; // @pyparm int|scode||An OLE error code to return the scode range string for. ! if (!PyArg_ParseTuple(args, "i", &scode)) return NULL; return Py_BuildValue("z", GetScodeRangeString(scode) ); --- 613,617 ---- SCODE scode; // @pyparm int|scode||An OLE error code to return the scode range string for. ! if (!PyArg_ParseTuple(args, "k", &scode)) return NULL; return Py_BuildValue("z", GetScodeRangeString(scode) ); *************** *** 623,627 **** SCODE scode; // @pyparm int|scode||The OLE error code for the severity string requested. ! if (!PyArg_ParseTuple(args, "i", &scode)) return NULL; return Py_BuildValue("z", GetSeverityString(scode) ); --- 623,627 ---- SCODE scode; // @pyparm int|scode||The OLE error code for the severity string requested. ! if (!PyArg_ParseTuple(args, "k", &scode)) return NULL; return Py_BuildValue("z", GetSeverityString(scode) ); *************** *** 633,637 **** SCODE scode; // @pyparm int|scode||The OLE error code for the facility string requested. ! if (!PyArg_ParseTuple(args, "i", &scode)) return NULL; return Py_BuildValue("z", GetFacilityString(scode) ); --- 633,637 ---- SCODE scode; // @pyparm int|scode||The OLE error code for the facility string requested. ! if (!PyArg_ParseTuple(args, "k", &scode)) return NULL; return Py_BuildValue("z", GetFacilityString(scode) ); |
From: Mark H. <mha...@us...> - 2007-08-31 02:08:15
|
Update of /cvsroot/pywin32/pywin32/com/win32com/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11408 Modified Files: testStreams.py util.py Log Message: Hide error messages generated by the test suite (and better, actually check that the messages were generated and that they were pythoncom errors) Index: testStreams.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testStreams.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** testStreams.py 3 Jul 2007 21:10:26 -0000 1.5 --- testStreams.py 31 Aug 2007 02:08:14 -0000 1.6 *************** *** 108,116 **** self.assertEqual(s.data, mydata) ## check for buffer overflow in Read method badstream = BadStream('Check for buffer overflow') badstream2 = win32com.server.util.wrap(badstream, pythoncom.IID_IStream) self.assertRaises(pythoncom.com_error, badstream2.Read, 10) ! if __name__=='__main__': unittest.main() --- 108,123 ---- self.assertEqual(s.data, mydata) + # setup a test logger to capture tracebacks etc. + records, old_log = win32com.test.util.setup_test_logger() ## check for buffer overflow in Read method badstream = BadStream('Check for buffer overflow') badstream2 = win32com.server.util.wrap(badstream, pythoncom.IID_IStream) self.assertRaises(pythoncom.com_error, badstream2.Read, 10) ! win32com.test.util.restore_test_logger(old_log) ! # expecting 2 pythoncom errors to have been raised by the gateways. ! self.assertEqual(len(records), 2) ! self.failUnless(records[0].msg.startswith('pythoncom error')) ! self.failUnless(records[1].msg.startswith('pythoncom error')) ! if __name__=='__main__': unittest.main() Index: util.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/util.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** util.py 24 May 2007 05:33:26 -0000 1.8 --- util.py 31 Aug 2007 02:08:14 -0000 1.9 *************** *** 8,11 **** --- 8,13 ---- import cStringIO as StringIO from pythoncom import _GetInterfaceCount, _GetGatewayCount + import win32com + import logging def CheckClean(): *************** *** 174,177 **** --- 176,201 ---- return test + # Utilities to set the win32com logger to something what just captures + # records written and doesn't print them. + class LogHandler(logging.Handler): + def __init__(self): + self.emitted = [] + logging.Handler.__init__(self) + def emit(self, record): + self.emitted.append(record) + + def setup_test_logger(): + old_log = getattr(win32com, "logger", None) + win32com.logger = logging.Logger('test') + handler = LogHandler() + win32com.logger.addHandler(handler) + return handler.emitted, old_log + + def restore_test_logger(prev_logger): + if prev_logger is None: + del win32com.logger + else: + win32com.logger = prev_logger + # We used to override some of this (and may later!) TestCase = unittest.TestCase |
From: Mark H. <mha...@us...> - 2007-08-27 15:40:28
|
Update of /cvsroot/pywin32/pywin32/com/win32com/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25480 Modified Files: selecttlb.py Log Message: Fix [ 1773724 ] Selecttlb doesn't handle hexadecimal version numbers Index: selecttlb.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/selecttlb.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** selecttlb.py 25 Apr 2004 04:24:27 -0000 1.8 --- selecttlb.py 25 Aug 2007 05:09:21 -0000 1.9 *************** *** 8,13 **** self.clsid = str(clsid) self.lcid = int(lcid) ! self.major = int(major) ! self.minor = int(minor) self.dll = None self.desc = None --- 8,17 ---- self.clsid = str(clsid) self.lcid = int(lcid) ! # We avoid assuming 'major' or 'minor' are integers - when ! # read from the registry there is some confusion about if ! # they are base 10 or base 16 (they *should* be base 16, but ! # how they are written is beyond our control.) ! self.major = major ! self.minor = minor self.dll = None self.desc = None *************** *** 84,98 **** if len(major_minor) < 2: major_minor.append('0') ! try: ! # For some reason, this code used to assume the values were hex. ! # This seems to not be true - particularly for CDO 1.21 ! # *sigh* - it appears there are no rules here at all, so when we need ! # to know the info, we must load the tlb by filename and request it. ! # The Resolve() method on the TypelibSpec does this. ! major = int(major_minor[0]) ! minor = int(major_minor[1]) ! except ValueError: # crap in the registry! ! continue ! key3 = win32api.RegOpenKey(key2, str(version)) try: --- 88,102 ---- if len(major_minor) < 2: major_minor.append('0') ! # For some reason, this code used to assume the values were hex. ! # This seems to not be true - particularly for CDO 1.21 ! # *sigh* - it appears there are no rules here at all, so when we need ! # to know the info, we must load the tlb by filename and request it. ! # The Resolve() method on the TypelibSpec does this. ! # For this reason, keep the version numbers as strings - that ! # way we can't be wrong! Let code that really needs an int to work ! # out what to do. FWIW, http://support.microsoft.com/kb/816970 is ! # pretty clear that they *should* be hex. ! major = major_minor[0] ! minor = major_minor[1] key3 = win32api.RegOpenKey(key2, str(version)) try: |
From: Mark H. <mha...@us...> - 2007-08-27 15:40:22
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27301/src Modified Files: win32clipboardmodule.cpp Log Message: Fix [ 1751177 ] Missing CF_DIBV5 Index: win32clipboardmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32clipboardmodule.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** win32clipboardmodule.cpp 14 Aug 2007 01:27:26 -0000 1.21 --- win32clipboardmodule.cpp 25 Aug 2007 05:14:55 -0000 1.22 *************** *** 1164,1167 **** --- 1164,1168 ---- ADD_CONSTANT(CF_HDROP); ADD_CONSTANT(CF_LOCALE); + ADD_CONSTANT(CF_DIBV5); ADD_CONSTANT(CF_MAX); ADD_CONSTANT(CF_OWNERDISPLAY); |
From: Mark H. <mha...@us...> - 2007-08-27 15:38:45
|
Update of /cvsroot/pywin32/pywin32/win32/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27301/lib Modified Files: win32con.py Log Message: Fix [ 1751177 ] Missing CF_DIBV5 Index: win32con.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Lib/win32con.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** win32con.py 14 Apr 2007 07:19:37 -0000 1.20 --- win32con.py 25 Aug 2007 05:14:55 -0000 1.21 *************** *** 4101,4105 **** CF_HDROP = 15 CF_LOCALE = 16 ! CF_MAX = 17 CF_OWNERDISPLAY = 128 CF_DSPTEXT = 129 --- 4101,4106 ---- CF_HDROP = 15 CF_LOCALE = 16 ! CF_DIBV5 = 17 ! CF_MAX = 18 CF_OWNERDISPLAY = 128 CF_DSPTEXT = 129 |
From: Mark H. <mha...@us...> - 2007-08-27 14:54:30
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10599/com/win32com/src Modified Files: oleargs.cpp Log Message: Use VT_I4 if possible when converting a Python int, so to revert to build 208's behaviour. We now only pass VT_UI4 if it doesn't fit in the signed version. Fixes [ 1582720 ] Python long integers aren't translated to Variant/long Index: oleargs.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/oleargs.cpp,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** oleargs.cpp 24 May 2007 06:01:04 -0000 1.38 --- oleargs.cpp 27 Aug 2007 08:38:43 -0000 1.39 *************** *** 77,87 **** } else { // 64 bits is OK - but if it fits in 32 we will ! // use that. ! if (lval >= 0 && lval <= ULONG_MAX) { ! V_VT(var) = VT_UI4; ! V_UI4(var) = (unsigned long)lval; ! } else if (lval >= LONG_MIN && lval <= LONG_MAX) { V_VT(var) = VT_I4; V_I4(var) = (long)lval; } else { V_VT(var) = VT_I8; --- 77,89 ---- } else { // 64 bits is OK - but if it fits in 32 we will ! // use that. Prefer VT_I4 if possible as VBScript ! // etc like it better. ! if (lval >= LONG_MIN && lval <= LONG_MAX) { V_VT(var) = VT_I4; V_I4(var) = (long)lval; + // OK, we know it must be > LONG_MAX, but zero is clearer + } else if (lval >= 0 && lval <= ULONG_MAX) { + V_VT(var) = VT_UI4; + V_UI4(var) = (unsigned long)lval; } else { V_VT(var) = VT_I8; |
From: Mark H. <mha...@us...> - 2007-08-27 14:53:15
|
Update of /cvsroot/pywin32/pywin32/com/win32com/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32009 Modified Files: dynamic.py Log Message: Fix [ 1587023 ] ActiveScript, LazyDispatchItem doesn't rename properties Support 'Get' and 'Set' properties taking arguments with ITypeComp based objects. Index: dynamic.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/dynamic.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** dynamic.py 10 Jan 2006 00:51:15 -0000 1.21 --- dynamic.py 26 Aug 2007 03:42:13 -0000 1.22 *************** *** 378,381 **** --- 378,385 ---- try: x,t = typecomp.Bind(attr,i) + # Support 'Get' and 'Set' properties - see + # bug 1587023 + if x==0 and attr[:3] in ('Set', 'Get'): + x,t = typecomp.Bind(attr[3:], i) if x==1: #it's a FUNCDESC r = olerepr._AddFunc_(typeinfo,t,0) |
From: Roger U. <ru...@us...> - 2007-08-24 04:05:44
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31943/win32/src Modified Files: PythonService.cpp Log Message: Fix a couple of 64-bit issues Index: PythonService.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PythonService.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** PythonService.cpp 10 Jan 2006 00:02:57 -0000 1.20 --- PythonService.cpp 24 Aug 2007 04:05:41 -0000 1.21 *************** *** 200,204 **** LPCTSTR *pStrings = NULL; PyObject *rc = NULL; ! int numStrings = 0; BOOL ok = FALSE; --- 200,204 ---- LPCTSTR *pStrings = NULL; PyObject *rc = NULL; ! Py_ssize_t numStrings = 0; BOOL ok = FALSE; *************** *** 219,223 **** } memset(pStrings, 0, sizeof(TCHAR *)*(numStrings+1)); // this also terminates array! ! for (int i=0;i<numStrings;i++) { PyObject *obString = PySequence_GetItem(obStrings, i); if (obString==NULL) { --- 219,223 ---- } memset(pStrings, 0, sizeof(TCHAR *)*(numStrings+1)); // this also terminates array! ! for (Py_ssize_t i=0;i<numStrings;i++) { PyObject *obString = PySequence_GetItem(obStrings, i); if (obString==NULL) { *************** *** 355,359 **** rc = PyWin_SetAPIError("RegisterServiceCtrlHandlerEx"); } else { ! rc = PyInt_FromLong((long)pe->sshStatusHandle); } return rc; --- 355,359 ---- rc = PyWin_SetAPIError("RegisterServiceCtrlHandlerEx"); } else { ! rc = PyWinLong_FromHANDLE(pe->sshStatusHandle); } return rc; |
From: Roger U. <ru...@us...> - 2007-08-22 19:57:39
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src/extensions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32209/com/win32com/src/extensions Modified Files: PyIPropertyStorage.cpp Log Message: Fix 64-bit warnings Autoduck improvements Add some error checking Fix a couple of memory leaks Index: PyIPropertyStorage.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/extensions/PyIPropertyStorage.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PyIPropertyStorage.cpp 29 Nov 2005 02:23:07 -0000 1.12 --- PyIPropertyStorage.cpp 22 Aug 2007 19:57:40 -0000 1.13 *************** *** 11,26 **** // --------------------------------------------------- BOOL PyObject_AsPROPSPECs( PyObject *ob, PROPSPEC **ppRet, ULONG *pcRet) { ! if (!PySequence_Check(ob)) { ! PyErr_SetString(PyExc_TypeError, "PROPSPECs must a sequence"); return FALSE; ! } // First count the items, and the total string space we need. ! LONG cChars = 0; ! int len = PySequence_Length(ob); ! int i; for (i=0;i<len;i++) { ! PyObject *sub = PySequence_GetItem(ob, i); if (PyUnicode_Check(sub)) cChars += PyUnicode_Size(sub) + 1; --- 11,27 ---- // --------------------------------------------------- + // @object PROPSPEC|Identifies a property. Can be either an int property id, or a str/unicode property name. BOOL PyObject_AsPROPSPECs( PyObject *ob, PROPSPEC **ppRet, ULONG *pcRet) { ! BOOL ret=FALSE; ! DWORD len, i; ! PyObject *tuple=PyWinSequence_Tuple(ob, &len); ! if (tuple==NULL) return FALSE; ! // First count the items, and the total string space we need. ! size_t cChars = 0; for (i=0;i<len;i++) { ! PyObject *sub = PyTuple_GET_ITEM(tuple, i); if (PyUnicode_Check(sub)) cChars += PyUnicode_Size(sub) + 1; *************** *** 28,48 **** cChars += PyString_Size(sub) + 1; else if (PyInt_Check(sub)) ! ; else { - Py_DECREF(sub); PyErr_SetString(PyExc_TypeError, "PROPSPECs must be a sequence of strings or integers"); ! return FALSE; } - Py_DECREF(sub); } ! size_t numBytes = (sizeof(PROPSPEC) * len) + (sizeof(WCHAR) * cChars); ! PROPSPEC *pRet = (PROPSPEC *)malloc(numBytes); if (pRet==NULL) { PyErr_SetString(PyExc_MemoryError, "allocating PROPSPECs"); ! return FALSE; } ! WCHAR *curBuf = (WCHAR *)(pRet+len); for (i=0;i<len;i++) { ! PyObject *sub = PySequence_GetItem(ob, i); BSTR bstr; if (PyWinObject_AsBstr(sub, &bstr)) { --- 29,50 ---- cChars += PyString_Size(sub) + 1; else if (PyInt_Check(sub)) ! ; // PROPID is a ULONG, so this may fail for values that require a python long else { PyErr_SetString(PyExc_TypeError, "PROPSPECs must be a sequence of strings or integers"); ! goto cleanup; } } ! size_t numBytes; ! numBytes = (sizeof(PROPSPEC) * len) + (sizeof(WCHAR) * cChars); ! PROPSPEC *pRet; ! pRet = (PROPSPEC *)malloc(numBytes); if (pRet==NULL) { PyErr_SetString(PyExc_MemoryError, "allocating PROPSPECs"); ! goto cleanup; } ! WCHAR *curBuf; ! curBuf = (WCHAR *)(pRet+len); for (i=0;i<len;i++) { ! PyObject *sub = PyTuple_GET_ITEM(tuple, i); BSTR bstr; if (PyWinObject_AsBstr(sub, &bstr)) { *************** *** 51,54 **** --- 53,57 ---- wcscpy( curBuf, bstr); curBuf += wcslen(curBuf) + 1; + PyWinObject_FreeBstr(bstr); } else { PyErr_Clear(); *************** *** 56,69 **** pRet[i].propid = PyInt_AsLong(sub); } - Py_DECREF(sub); } *ppRet = pRet; *pcRet = len; ! return TRUE; } void PyObject_FreePROPSPECs(PROPSPEC *pFree, ULONG /*cFree*/) { ! free(pFree); } --- 59,75 ---- pRet[i].propid = PyInt_AsLong(sub); } } + ret=TRUE; *ppRet = pRet; *pcRet = len; ! cleanup: ! Py_DECREF(tuple); ! return ret; } void PyObject_FreePROPSPECs(PROPSPEC *pFree, ULONG /*cFree*/) { ! if (pFree) ! free(pFree); } *************** *** 166,169 **** --- 172,177 ---- { PyObject *ret = PyTuple_New(cVars); + if (ret==NULL) + return NULL; for (ULONG i=0;i<cVars;i++) { PyObject *sub = PyObject_FromPROPVARIANT(pVars+i); *************** *** 201,270 **** } BOOL PyObject_AsPROPVARIANTs(PyObject *ob, PROPVARIANT **ppRet, ULONG *pcRet) { ! if (!PySequence_Check(ob)) { ! PyErr_SetString(PyExc_TypeError, "PROPVARIANTs must a sequence"); return FALSE; - } - int len = PySequence_Length(ob); PROPVARIANT *pRet = new PROPVARIANT[len]; ! int i; for (i=0;i<len;i++) PropVariantInit(pRet+i); for (i=0;i<len;i++) { ! PyObject *sub = PySequence_GetItem(ob, i); ! BOOL ok = PyObject_AsPROPVARIANT(sub, pRet+i); ! Py_DECREF(sub); ! if (!ok) { ! for (int j=0;j<i;j++) ! PropVariantClear(pRet+j); ! delete [] pRet; ! return FALSE; } ! } ! *ppRet = pRet; ! *pcRet = len; ! return TRUE; ! } ! ! void PyObject_FreePROPVARIANTs(PROPVARIANT *pVars, ULONG cVars) ! { ! for (ULONG i=0;i<cVars;i++) ! PropVariantClear(pVars+i); ! delete [] pVars; } BOOL PyObject_AsPROPIDs(PyObject *ob, PROPID **ppRet, ULONG *pcRet) { ! if (!PySequence_Check(ob)) { ! PyErr_SetString(PyExc_TypeError, "PROPIDs must a sequence"); ! return FALSE; ! } ! int len = PySequence_Length(ob); ! ! PROPID *pRet = new PROPID[len]; ! BOOL ok = TRUE; ! for (int i=0;ok && i<len;i++) { ! PyObject *sub = PySequence_GetItem(ob, i); ! ok = PyInt_Check(sub); ! if (!ok ) ! PyErr_SetString(PyExc_TypeError, "Must be array of ints"); ! if (ok) ! pRet[i] = PyInt_AsLong(sub); ! Py_XDECREF(sub); ! } ! if (!ok) { ! delete [] pRet; ! return FALSE; ! } ! *ppRet = pRet; ! *pcRet = len; ! return TRUE; } void PyObject_FreePROPIDs(PROPID *pFree, ULONG) { ! delete [] pFree; } --- 209,264 ---- } + void PyObject_FreePROPVARIANTs(PROPVARIANT *pVars, ULONG cVars) + { + if (pVars){ + for (ULONG i=0;i<cVars;i++) + PropVariantClear(pVars+i); + delete [] pVars; + } + } + BOOL PyObject_AsPROPVARIANTs(PyObject *ob, PROPVARIANT **ppRet, ULONG *pcRet) { ! BOOL ret=FALSE; ! DWORD len, i; ! PyObject *tuple=PyWinSequence_Tuple(ob, &len); ! if (tuple==NULL) return FALSE; PROPVARIANT *pRet = new PROPVARIANT[len]; ! if (pRet==NULL){ ! PyErr_NoMemory(); ! goto cleanup; ! } for (i=0;i<len;i++) PropVariantInit(pRet+i); for (i=0;i<len;i++) { ! PyObject *sub = PyTuple_GET_ITEM(tuple, i); ! if (!PyObject_AsPROPVARIANT(sub, pRet+i)) ! goto cleanup; } ! ret=TRUE; ! cleanup: ! if (ret){ ! *ppRet = pRet; ! *pcRet = len; ! } ! else if (pRet) ! PyObject_FreePROPVARIANTs(pRet, len); ! Py_DECREF(tuple); ! return ret; } BOOL PyObject_AsPROPIDs(PyObject *ob, PROPID **ppRet, ULONG *pcRet) { ! // PROPID and DWORD are both unsigned long ! return PyWinObject_AsDWORDArray(ob, ppRet, pcRet, FALSE); } + void PyObject_FreePROPIDs(PROPID *pFree, ULONG) { ! if (pFree) ! free(pFree); } *************** *** 294,298 **** return NULL; PyObject *props; ! // @pyparm (<o PROPSPEC>, ...)|props||The property IDs. if ( !PyArg_ParseTuple(args, "O:ReadMultiple", &props)) return NULL; --- 288,292 ---- return NULL; PyObject *props; ! // @pyparm (<o PROPSPEC>, ...)|props||Sequence of property IDs or names. if ( !PyArg_ParseTuple(args, "O:ReadMultiple", &props)) return NULL; *************** *** 332,338 **** } ! // @pymethod |PyIPropertyStorage|WriteMultiple|Description of WriteMultiple. PyObject *PyIPropertyStorage::WriteMultiple(PyObject *self, PyObject *args) { IPropertyStorage *pIPS = GetI(self); if ( pIPS == NULL ) --- 326,337 ---- } ! // @pymethod |PyIPropertyStorage|WriteMultiple|Creates or modifies properties in the property set PyObject *PyIPropertyStorage::WriteMultiple(PyObject *self, PyObject *args) { + PyObject *ret=NULL; + PROPSPEC *pProps = NULL; + PROPVARIANT *pVals = NULL; + ULONG cProps, cVals; + IPropertyStorage *pIPS = GetI(self); if ( pIPS == NULL ) *************** *** 341,382 **** PyObject *obValues; long minId = 2; ! // @pyparm (<o PROPSPEC>, ...)|props||The property IDs. // @pyparm (<o PROPVARIANT>, ...)|values||The values for the properties. if ( !PyArg_ParseTuple(args, "OO|l:WriteMultiple", &obProps, &obValues, &minId)) return NULL; ! ! PROPSPEC *pProps; ! ULONG cProps; if (!PyObject_AsPROPSPECs( obProps, &pProps, &cProps)) ! return NULL; ! ! PROPVARIANT *pVals; ! ULONG cVals; if (!PyObject_AsPROPVARIANTs( obValues, &pVals, &cVals )) ! return NULL; if (cProps != cVals) { PyErr_SetString(PyExc_ValueError, "The parameters must be sequences of the same size"); ! PyObject_FreePROPSPECs(pProps, cProps); ! PyObject_FreePROPVARIANTs(pVals, cVals); ! return NULL; } HRESULT hr; PY_INTERFACE_PRECALL; hr = pIPS->WriteMultiple( cProps, pProps, pVals, minId ); PY_INTERFACE_POSTCALL; PyObject_FreePROPSPECs(pProps, cProps); PyObject_FreePROPVARIANTs(pVals, cVals); ! ! if ( FAILED(hr) ) ! return PyCom_BuildPyException(hr, pIPS, IID_IPropertyStorage); ! Py_INCREF(Py_None); ! return Py_None; ! } ! // @pymethod |PyIPropertyStorage|DeleteMultiple|Description of DeleteMultiple. PyObject *PyIPropertyStorage::DeleteMultiple(PyObject *self, PyObject *args) { --- 340,379 ---- PyObject *obValues; long minId = 2; ! // @pyparm (<o PROPSPEC>, ...)|props||Sequence containing names or integer ids of properties to write // @pyparm (<o PROPVARIANT>, ...)|values||The values for the properties. + // @pyparm int|propidNameFirst|2|Minimum property id to be assigned to new properties specified by name if ( !PyArg_ParseTuple(args, "OO|l:WriteMultiple", &obProps, &obValues, &minId)) return NULL; ! if (!PyObject_AsPROPSPECs( obProps, &pProps, &cProps)) ! goto cleanup; if (!PyObject_AsPROPVARIANTs( obValues, &pVals, &cVals )) ! goto cleanup; if (cProps != cVals) { PyErr_SetString(PyExc_ValueError, "The parameters must be sequences of the same size"); ! goto cleanup; } HRESULT hr; + { PY_INTERFACE_PRECALL; hr = pIPS->WriteMultiple( cProps, pProps, pVals, minId ); PY_INTERFACE_POSTCALL; + } + if ( FAILED(hr) ) + PyCom_BuildPyException(hr, pIPS, IID_IPropertyStorage); + else{ + Py_INCREF(Py_None); + ret = Py_None; + } + cleanup: PyObject_FreePROPSPECs(pProps, cProps); PyObject_FreePROPVARIANTs(pVals, cVals); ! return ret; } ! // @pymethod |PyIPropertyStorage|DeleteMultiple|Deletes properties from the property set PyObject *PyIPropertyStorage::DeleteMultiple(PyObject *self, PyObject *args) { *************** *** 386,390 **** PyObject *props; ! // @pyparm (<o PROPSPEC>, ...)|props||The property IDs. if ( !PyArg_ParseTuple(args, "O:ReadMultiple", &props)) return NULL; --- 383,387 ---- PyObject *props; ! // @pyparm (<o PROPSPEC>, ...)|props||Sequence containing names or IDs of properties to be deleted if ( !PyArg_ParseTuple(args, "O:ReadMultiple", &props)) return NULL; *************** *** 415,419 **** return NULL; PyObject *obProps; ! // @pyparm (<o PROPSPEC>, ...)|props||The property IDs. if ( !PyArg_ParseTuple(args, "O:ReadPropertyNames", &obProps)) return NULL; --- 412,416 ---- return NULL; PyObject *obProps; ! // @pyparm (int, ...)|props||Sequence of ints containing property IDs. if ( !PyArg_ParseTuple(args, "O:ReadPropertyNames", &obProps)) return NULL; *************** *** 426,434 **** HRESULT hr; LPWSTR *ppStrs = new LPWSTR[cProps]; memset(ppStrs, 0, sizeof(LPWSTR)*cProps); PY_INTERFACE_PRECALL; hr = pIPS->ReadPropertyNames( cProps, pProps, ppStrs ); PY_INTERFACE_POSTCALL; ! PyObject *rc; if ( FAILED(hr) ) --- 423,436 ---- HRESULT hr; LPWSTR *ppStrs = new LPWSTR[cProps]; + if (ppStrs==NULL){ + PyErr_NoMemory(); + goto cleanup; + } memset(ppStrs, 0, sizeof(LPWSTR)*cProps); + { PY_INTERFACE_PRECALL; hr = pIPS->ReadPropertyNames( cProps, pProps, ppStrs ); PY_INTERFACE_POSTCALL; ! } PyObject *rc; if ( FAILED(hr) ) *************** *** 436,445 **** else { rc = PyTuple_New(cProps); for (ULONG i=0;i<cProps;i++) ! PyTuple_SET_ITEM( rc, i, PyWinObject_FromOLECHAR(ppStrs[i]) ); ! } ! for (ULONG i=0;i<cProps;i++) ! if (ppStrs[i]) CoTaskMemFree(ppStrs[i]); ! delete [] ppStrs; PyObject_FreePROPIDs(pProps, cProps); return rc; --- 438,461 ---- else { rc = PyTuple_New(cProps); + if (rc==NULL) + goto cleanup; + for (ULONG i=0;i<cProps;i++){ + PyObject *propname=PyWinObject_FromOLECHAR(ppStrs[i]); + if (propname==NULL){ + Py_DECREF(rc); + rc=NULL; + goto cleanup; + } + PyTuple_SET_ITEM( rc, i, propname); + } + } + + cleanup: + if (ppStrs){ for (ULONG i=0;i<cProps;i++) ! if (ppStrs[i]) ! CoTaskMemFree(ppStrs[i]); ! delete [] ppStrs; ! } PyObject_FreePROPIDs(pProps, cProps); return rc; *************** *** 454,463 **** PyObject *obProps; PyObject *obNames; ! // @pyparm (<o PROPSPEC>, ...)|props||The property IDs. ! // @pyparm (string, ...)|names||The property names. if ( !PyArg_ParseTuple(args, "OO:WritePropertyNames", &obProps, &obNames)) return NULL; ! ULONG cProps = 0; PROPID *pProps = NULL; LPWSTR *ppStrs = NULL; --- 470,479 ---- PyObject *obProps; PyObject *obNames; ! // @pyparm (int, ...)|props||Sequence containing the property IDs. ! // @pyparm (string, ...)|names||Equal length sequence of property names. if ( !PyArg_ParseTuple(args, "OO:WritePropertyNames", &obProps, &obNames)) return NULL; ! ULONG cProps = 0, cNames=0; PROPID *pProps = NULL; LPWSTR *ppStrs = NULL; *************** *** 466,485 **** if (!PyObject_AsPROPIDs( obProps, &pProps, &cProps)) return NULL; ! ! if (!PySequence_Check(obNames) || PySequence_Length(obNames) != (int)cProps) { ! PyErr_SetString(PyExc_TypeError, "property named must be a sequence the same size as PROPDESCs"); ! return NULL; } HRESULT hr; - ppStrs = new LPWSTR[cProps]; - memset(ppStrs, 0, sizeof(LPWSTR)*cProps); - ULONG i; - for (i=0;i<cProps;i++) { - PyObject *sub = PySequence_GetItem(obNames, i); - BOOL ok = PyWinObject_AsBstr(sub, ppStrs+i); - Py_XDECREF(sub); - if (!ok) - goto done; - } { PY_INTERFACE_PRECALL; --- 482,493 ---- if (!PyObject_AsPROPIDs( obProps, &pProps, &cProps)) return NULL; ! if (!PyWinObject_AsWCHARArray(obNames, &ppStrs, &cNames, FALSE)) ! goto done; ! if (cNames != cProps) { ! PyErr_SetString(PyExc_TypeError, "Property names must be a sequence the same size as property ids"); ! goto done; } + HRESULT hr; { PY_INTERFACE_PRECALL; *************** *** 489,511 **** if ( FAILED(hr) ) ! rc = PyCom_BuildPyException(hr, pIPS, IID_IPropertyStorage); ! else { ! rc = PyTuple_New(cProps); ! for (ULONG i=0;i<cProps;i++) ! PyTuple_SET_ITEM( rc, i, PyWinObject_FromOLECHAR(ppStrs[i]) ); ! } ! done: ! if (pProps) ! PyObject_FreePROPIDs(pProps, cProps); ! if (ppStrs) { ! for (i=0;i<cProps;i++) { ! PyWinObject_FreeBstr(ppStrs[i]); } ! delete [] ppStrs; ! } return rc; } ! // @pymethod |PyIPropertyStorage|DeletePropertyNames|Description of DeletePropertyNames. PyObject *PyIPropertyStorage::DeletePropertyNames(PyObject *self, PyObject *args) { --- 497,512 ---- if ( FAILED(hr) ) ! PyCom_BuildPyException(hr, pIPS, IID_IPropertyStorage); ! else{ ! Py_INCREF(Py_None); ! rc = Py_None; } ! done: ! PyObject_FreePROPIDs(pProps, cProps); ! PyWinObject_FreeWCHARArray(ppStrs, cNames); return rc; } ! // @pymethod |PyIPropertyStorage|DeletePropertyNames|Removes property names from specified properties. PyObject *PyIPropertyStorage::DeletePropertyNames(PyObject *self, PyObject *args) { *************** *** 514,518 **** return NULL; PyObject *obProps; ! // @pyparm (<o PROPSPEC>, ...)|props||The property IDs. if ( !PyArg_ParseTuple(args, "O:DeletePropertyNames", &obProps)) return NULL; --- 515,519 ---- return NULL; PyObject *obProps; ! // @pyparm (int, ...)|props||Sequence of ints containing property IDs. if ( !PyArg_ParseTuple(args, "O:DeletePropertyNames", &obProps)) return NULL; *************** *** 526,530 **** hr = pIPS->DeletePropertyNames( cProps, pProps ); PY_INTERFACE_POSTCALL; ! if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIPS, IID_IPropertyStorage); --- 527,531 ---- hr = pIPS->DeletePropertyNames( cProps, pProps ); PY_INTERFACE_POSTCALL; ! PyObject_FreePROPIDs(pProps, cProps); if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIPS, IID_IPropertyStorage); *************** *** 534,538 **** } ! // @pymethod |PyIPropertyStorage|Commit|Description of Commit. PyObject *PyIPropertyStorage::Commit(PyObject *self, PyObject *args) { --- 535,539 ---- } ! // @pymethod |PyIPropertyStorage|Commit|Persists the property set to its base storage PyObject *PyIPropertyStorage::Commit(PyObject *self, PyObject *args) { *************** *** 540,544 **** if ( pIPS == NULL ) return NULL; ! // @pyparm int|grfCommitFlags||Description for grfCommitFlags DWORD grfCommitFlags; if ( !PyArg_ParseTuple(args, "l:Commit", &grfCommitFlags) ) --- 541,545 ---- if ( pIPS == NULL ) return NULL; ! // @pyparm int|grfCommitFlags||Combination of STGC_* flags DWORD grfCommitFlags; if ( !PyArg_ParseTuple(args, "l:Commit", &grfCommitFlags) ) *************** *** 556,560 **** } ! // @pymethod |PyIPropertyStorage|Revert|Description of Revert. PyObject *PyIPropertyStorage::Revert(PyObject *self, PyObject *args) { --- 557,561 ---- } ! // @pymethod |PyIPropertyStorage|Revert|Discards any changes that have been made PyObject *PyIPropertyStorage::Revert(PyObject *self, PyObject *args) { *************** *** 576,580 **** } ! // @pymethod |PyIPropertyStorage|Enum|Description of Enum. PyObject *PyIPropertyStorage::Enum(PyObject *self, PyObject *args) { --- 577,581 ---- } ! // @pymethod <o PyIEnumSTATPROPSTG>|PyIPropertyStorage|Enum|Creates an enumerator for properties in the property set PyObject *PyIPropertyStorage::Enum(PyObject *self, PyObject *args) { *************** *** 600,604 **** } ! // @pymethod |PyIPropertyStorage|SetTimes|Description of SetTimes. PyObject *PyIPropertyStorage::SetTimes(PyObject *self, PyObject *args) { --- 601,606 ---- } ! // @pymethod |PyIPropertyStorage|SetTimes|Sets the creation, last access, and modification time ! // @comm Some property sets do not support these times. PyObject *PyIPropertyStorage::SetTimes(PyObject *self, PyObject *args) { *************** *** 606,612 **** if ( pIPS == NULL ) return NULL; ! // @pyparm <o PyTime>|pctime||Description for pctime ! // @pyparm <o PyTime>|patime||Description for patime ! // @pyparm <o PyTime>|pmtime||Description for pmtime PyObject *obpctime; PyObject *obpatime; --- 608,614 ---- if ( pIPS == NULL ) return NULL; ! // @pyparm <o PyTime>|pctime||Creation time ! // @pyparm <o PyTime>|patime||Last access time ! // @pyparm <o PyTime>|pmtime||Modification time PyObject *obpctime; PyObject *obpatime; *************** *** 637,641 **** } ! // @pymethod |PyIPropertyStorage|SetClass|Description of SetClass. PyObject *PyIPropertyStorage::SetClass(PyObject *self, PyObject *args) { --- 639,643 ---- } ! // @pymethod |PyIPropertyStorage|SetClass|Sets the GUID for the property set PyObject *PyIPropertyStorage::SetClass(PyObject *self, PyObject *args) { *************** *** 648,654 **** if ( !PyArg_ParseTuple(args, "O:SetClass", &obclsid) ) return NULL; ! BOOL bPythonIsHappy = TRUE; ! if (!PyWinObject_AsIID(obclsid, &clsid)) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; --- 650,655 ---- if ( !PyArg_ParseTuple(args, "O:SetClass", &obclsid) ) return NULL; ! if (!PyWinObject_AsIID(obclsid, &clsid)) ! return NULL; HRESULT hr; PY_INTERFACE_PRECALL; *************** *** 663,667 **** } ! // @pymethod |PyIPropertyStorage|Stat|Description of Stat. PyObject *PyIPropertyStorage::Stat(PyObject *self, PyObject *args) { --- 664,668 ---- } ! // @pymethod |PyIPropertyStorage|Stat|Returns various infomation about the property set PyObject *PyIPropertyStorage::Stat(PyObject *self, PyObject *args) { *************** *** 686,700 **** { { "ReadMultiple", PyIPropertyStorage::ReadMultiple, 1 }, // @pymeth ReadMultiple|Reads specified properties from the current property set. ! { "WriteMultiple", PyIPropertyStorage::WriteMultiple, 1 }, // @pymeth WriteMultiple|Description of WriteMultiple ! { "DeleteMultiple", PyIPropertyStorage::DeleteMultiple, 1 }, // @pymeth DeleteMultiple|Description of DeleteMultiple { "ReadPropertyNames", PyIPropertyStorage::ReadPropertyNames, 1 }, // @pymeth ReadPropertyNames|Retrieves any existing string names for the specified property identifiers. { "WritePropertyNames", PyIPropertyStorage::WritePropertyNames, 1 }, // @pymeth WritePropertyNames|Assigns string names to a specified array of property IDs in the current property set. ! { "DeletePropertyNames", PyIPropertyStorage::DeletePropertyNames, 1 }, // @pymeth DeletePropertyNames|Description of DeletePropertyNames ! { "Commit", PyIPropertyStorage::Commit, 1 }, // @pymeth Commit|Description of Commit ! { "Revert", PyIPropertyStorage::Revert, 1 }, // @pymeth Revert|Description of Revert ! { "Enum", PyIPropertyStorage::Enum, 1 }, // @pymeth Enum|Description of Enum ! { "SetTimes", PyIPropertyStorage::SetTimes, 1 }, // @pymeth SetTimes|Description of SetTimes ! { "SetClass", PyIPropertyStorage::SetClass, 1 }, // @pymeth SetClass|Description of SetClass ! { "Stat", PyIPropertyStorage::Stat, 1 }, // @pymeth Stat|Description of Stat { NULL } }; --- 687,701 ---- { { "ReadMultiple", PyIPropertyStorage::ReadMultiple, 1 }, // @pymeth ReadMultiple|Reads specified properties from the current property set. ! { "WriteMultiple", PyIPropertyStorage::WriteMultiple, 1 }, // @pymeth WriteMultiple|Creates or modifies properties in the property set ! { "DeleteMultiple", PyIPropertyStorage::DeleteMultiple, 1 }, // @pymeth DeleteMultiple|Deletes properties from the property set { "ReadPropertyNames", PyIPropertyStorage::ReadPropertyNames, 1 }, // @pymeth ReadPropertyNames|Retrieves any existing string names for the specified property identifiers. { "WritePropertyNames", PyIPropertyStorage::WritePropertyNames, 1 }, // @pymeth WritePropertyNames|Assigns string names to a specified array of property IDs in the current property set. ! { "DeletePropertyNames", PyIPropertyStorage::DeletePropertyNames, 1 }, // @pymeth DeletePropertyNames|Removes property names from specified properties. ! { "Commit", PyIPropertyStorage::Commit, 1 }, // @pymeth Commit|Persists the property set to its base storage ! { "Revert", PyIPropertyStorage::Revert, 1 }, // @pymeth Revert|Discards any changes that have been made ! { "Enum", PyIPropertyStorage::Enum, 1 }, // @pymeth Enum|Creates an enumerator for properties in the property set ! { "SetTimes", PyIPropertyStorage::SetTimes, 1 }, // @pymeth SetTimes|Sets the creation, last access, and modification time ! { "SetClass", PyIPropertyStorage::SetClass, 1 }, // @pymeth SetClass|Sets the GUID for the property set ! { "Stat", PyIPropertyStorage::Stat, 1 }, // @pymeth Stat|Returns various infomation about the property set { NULL } }; |
From: Mark H. <mha...@us...> - 2007-08-21 05:32:25
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8815 Modified Files: setup.py Log Message: remove some bdist_msi hackery now that python's svn trunk has some fixes. Index: setup.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup.py,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** setup.py 18 Jul 2007 08:50:24 -0000 1.62 --- setup.py 21 Aug 2007 05:32:26 -0000 1.63 *************** *** 73,77 **** * Execute: c:\path_to_32bit_python\python.exe setup.py build * un-set PYTHONHOME (set PYTHONHOME=) ! * Execute: c:\path_to_32bit_python\python.exe setup.py bdist_msi (Note that these instructions will have clobbered your 32bit build of --- 73,80 ---- * Execute: c:\path_to_32bit_python\python.exe setup.py build * un-set PYTHONHOME (set PYTHONHOME=) ! * Execute: c:\path_to_32bit_python_6\python.exe setup.py bdist_msi --skip-build ! [Note that python 6.0 or later *must* be used for this final step. If ! python 6 has not been released, you must use Python as built from the ! svn trunk] (Note that these instructions will have clobbered your 32bit build of *************** *** 127,136 **** # so we monkey-patch distutils :( We must do this before the main distutils # imports, which generall does 'from distutils.util import get_platform' def hacked_get_platform(): """getplaform monkey-patched by pywin32 setup""" ! if is_32bit: ! return sys.platform ! else: ! return get_build_architecture().lower() import distutils.util --- 130,145 ---- # so we monkey-patch distutils :( We must do this before the main distutils # imports, which generall does 'from distutils.util import get_platform' + # NOTE: Python 2.6 has the base get_platform() fixed - but there still + # remains the cross-compile issue (ie, get_platform() needs to know the + # *target* platform). The values returned from this function must however + # be in the set of values Python 2.6's get_platform() returns... def hacked_get_platform(): """getplaform monkey-patched by pywin32 setup""" ! ba = get_build_architecture() ! if ba == "AMD64": ! return "win-x86_64" ! if ba == "Itanium": ! return "win-ia64" ! return sys.platform import distutils.util *************** *** 1053,1066 **** "-quiet", "-wait", str(os.getpid()), "-install") - if bdist_msi: - class my_bdist_msi(bdist_msi): - def get_installer_filename(self, fullname): - # base class hard-codes 'win32' - plat = distutils.util.get_platform() - installer_name = os.path.join(self.dist_dir, - "%s.%s-py%s.msi" % - (fullname, plat, self.target_version)) - return installer_name - # As per get_source_files, we need special handling so .mc file is # processed first. It appears there was an intention to fix distutils --- 1062,1065 ---- *************** *** 1687,1692 **** 'install_data': my_install_data, } - if bdist_msi: - cmdclass['bdist_msi'] = my_bdist_msi dist = setup(name="pywin32", --- 1686,1689 ---- |
From: Roger U. <ru...@us...> - 2007-08-19 04:28:19
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22015/win32/src Modified Files: win32process.i Log Message: Fix 64-bit warnings Index: win32process.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32process.i,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** win32process.i 23 Jul 2007 08:34:04 -0000 1.30 --- win32process.i 19 Aug 2007 04:28:20 -0000 1.31 *************** *** 478,484 **** } int i; ! unsigned bufLen = 0; PyObject *keys = NULL, *vals = NULL; ! int envLength = PyMapping_Length(env); LPVOID result = NULL; WCHAR *pUCur; --- 478,484 ---- } int i; ! size_t bufLen = 0; PyObject *keys = NULL, *vals = NULL; ! Py_ssize_t envLength = PyMapping_Length(env); LPVOID result = NULL; WCHAR *pUCur; |
From: Roger U. <ru...@us...> - 2007-08-17 08:41:35
|
Update of /cvsroot/pywin32/pywin32/win32/src/win32net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22522/win32/src/win32net Modified Files: win32netmodule.cpp Log Message: Fix a couple of 64-bit issues and a memory leak Index: win32netmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32net/win32netmodule.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** win32netmodule.cpp 24 May 2007 06:01:06 -0000 1.24 --- win32netmodule.cpp 17 Aug 2007 08:41:35 -0000 1.25 *************** *** 394,402 **** PyObject *obServer, *obGroup, *obData; PyObject *ret = NULL; DWORD level; DWORD err = 0; BYTE *buf = NULL; BYTE **ppTempObjects = NULL; ! int i, numEntries; PyNET_STRUCT *pI; if (!PyArg_ParseTuple(args, "OOiO", &obServer, &obGroup, &level, &obData)) --- 394,403 ---- PyObject *obServer, *obGroup, *obData; PyObject *ret = NULL; + PyObject *members_tuple=NULL; DWORD level; DWORD err = 0; BYTE *buf = NULL; BYTE **ppTempObjects = NULL; ! DWORD i, numEntries; PyNET_STRUCT *pI; if (!PyArg_ParseTuple(args, "OOiO", &obServer, &obGroup, &level, &obData)) *************** *** 409,426 **** goto done; ! if (!PySequence_Check(obData)) { PyErr_SetString(PyExc_TypeError, "Data must be a sequence of dictionaries"); goto done; } - numEntries = PySequence_Length(obData); ppTempObjects = new BYTE *[numEntries]; memset(ppTempObjects, 0, sizeof(BYTE *) * numEntries); for (i=0;i<numEntries;i++) { ! PyObject *sub = PySequence_GetItem(obData, i); ! if (sub==NULL) goto done; ! if (!PyObject_AsNET_STRUCT(sub, pI, ppTempObjects+i)) { ! Py_DECREF(sub); goto done; - } } // OK - all objects are ok, and we are holding the buffers. --- 410,425 ---- goto done; ! ! members_tuple=PyWinSequence_Tuple(obData, &numEntries); ! if (members_tuple==NULL) { PyErr_SetString(PyExc_TypeError, "Data must be a sequence of dictionaries"); goto done; } ppTempObjects = new BYTE *[numEntries]; memset(ppTempObjects, 0, sizeof(BYTE *) * numEntries); for (i=0;i<numEntries;i++) { ! PyObject *sub = PyTuple_GET_ITEM(members_tuple, i); ! if (!PyObject_AsNET_STRUCT(sub, pI, ppTempObjects+i)) goto done; } // OK - all objects are ok, and we are holding the buffers. *************** *** 445,448 **** --- 444,448 ---- PyWinObject_FreeWCHAR(szServer); PyWinObject_FreeWCHAR(szGroup); + Py_XDECREF(members_tuple); if (ppTempObjects) { for (i=0;i<numEntries;i++) { *************** *** 836,842 **** PyObject *obServer, *obGroup, *obData; PyObject *ret = NULL; DWORD err = 0; BYTE *buf = NULL; ! int i, numEntries; DWORD level = 3; LOCALGROUP_MEMBERS_INFO_3 *plgrminfo; --- 836,843 ---- PyObject *obServer, *obGroup, *obData; PyObject *ret = NULL; + PyObject *members_tuple=NULL; DWORD err = 0; BYTE *buf = NULL; ! DWORD i, numEntries; DWORD level = 3; LOCALGROUP_MEMBERS_INFO_3 *plgrminfo; *************** *** 849,875 **** goto done; ! if (!PySequence_Check(obData)) { PyErr_SetString(PyExc_TypeError, "Data must be a sequence of dictionaries"); goto done; } ! ! numEntries = PySequence_Length(obData); ! plgrminfo = new LOCALGROUP_MEMBERS_INFO_3[numEntries]; // XXX - todo - we should allow a list of LOCALGROUP_MEMBER_INFO items *or* strings memset(plgrminfo, 0, sizeof(LOCALGROUP_MEMBERS_INFO_3) * numEntries); for (i = 0; i < numEntries; i++) { ! PyObject *sub = PySequence_GetItem(obData, i); ! if (sub==NULL) ! goto done; ! PyWinObject_AsWCHAR(sub, &plgrminfo[i].lgrmi3_domainandname); ! if (!plgrminfo[i].lgrmi3_domainandname) { ! Py_DECREF(sub); goto done; - } } ! Py_BEGIN_ALLOW_THREADS ! err = NetLocalGroupDelMembers(szServer, szGroup, 3, (BYTE *)plgrminfo, numEntries); ! Py_END_ALLOW_THREADS if (err) { ReturnNetError("NetLocalGroupDelMembers", err); --- 850,874 ---- goto done; ! members_tuple=PyWinSequence_Tuple(obData, &numEntries); ! if (members_tuple==NULL) { PyErr_SetString(PyExc_TypeError, "Data must be a sequence of dictionaries"); goto done; } ! plgrminfo = new LOCALGROUP_MEMBERS_INFO_3[numEntries]; ! if (plgrminfo==NULL){ ! PyErr_NoMemory(); ! goto done; ! } // XXX - todo - we should allow a list of LOCALGROUP_MEMBER_INFO items *or* strings memset(plgrminfo, 0, sizeof(LOCALGROUP_MEMBERS_INFO_3) * numEntries); for (i = 0; i < numEntries; i++) { ! PyObject *sub = PyTuple_GET_ITEM(members_tuple, i); ! if (!PyWinObject_AsWCHAR(sub, &plgrminfo[i].lgrmi3_domainandname)) goto done; } ! Py_BEGIN_ALLOW_THREADS ! err = NetLocalGroupDelMembers(szServer, szGroup, 3, (BYTE *)plgrminfo, numEntries); ! Py_END_ALLOW_THREADS if (err) { ReturnNetError("NetLocalGroupDelMembers", err); *************** *** 883,892 **** PyWinObject_FreeWCHAR(szServer); PyWinObject_FreeWCHAR(szGroup); if (plgrminfo) { for (i=0;i<numEntries;i++) { ! if (plgrminfo[i].lgrmi3_domainandname) { ! PyWinObject_FreeWCHAR(plgrminfo[i].lgrmi3_domainandname); ! } } } return ret; --- 882,893 ---- PyWinObject_FreeWCHAR(szServer); PyWinObject_FreeWCHAR(szGroup); + Py_XDECREF(members_tuple); if (plgrminfo) { for (i=0;i<numEntries;i++) { ! if (plgrminfo[i].lgrmi3_domainandname) { ! PyWinObject_FreeWCHAR(plgrminfo[i].lgrmi3_domainandname); ! } } + delete [] plgrminfo; } return ret; *************** *** 1116,1120 **** {"NetUserModalsGet", PyNetUserModalsGet, 1}, // @pymeth NetUserModalsGet|Retrieves global user information on a server. ! {"NetUserModalsSet", PyNetUserModalsSet, 1}, // @pymeth NetUserModalsSet|Sets global user information on a server. {"NetWkstaUserEnum", PyNetWkstaUserEnum, 1}, // @pymeth NetWkstaUserEnum|Retrieves information about all users currently logged on to the workstation. --- 1117,1121 ---- {"NetUserModalsGet", PyNetUserModalsGet, 1}, // @pymeth NetUserModalsGet|Retrieves global user information on a server. ! {"NetUserModalsSet", PyNetUserModalsSet, 1}, // @pymeth NetUserModalsSet|Sets global user information on a server. {"NetWkstaUserEnum", PyNetWkstaUserEnum, 1}, // @pymeth NetWkstaUserEnum|Retrieves information about all users currently logged on to the workstation. |
From: Roger U. <ru...@us...> - 2007-08-16 09:18:31
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13676/win32/src Modified Files: win32pdhmodule.cpp Removed Files: pdh.h Log Message: Fix some 64-bit issues in win32pdh, and remove copy of pdh.h --- pdh.h DELETED --- Index: win32pdhmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32pdhmodule.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** win32pdhmodule.cpp 3 Jun 2007 14:53:07 -0000 1.15 --- win32pdhmodule.cpp 16 Aug 2007 09:18:31 -0000 1.16 *************** *** 912,916 **** ! PDH_STATUS __stdcall CounterPathCallback(DWORD dwArg) { MY_DLG_CONFIG *pMy = (MY_DLG_CONFIG *)dwArg; --- 912,916 ---- ! PDH_STATUS __stdcall PyCounterPathCallback(DWORD_PTR dwArg) { MY_DLG_CONFIG *pMy = (MY_DLG_CONFIG *)dwArg; *************** *** 969,973 **** return NULL; } ! int seqLen = PySequence_Length(obFlags); if (seqLen>0) GET_IT(pcfg->bIncludeInstanceIndex, obFlags, 0); if (seqLen>1) GET_IT(pcfg->bSingleCounterPerAdd, obFlags, 1); --- 969,973 ---- return NULL; } ! Py_ssize_t seqLen = PySequence_Length(obFlags); if (seqLen>0) GET_IT(pcfg->bIncludeInstanceIndex, obFlags, 0); if (seqLen>1) GET_IT(pcfg->bSingleCounterPerAdd, obFlags, 1); *************** *** 980,985 **** } ! pcfg->dwCallBackArg = (DWORD)&myCfg; ! pcfg->pCallBack = CounterPathCallback; pcfg->szReturnPathBuffer = (char *)malloc(1024); --- 980,985 ---- } ! pcfg->dwCallBackArg = (DWORD_PTR)&myCfg; ! pcfg->pCallBack = PyCounterPathCallback; pcfg->szReturnPathBuffer = (char *)malloc(1024); |
From: Roger U. <ru...@us...> - 2007-08-16 05:09:53
|
Update of /cvsroot/pywin32/pywin32/win32/src/win32print In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12763/win32/src/win32print Modified Files: win32print.cpp Log Message: Fix some 64-bit warnings Index: win32print.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32print/win32print.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** win32print.cpp 3 Jun 2007 14:53:07 -0000 1.27 --- win32print.cpp 16 Aug 2007 05:09:52 -0000 1.28 *************** *** 1810,1817 **** PyObject *obdevmode=Py_None, *ret=NULL, *tuple_item; DWORD result, bufsize, bufindex; ! static size_t papernamesize=64; // same for DC_PAPERNAMES, DC_MEDIATYPENAMES, DC_MEDIAREADY, DC_FILEDEPENDENCIES ! static size_t binnamesize=24; // DC_BINNAMES ! static size_t personalitysize=32; // DC_PERSONALITY ! size_t retsize; if (!PyArg_ParseTuple(args,"ssh|O:DeviceCapabilities", &device, &port, &capability, &obdevmode)) --- 1810,1817 ---- PyObject *obdevmode=Py_None, *ret=NULL, *tuple_item; DWORD result, bufsize, bufindex; ! static DWORD papernamesize=64; // same for DC_PAPERNAMES, DC_MEDIATYPENAMES, DC_MEDIAREADY, DC_FILEDEPENDENCIES ! static DWORD binnamesize=24; // DC_BINNAMES ! static DWORD personalitysize=32; // DC_PERSONALITY ! DWORD retsize; if (!PyArg_ParseTuple(args,"ssh|O:DeviceCapabilities", &device, &port, &capability, &obdevmode)) |
From: Roger U. <ru...@us...> - 2007-08-15 09:39:46
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3153/win32/src Modified Files: win32evtlog.i Log Message: Fix remaining 64-bit warnings Index: win32evtlog.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32evtlog.i,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** win32evtlog.i 8 Nov 2003 12:34:45 -0000 1.5 --- win32evtlog.i 15 Aug 2007 09:39:48 -0000 1.6 *************** *** 240,287 **** { PyObject *rc = NULL; ! WORD numStrings = 0; ! BSTR *pStrings = NULL; ! int i; DWORD dataSize = 0; ! char *pData; PSID sid; if (!PyWinObject_AsSID(obSID, &sid, TRUE)) return NULL; ! if (obStrings==Py_None) { ! pStrings = NULL; ! } else if (PySequence_Check(obStrings)) { ! numStrings = PySequence_Length(obStrings); ! pStrings = new BSTR [numStrings]; ! if (pStrings==NULL) { ! PyErr_SetString(PyExc_MemoryError, "Allocating string arrays"); ! goto cleanup; ! } ! memset(pStrings, 0, sizeof(WCHAR *)*numStrings); ! for (i=0;i<numStrings;i++) { ! PyObject *obString = PySequence_GetItem(obStrings, i); ! if (obString==NULL) { ! goto cleanup; ! } ! BOOL ok = PyWinObject_AsWCHAR(obString, pStrings+i); ! Py_XDECREF(obString); ! if (!ok) ! goto cleanup; ! } ! } else { ! PyErr_SetString(PyExc_TypeError, "strings must be None or a sequence"); ! goto cleanup; ! } ! if (obData==Py_None) pData = NULL; ! else if (PyString_Check(obData)){ ! pData = PyString_AsString(obData); ! dataSize = PyString_Size(obData); ! } else { ! PyErr_SetString(PyExc_TypeError, "data must be None or a string"); return NULL; ! } BOOL ok; Py_BEGIN_ALLOW_THREADS ! ok = ReportEventW(hEventLog, wType, wCategory, dwEventID, sid, numStrings, dataSize, (const WCHAR **)pStrings, pData); Py_END_ALLOW_THREADS --- 240,261 ---- { PyObject *rc = NULL; ! DWORD numStrings = 0; ! WCHAR **pStrings = NULL; DWORD dataSize = 0; ! void *pData; PSID sid; if (!PyWinObject_AsSID(obSID, &sid, TRUE)) return NULL; ! if (!PyWinObject_AsReadBuffer(obData, &pData, &dataSize, TRUE)) pData = NULL; ! if (!PyWinObject_AsWCHARArray(obStrings, &pStrings, &numStrings, TRUE)) return NULL; ! if (numStrings > USHRT_MAX){ ! PyErr_Format(PyExc_ValueError, "String inserts can contain at most %d strings", USHRT_MAX); ! goto cleanup; ! } BOOL ok; Py_BEGIN_ALLOW_THREADS ! ok = ReportEventW(hEventLog, wType, wCategory, dwEventID, sid, (WORD)numStrings, dataSize, (const WCHAR **)pStrings, pData); Py_END_ALLOW_THREADS *************** *** 293,301 **** rc = Py_None; cleanup: ! if (pStrings) { ! for (i=0;i<numStrings;i++) ! PyWinObject_FreeWCHAR(pStrings[i]); ! delete [] pStrings; ! } return rc; } --- 267,271 ---- rc = Py_None; cleanup: ! PyWinObject_FreeWCHARArray(pStrings, numStrings); return rc; } *************** *** 402,412 **** // @pyswig |ReportEvent|Reports an event %name (ReportEvent) PyObject *MyReportEvent ( ! HANDLE hEventLog, ! WORD wType, ! WORD wCategory, ! DWORD dwEventID, ! PyObject *pyobject, ! PyObject *pyobject, ! PyObject *pyobject ); --- 372,382 ---- // @pyswig |ReportEvent|Reports an event %name (ReportEvent) PyObject *MyReportEvent ( ! HANDLE hEventLog, // @pyparm <o PyHANDLE>|EventLog||Handle to an event log ! WORD wType, // @pyparm int|Type||win32con.EVENTLOG_* value ! WORD wCategory, // @pyparm int|Category||Source-specific event category ! DWORD dwEventID, // @pyparm int|EventID||Source-specific event identifier ! PyObject *obUserSid, // @pyparm <o PySID>|UserSid||Sid of current user, can be None ! PyObject *obStrings, // @pyparm sequence|Strings||Sequence of unicode strings to be inserted in message ! PyObject *obRawData // @pyparm str|RawData||Binary data for event, can be None ); |
From: Roger U. <ru...@us...> - 2007-08-15 08:04:36
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1008/win32/src Modified Files: win32profilemodule.cpp Log Message: Fix a couple of 64 bit warnings Index: win32profilemodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32profilemodule.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** win32profilemodule.cpp 3 Jun 2007 14:53:07 -0000 1.2 --- win32profilemodule.cpp 15 Aug 2007 08:04:37 -0000 1.3 *************** *** 62,69 **** else{ vallen=wcslen(++eq); ! val=PyWinObject_FromWCHAR(eq, vallen); } keylen=totallen-(vallen+1); ! key=PyWinObject_FromWCHAR(multistring, keylen); if ((key==NULL) || (val==NULL) || (PyDict_SetItem(ret, key, val)==-1)){ Py_XDECREF(key); --- 62,69 ---- else{ vallen=wcslen(++eq); ! val=PyUnicode_FromWideChar(eq, vallen); } keylen=totallen-(vallen+1); ! key=PyUnicode_FromWideChar(multistring, keylen); if ((key==NULL) || (val==NULL) || (PyDict_SetItem(ret, key, val)==-1)){ Py_XDECREF(key); |
From: Roger U. <ru...@us...> - 2007-08-14 01:27:25
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2470/win32/src Modified Files: win32clipboardmodule.cpp Log Message: Fix a couple of 64 bit issues, and some autoduck Index: win32clipboardmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32clipboardmodule.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** win32clipboardmodule.cpp 3 Jun 2007 14:53:07 -0000 1.20 --- win32clipboardmodule.cpp 14 Aug 2007 01:27:26 -0000 1.21 *************** *** 337,341 **** void * cData = NULL; ! DWORD size; switch (format) { case CF_HDROP: --- 337,342 ---- void * cData = NULL; ! size_t size; ! DWORD dwordsize; switch (format) { case CF_HDROP: *************** *** 343,372 **** break; case CF_ENHMETAFILE: ! size = GetEnhMetaFileBits((HENHMETAFILE)handle, 0, NULL); ! if (!size) return ReturnAPIError("GetClipboardData:GetEnhMetafileBits(NULL)"); // allocate a temporary buffer for enhanced metafile ! cData = malloc(size); if (cData == NULL) return ReturnAPIError("GetClipboardData:malloc"); // copy enhanced metafile into the temporary buffer ! if (0 == GetEnhMetaFileBits((HENHMETAFILE)handle, size, (LPBYTE)cData)) { free(cData); return ReturnAPIError("GetClipboardData:GetEnhMetafileBits"); } break; case CF_METAFILEPICT: ! size = GetMetaFileBitsEx((HMETAFILE)handle, 0, NULL); ! if (!size) return ReturnAPIError("GetClipboardData:GetMetafileBitsEx(NULL)"); // allocate a temporary buffer for metafile ! cData = malloc(size); if (cData == NULL) return ReturnAPIError("GetClipboardData:malloc"); // copy metafile into the temporary buffer ! if (0 == GetMetaFileBitsEx((HMETAFILE)handle, size, cData)) { free(cData); return ReturnAPIError("GetClipboardData:GetMetafileBitsEx"); } break; // All other formats simply return the data as a blob. --- 344,378 ---- break; case CF_ENHMETAFILE: ! dwordsize = GetEnhMetaFileBits((HENHMETAFILE)handle, 0, NULL); ! if (!dwordsize) return ReturnAPIError("GetClipboardData:GetEnhMetafileBits(NULL)"); // allocate a temporary buffer for enhanced metafile ! cData = malloc(dwordsize); if (cData == NULL) return ReturnAPIError("GetClipboardData:malloc"); // copy enhanced metafile into the temporary buffer ! if (0 == GetEnhMetaFileBits((HENHMETAFILE)handle, dwordsize, (LPBYTE)cData)) { free(cData); return ReturnAPIError("GetClipboardData:GetEnhMetafileBits"); } + size=dwordsize; break; case CF_METAFILEPICT: ! // @todo CF_METAFILEPICT format returns a pointer to a METAFILEPICT struct which contains the metafile handle, ! // rather than returning the handle directly. This code currently fails with ! // error: (6, 'GetClipboardData:GetMetafileBitsEx(NULL)', 'The handle is invalid.') ! dwordsize = GetMetaFileBitsEx((HMETAFILE)handle, 0, NULL); ! if (!dwordsize) return ReturnAPIError("GetClipboardData:GetMetafileBitsEx(NULL)"); // allocate a temporary buffer for metafile ! cData = malloc(dwordsize); if (cData == NULL) return ReturnAPIError("GetClipboardData:malloc"); // copy metafile into the temporary buffer ! if (0 == GetMetaFileBitsEx((HMETAFILE)handle, dwordsize, cData)) { free(cData); return ReturnAPIError("GetClipboardData:GetMetafileBitsEx"); } + size=dwordsize; break; // All other formats simply return the data as a blob. *************** *** 404,408 **** break; case CF_UNICODETEXT: ! ret = PyWinObject_FromWCHAR((wchar_t *)cData, (size / sizeof(wchar_t))-1); GlobalUnlock(handle); break; --- 410,414 ---- break; case CF_UNICODETEXT: ! ret = PyUnicode_FromWideChar((wchar_t *)cData, (size / sizeof(wchar_t))-1); GlobalUnlock(handle); break; *************** *** 424,427 **** --- 430,434 ---- } return ret; + // @comm An application can enumerate the available formats in advance by // using the EnumClipboardFormats function.<nl> *************** *** 447,453 **** // @flag CF_HDROP|A tuple of Unicode filenames. // @flag CF_UNICODETEXT|A unicode object. ! // @flag CF_UNICODETEXT|A string object. // @flag CF_ENHMETAFILE|A string with binary data obtained from GetEnhMetaFileBits ! // @flag CF_METAFILEPICT|A string with binary data obtained from GetMetaFileBitsEx // @flag All other formats|A string with binary data obtained directly from the // global memory referenced by the handle. --- 454,461 ---- // @flag CF_HDROP|A tuple of Unicode filenames. // @flag CF_UNICODETEXT|A unicode object. ! // @flag CF_OEMTEXT|A string object. ! // @flag CF_TEXT|A string object. // @flag CF_ENHMETAFILE|A string with binary data obtained from GetEnhMetaFileBits ! // @flag CF_METAFILEPICT|A string with binary data obtained from GetMetaFileBitsEx (currently broken) // @flag All other formats|A string with binary data obtained directly from the // global memory referenced by the handle. *************** *** 671,683 **** //***************************************************************************** // ! // @pymethod int|win32clipboard|GetPriorityClipboardFormat|The ! // GetPriorityClipboardFormat function returns the first available clipboard ! // format in the specified list. ! static PyObject * py_getPriority_clipboard_format(PyObject* self, PyObject* args) { ! // @pyparm tuple|formats||Tuple of integers identifying clipboard formats, // in priority order. For a description of the standard clipboard formats, // see Standard Clipboard Formats. --- 679,688 ---- //***************************************************************************** // ! // @pymethod int|win32clipboard|GetPriorityClipboardFormat|Returns the first available clipboard format in the specified list. static PyObject * py_getPriority_clipboard_format(PyObject* self, PyObject* args) { ! // @pyparm sequence|formats||Sequence of integers identifying clipboard formats, // in priority order. For a description of the standard clipboard formats, // see Standard Clipboard Formats. *************** *** 689,708 **** } ! if (!PyTuple_Check(formats)) { ! RETURN_TYPE_ERR( ! "GetPriorityClipboardFormat requires a tuple of integer formats"); ! } ! ! int num_formats = PyTuple_Size(formats); ! UINT *format_list = new UINT[num_formats]; ! PyObject *o; ! for (int i = 0; i < num_formats; i++) { ! o = PyTuple_GetItem(formats, i); ! if (!PyInt_Check(o)) { ! delete format_list; ! RETURN_TYPE_ERR ("GetPriorityClipboardFormat expected integer formats."); ! } ! format_list[i] = PyInt_AsLong(o); ! } int rc; --- 694,701 ---- } ! UINT *format_list; ! DWORD num_formats; ! if (!PyWinObject_AsDWORDArray(formats, (DWORD **)&format_list, &num_formats, FALSE)) ! return NULL; int rc; *************** *** 711,718 **** Py_END_ALLOW_THREADS; ! delete format_list; ! ! return (Py_BuildValue("i", rc)); ! // @pyseeapi GetPriorityClipboardFormat // @pyseeapi Standard Clipboard Formats --- 704,709 ---- Py_END_ALLOW_THREADS; ! free(format_list); ! return PyInt_FromLong(rc); // @pyseeapi GetPriorityClipboardFormat // @pyseeapi Standard Clipboard Formats |
From: Roger U. <ru...@us...> - 2007-08-13 04:28:50
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/authorization/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28710/com/win32comext/authorization/src Modified Files: PyGSecurityInformation.cpp Log Message: Fix a couple of 64-bit warnings Index: PyGSecurityInformation.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/authorization/src/PyGSecurityInformation.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PyGSecurityInformation.cpp 3 Jun 2007 14:53:06 -0000 1.4 --- PyGSecurityInformation.cpp 13 Aug 2007 04:28:51 -0000 1.5 *************** *** 176,180 **** HRESULT hr; PyObject *result=NULL, *obObjectType=NULL; ! PyObject *obAccesses, *fsAccesses=NULL, *obAccess, *tpAccess; PyObject *si_access_guid, *si_access_Name; ULONG tuple_ind; --- 176,180 ---- HRESULT hr; PyObject *result=NULL, *obObjectType=NULL; ! PyObject *obAccesses, *Accesses_tuple=NULL, *obAccess, *tpAccess; PyObject *si_access_guid, *si_access_Name; ULONG tuple_ind; *************** *** 203,213 **** goto done; } ! fsAccesses=PySequence_Fast(obAccesses,"Return value must be a sequence of SI_ACCESS tuples"); ! if (fsAccesses==NULL){ hr=MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetAccessRights"); goto done; } - cAccessRights=PySequence_Fast_GET_SIZE(fsAccesses); // piDefaultAccess is apparently not sanity checked, and can cause a crash in aclui.dll if // greater than actual number of SI_ACCESS's. --- 203,212 ---- goto done; } ! Accesses_tuple=PyWinSequence_Tuple(obAccesses, &cAccessRights); ! if (Accesses_tuple==NULL){ hr=MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetAccessRights"); goto done; } // piDefaultAccess is apparently not sanity checked, and can cause a crash in aclui.dll if // greater than actual number of SI_ACCESS's. *************** *** 224,228 **** hr=S_OK; for (tuple_ind=0;tuple_ind<cAccessRights; tuple_ind++){ ! obAccess=PySequence_Fast_GET_ITEM(fsAccesses, tuple_ind); tpAccess=PySequence_Tuple(obAccess); if ((tpAccess==NULL) --- 223,227 ---- hr=S_OK; for (tuple_ind=0;tuple_ind<cAccessRights; tuple_ind++){ ! obAccess=PyTuple_GET_ITEM(Accesses_tuple, tuple_ind); tpAccess=PySequence_Tuple(obAccess); if ((tpAccess==NULL) *************** *** 253,257 **** Py_XDECREF(result); Py_XDECREF(obObjectType); ! Py_XDECREF(fsAccesses); return hr; } --- 252,256 ---- Py_XDECREF(result); Py_XDECREF(obObjectType); ! Py_XDECREF(Accesses_tuple); return hr; } *************** *** 311,315 **** { PY_GATEWAY_METHOD; ! PyObject *result=NULL, *fsInheritTypes=NULL, *obInheritType, *tpInheritType=NULL; PyObject *obguid, *obName; ULONG tuple_ind; --- 310,314 ---- { PY_GATEWAY_METHOD; ! PyObject *result=NULL, *InheritTypes_tuple=NULL, *obInheritType, *tpInheritType=NULL; PyObject *obguid, *obName; ULONG tuple_ind; *************** *** 320,329 **** if (FAILED(hr)) goto done; ! fsInheritTypes=PySequence_Fast(result,"Return value must be a sequence of SI_INHERIT_TYPE tuples"); ! if (fsInheritTypes==NULL){ hr=MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetInheritTypes"); goto done; } - cInheritTypes=PySequence_Fast_GET_SIZE(fsInheritTypes); InheritTypes=(PSI_INHERIT_TYPE)malloc(cInheritTypes * sizeof(SI_INHERIT_TYPE)); if (InheritTypes==NULL){ --- 319,327 ---- if (FAILED(hr)) goto done; ! InheritTypes_tuple=PyWinSequence_Tuple(result, &cInheritTypes); ! if (InheritTypes_tuple==NULL){ hr=MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetInheritTypes"); goto done; } InheritTypes=(PSI_INHERIT_TYPE)malloc(cInheritTypes * sizeof(SI_INHERIT_TYPE)); if (InheritTypes==NULL){ *************** *** 334,338 **** hr=S_OK; for (tuple_ind=0;tuple_ind<cInheritTypes; tuple_ind++){ ! obInheritType=PySequence_Fast_GET_ITEM(fsInheritTypes, tuple_ind); tpInheritType=PySequence_Tuple(obInheritType); if ((tpInheritType==NULL) --- 332,336 ---- hr=S_OK; for (tuple_ind=0;tuple_ind<cInheritTypes; tuple_ind++){ ! obInheritType=PyTuple_GET_ITEM(InheritTypes_tuple, tuple_ind); tpInheritType=PySequence_Tuple(obInheritType); if ((tpInheritType==NULL) *************** *** 359,363 **** *ppInheritTypes=InheritTypes; *pcInheritTypes=cInheritTypes; ! Py_XDECREF(fsInheritTypes); Py_XDECREF(result); return hr; --- 357,361 ---- *ppInheritTypes=InheritTypes; *pcInheritTypes=cInheritTypes; ! Py_XDECREF(InheritTypes_tuple); Py_XDECREF(result); return hr; |
From: Roger U. <ru...@us...> - 2007-08-13 02:11:41
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12262/win32/src Modified Files: timermodule.cpp Log Message: Fix 64-bit issues Add autoduck and docstrings Whitespace consistency Index: timermodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/timermodule.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** timermodule.cpp 12 Jul 2006 12:29:17 -0000 1.4 --- timermodule.cpp 13 Aug 2007 02:11:41 -0000 1.5 *************** *** 7,10 **** --- 7,12 ---- // + // @doc - Contains autoduck comments for documentation + #include "windows.h" #include "Python.h" *************** *** 12,127 **** //#include "abstract.h" - static PyObject *timer_module_error; static PyObject *timer_id_callback_map = NULL; VOID CALLBACK ! py_win32_timer_callback (HWND hwnd, UINT msg, UINT event, DWORD time) { - // do we have a valid callback dictionary? - - if (timer_id_callback_map) { CEnterLeavePython _celp; ! PyObject * py_event = Py_BuildValue ("i", (int) event); ! ! // is this timer id recognized? ! PyObject * callback_function = \ ! PyDict_GetItem (timer_id_callback_map, py_event); ! // call the user's function ! if (callback_function) { ! // create a 'death grip' on the callback function, just incase ! // the callback itself removes the function from the map. ! Py_INCREF(callback_function); ! PyObject * callback_args = Py_BuildValue ("(il)", (int) event, (long) time); ! PyObject * result = \ ! PyEval_CallObject (callback_function, callback_args); ! if (!result) { // Is this necessary, or will python already have flagged // an exception? Can we even catch exceptions here? PyErr_Print(); ! } ! // everything's ok, return ! Py_DECREF(callback_function); ! Py_XDECREF(callback_args); ! Py_XDECREF(result); ! Py_DECREF (py_event); ! return; ! } ! // invalid key or callback: kill the timer (note there is no ! // key to remove - we have already determined it is not there!) ! Py_DECREF (py_event); ! ::KillTimer (NULL, event); return; - } else { - // the id/callback map is NULL - ::KillTimer (NULL, event); - } } static PyObject * py_timer_set_timer (PyObject * self, PyObject * args) { ! PyObject *callback; ! PyObject * py_timer_id; ! int elapse; ! UINT timer_id; ! ! if (!PyArg_ParseTuple (args, "iO", &elapse, &callback)) { ! return NULL; ! } ! ! // make sure the callback is a valid callable object ! if (!PyCallable_Check (callback)) { ! PyErr_SetString (timer_module_error, "argument must be a callable object"); ! return NULL; ! } ! // create the win32 timer ! Py_BEGIN_ALLOW_THREADS; ! timer_id = ::SetTimer (NULL, 0, (UINT) elapse, (TIMERPROC) py_win32_timer_callback); ! Py_END_ALLOW_THREADS; ! if (!timer_id) { ! PyErr_SetString (timer_module_error, "win32 SetTimer() failed"); ! return NULL; ! } ! py_timer_id = PyInt_FromLong((long) timer_id); ! if (!py_timer_id) ! return NULL; ! // associate the timer id with the given callback function ! if (PyObject_SetItem (timer_id_callback_map, py_timer_id, callback) == -1) { ! ::KillTimer (NULL, timer_id); ! Py_DECREF(py_timer_id); ! PyErr_SetString (timer_module_error, ! "internal error, couldn't set timer id callback item"); ! return NULL; ! } ! // everything went ok. ! return py_timer_id; } static PyObject * py_timer_kill_timer (PyObject * self, PyObject * args) { ! PyObject * py_timer_id; ! if (!PyArg_ParseTuple (args, "O", &py_timer_id)) { ! return NULL; ! } else if (timer_id_callback_map) { ! if (0 != PyDict_DelItem (timer_id_callback_map, py_timer_id)) { ! return NULL; ! } ! } ! int rc; ! Py_BEGIN_ALLOW_THREADS; ! rc = ::KillTimer (NULL, (int) PyInt_AsLong (py_timer_id)); ! Py_END_ALLOW_THREADS; ! return Py_BuildValue ("i", rc); } --- 14,124 ---- //#include "abstract.h" static PyObject *timer_id_callback_map = NULL; VOID CALLBACK ! py_win32_timer_callback (HWND hwnd, UINT msg, UINT_PTR timer_id, DWORD time) { CEnterLeavePython _celp; ! PyObject * py_timer_id = PyWinLong_FromVoidPtr((void *)timer_id); ! if (!py_timer_id){ ! PyErr_Print(); ! return; ! } ! // is this timer id recognized? ! PyObject * callback_function = PyDict_GetItem (timer_id_callback_map, py_timer_id); ! if (!callback_function){ ! ::KillTimer (NULL, timer_id); ! PyErr_Warn(PyExc_RuntimeWarning, "Unrecognized timer id"); ! Py_DECREF(py_timer_id); ! return; ! } // call the user's function ! // create a 'death grip' on the callback function, just incase ! // the callback itself removes the function from the map. ! Py_INCREF(callback_function); ! PyObject * callback_args = Py_BuildValue ("(Ok)", py_timer_id, time); ! PyObject * result = PyEval_CallObject (callback_function, callback_args); ! if (!result) { // Is this necessary, or will python already have flagged // an exception? Can we even catch exceptions here? PyErr_Print(); ! } ! // everything's ok, return ! Py_DECREF(callback_function); ! Py_XDECREF(callback_args); ! Py_XDECREF(result); ! Py_DECREF (py_timer_id); return; } + // @pymethod int|timer|set_timer|Creates a timer that executes a callback function + // @rdesc Returns the id of the timer, which can be passed to kill_timer to stop it. + // @comm Uses the SetTimer function. static PyObject * py_timer_set_timer (PyObject * self, PyObject * args) { ! PyObject *callback; ! PyObject * py_timer_id; ! UINT elapse; ! UINT_PTR timer_id; ! if (!PyArg_ParseTuple (args, "kO:set_timer", ! &elapse, // @pyparm int|Elapse||Timer period, in milliseconds ! &callback)) // @pyparm function|TimerFunc||Callback function. Will be called with with 2 int args: (timer_id, time) ! return NULL; ! // make sure the callback is a valid callable object ! if (!PyCallable_Check (callback)) { ! PyErr_SetString (PyExc_TypeError, "argument must be a callable object"); ! return NULL; ! } ! // create the win32 timer ! Py_BEGIN_ALLOW_THREADS; ! timer_id = ::SetTimer (NULL, 0, elapse, py_win32_timer_callback); ! Py_END_ALLOW_THREADS; ! if (!timer_id) ! return PyWin_SetAPIError("SetTimer"); ! py_timer_id = PyWinLong_FromVoidPtr((void *)timer_id); ! if (!py_timer_id){ ! ::KillTimer (NULL, timer_id); ! return NULL; ! } ! // associate the timer id with the given callback function ! if (PyDict_SetItem (timer_id_callback_map, py_timer_id, callback) == -1) { ! ::KillTimer (NULL, timer_id); ! Py_DECREF(py_timer_id); ! return NULL; ! } ! // everything went ok. ! return py_timer_id; } + // @pymethod boolean|timer|kill_timer|Creates a timer that executes a callback function + // @comm Uses the KillTimer API function. static PyObject * py_timer_kill_timer (PyObject * self, PyObject * args) { ! PyObject * py_timer_id; ! UINT_PTR timer_id; ! if (!PyArg_ParseTuple (args, "O:kill_timer", ! &py_timer_id)) // @pyparm int|IDEvent||Timer id as returned by <om timer.set_timer> ! return NULL; ! if (!PyWinLong_AsVoidPtr(py_timer_id, (void **)&timer_id)) ! return NULL; ! if (timer_id_callback_map) ! if (0 != PyDict_DelItem (timer_id_callback_map, py_timer_id)) ! return NULL; ! BOOL rc; ! Py_BEGIN_ALLOW_THREADS; ! rc = ::KillTimer (NULL, timer_id); ! Py_END_ALLOW_THREADS; ! return PyBool_FromLong(rc); } *************** *** 130,149 **** py_timer_timer_map (PyObject * self, PyObject * args) { ! if (!PyArg_ParseTuple (args, "")) { ! return NULL; ! } ! Py_INCREF (timer_id_callback_map); ! return (timer_id_callback_map); } #endif // List of functions exported by this module static struct PyMethodDef timer_functions[] = { ! {"set_timer", py_timer_set_timer, 1}, ! {"kill_timer", py_timer_kill_timer, 1}, #ifdef _DEBUG ! {"_id_timer_map", py_timer_timer_map, 1}, #endif ! {NULL, NULL} }; --- 127,149 ---- py_timer_timer_map (PyObject * self, PyObject * args) { ! if (!PyArg_ParseTuple (args, "")) ! return NULL; ! ! Py_INCREF (timer_id_callback_map); ! return (timer_id_callback_map); } #endif // List of functions exported by this module + // @module timer|Extension that wraps Win32 Timer functions static struct PyMethodDef timer_functions[] = { ! // @pymeth set_timer|Creates a timer that executes a callback function ! {"set_timer", py_timer_set_timer, METH_VARARGS, "int = set_timer(milliseconds, callback}\nCreates a timer that executes a callback function"}, ! // @pymeth kill_timer|Stops a timer ! {"kill_timer", py_timer_kill_timer, METH_VARARGS, "boolean = kill_timer(timer_id)\nStops a timer"}, #ifdef _DEBUG ! {"_id_timer_map", py_timer_timer_map, 1}, #endif ! {NULL, NULL} }; *************** *** 151,163 **** inittimer(void) { ! PyObject *dict, *module; ! module = Py_InitModule("timer", timer_functions); ! if (!module) /* Eeek - some serious error! */ ! return; ! dict = PyModule_GetDict(module); ! if (!dict) return; /* Another serious error!*/ ! timer_module_error = PyString_FromString("timer error"); ! PyDict_SetItemString(dict, "error", timer_module_error); ! PyDict_SetItemString(dict, "__version__", PyString_FromString("0.2")); ! timer_id_callback_map = PyDict_New(); } --- 151,167 ---- inittimer(void) { ! PyWinGlobals_Ensure(); ! timer_id_callback_map = PyDict_New(); ! if (!timer_id_callback_map) ! return; ! PyObject *dict, *module; ! module = Py_InitModule("timer", timer_functions); ! if (!module) /* Eeek - some serious error! */ ! return; ! dict = PyModule_GetDict(module); ! if (!dict) ! return; /* Another serious error!*/ ! Py_INCREF(PyWinExc_ApiError); ! PyDict_SetItemString(dict, "error", PyWinExc_ApiError); ! PyDict_SetItemString(dict, "__version__", PyString_FromString("0.2")); } |
From: Roger U. <ru...@us...> - 2007-08-12 08:31:39
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27135/win32/src Modified Files: win32consolemodule.cpp win32credmodule.cpp Log Message: Fix more 64-bit warnings Index: win32consolemodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32consolemodule.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** win32consolemodule.cpp 3 Jun 2007 14:53:07 -0000 1.11 --- win32consolemodule.cpp 12 Aug 2007 08:31:41 -0000 1.12 *************** *** 62,68 **** return FALSE; } ! if ((ushorts_tuple=PySequence_Tuple(obushorts))==NULL) return FALSE; // last exit without cleaning up - *item_cnt=PyTuple_Size(ushorts_tuple); bufsize=*item_cnt * sizeof(USHORT); *pushorts=(USHORT *)malloc(bufsize); --- 62,67 ---- return FALSE; } ! if ((ushorts_tuple=PyWinSequence_Tuple(obushorts, item_cnt))==NULL) return FALSE; // last exit without cleaning up bufsize=*item_cnt * sizeof(USHORT); *pushorts=(USHORT *)malloc(bufsize); *************** *** 1407,1414 **** &obbuf)) // @pyparm (<o PyINPUT_RECORD>,...)|Buffer||A sequence of <o PyINPUT_RECORD> objects return NULL; ! obtuple=PySequence_Tuple(obbuf); if (obtuple==NULL) return NULL; - nbrofrecords=PyTuple_GET_SIZE(obtuple); pinput_records=(INPUT_RECORD *)malloc(nbrofrecords *sizeof(INPUT_RECORD)); if (pinput_records==NULL){ --- 1406,1412 ---- &obbuf)) // @pyparm (<o PyINPUT_RECORD>,...)|Buffer||A sequence of <o PyINPUT_RECORD> objects return NULL; ! obtuple=PyWinSequence_Tuple(obbuf, &nbrofrecords); if (obtuple==NULL) return NULL; pinput_records=(INPUT_RECORD *)malloc(nbrofrecords *sizeof(INPUT_RECORD)); if (pinput_records==NULL){ Index: win32credmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32credmodule.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** win32credmodule.cpp 3 Jun 2007 14:53:07 -0000 1.7 --- win32credmodule.cpp 12 Aug 2007 08:31:41 -0000 1.8 *************** *** 45,50 **** static char *keywords[]={"Keyword","Flags","Value", NULL}; PyObject *obKeyword, *obValue, *args; ! const void *value; ! Py_ssize_t valuelen; BOOL ret; ZeroMemory(attr, sizeof(CREDENTIAL_ATTRIBUTE)); --- 45,50 ---- static char *keywords[]={"Keyword","Flags","Value", NULL}; PyObject *obKeyword, *obValue, *args; ! void *value; ! DWORD valuelen; BOOL ret; ZeroMemory(attr, sizeof(CREDENTIAL_ATTRIBUTE)); *************** *** 60,64 **** &obKeyword, &attr->Flags, &obValue) &&PyWinObject_AsWCHAR(obKeyword, &attr->Keyword, FALSE) ! &&(PyObject_AsReadBuffer(obValue, &value, &valuelen)==0) &&((attr->Value=(LPBYTE)malloc(valuelen))!=NULL); if (ret){ --- 60,64 ---- &obKeyword, &attr->Flags, &obValue) &&PyWinObject_AsWCHAR(obKeyword, &attr->Keyword, FALSE) ! &&PyWinObject_AsReadBuffer(obValue, &value, &valuelen) &&((attr->Value=(LPBYTE)malloc(valuelen))!=NULL); if (ret){ *************** *** 92,99 **** if (obattrs==Py_None) return TRUE; ! attr_tuple=PySequence_Tuple(obattrs); if (attr_tuple==NULL) return FALSE; - *attr_cnt=PyTuple_GET_SIZE(attr_tuple); if (*attr_cnt>0){ *attrs=(PCREDENTIAL_ATTRIBUTE)malloc(*attr_cnt * sizeof(CREDENTIAL_ATTRIBUTE)); --- 92,98 ---- if (obattrs==Py_None) return TRUE; ! attr_tuple=PyWinSequence_Tuple(obattrs, attr_cnt); if (attr_tuple==NULL) return FALSE; if (*attr_cnt>0){ *attrs=(PCREDENTIAL_ATTRIBUTE)malloc(*attr_cnt * sizeof(CREDENTIAL_ATTRIBUTE)); |
From: Roger U. <ru...@us...> - 2007-08-12 08:26:26
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/adsi/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25252/com/win32comext/adsi/src Modified Files: PyIDsObjectPicker.i Log Message: Move PyWinObject_AsWCHARArray into pywintypes Index: PyIDsObjectPicker.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/adsi/src/PyIDsObjectPicker.i,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyIDsObjectPicker.i 3 May 2007 08:28:39 -0000 1.2 --- PyIDsObjectPicker.i 12 Aug 2007 08:26:27 -0000 1.3 *************** *** 13,62 **** extern BOOL PyObject_AsDSOP_SCOPE_INIT_INFOs(PyObject *ob, DSOP_SCOPE_INIT_INFO**p, ULONG *n); - static void PyWinObject_FreeWCHARArray(LPWSTR *wchars, DWORD str_cnt) - { - if (wchars!=NULL){ - for (DWORD wchar_index=0; wchar_index<str_cnt; wchar_index++) - PyWinObject_FreeWCHAR(wchars[wchar_index]); - free(wchars); - } - } - - static BOOL PyWinObject_AsWCHARArray(PyObject *str_seq, LPWSTR **wchars, DWORD *str_cnt, BOOL bNoneOK = FALSE) - { - if (bNoneOK && str_seq==Py_None) { - *wchars = NULL; - *str_cnt = 0; - return TRUE; - } - BOOL ret=FALSE; - PyObject *str_tuple=NULL, *tuple_item; - DWORD bufsize, tuple_index; - *wchars=NULL; - *str_cnt=0; - if ((str_tuple=PySequence_Tuple(str_seq))==NULL) - return FALSE; - *str_cnt=PyTuple_Size(str_tuple); - bufsize=*str_cnt * sizeof(LPWSTR); - *wchars=(LPWSTR *)malloc(bufsize); - if (*wchars==NULL){ - PyErr_Format(PyExc_MemoryError, "Unable to allocate %d bytes", bufsize); - goto done; - } - ZeroMemory(*wchars, bufsize); - for (tuple_index=0;tuple_index<*str_cnt;tuple_index++){ - tuple_item=PyTuple_GET_ITEM(str_tuple, tuple_index); - if (!PyWinObject_AsWCHAR(tuple_item, &((*wchars)[tuple_index]), FALSE)){ - PyWinObject_FreeWCHARArray(*wchars, *str_cnt); - *wchars=NULL; - *str_cnt=0; - goto done; - } - } - ret=TRUE; - done: - Py_XDECREF(str_tuple); - return ret; - } - #define SWIG_THIS_IID IID_IDsObjectPicker --- 13,16 ---- |
From: Roger U. <ru...@us...> - 2007-08-12 08:16:32
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21379/win32/src Modified Files: win32security.i win32security_ds.cpp win32security_sspi.cpp win32service.i Log Message: Fix 64-bit issues, and consolidate conversion functions into pywintypes Index: win32security_ds.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32security_ds.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** win32security_ds.cpp 3 Jun 2007 14:53:07 -0000 1.5 --- win32security_ds.cpp 12 Aug 2007 08:16:29 -0000 1.6 *************** *** 99,142 **** } - void PyWinObject_FreeWCHARArray(LPWSTR *wchars, DWORD str_cnt) - { - if (wchars!=NULL){ - for (DWORD wchar_index=0; wchar_index<str_cnt; wchar_index++) - PyWinObject_FreeWCHAR(wchars[wchar_index]); - free(wchars); - } - } - - BOOL PyWinObject_AsWCHARArray(PyObject *str_seq, LPWSTR **wchars, DWORD *str_cnt) - { - BOOL ret=FALSE; - PyObject *str_tuple=NULL, *tuple_item; - DWORD bufsize, tuple_index; - *wchars=NULL; - *str_cnt=0; - if ((str_tuple=PySequence_Tuple(str_seq))==NULL) - return FALSE; - *str_cnt=PyTuple_Size(str_tuple); - bufsize=*str_cnt * sizeof(LPWSTR); - *wchars=(LPWSTR *)malloc(bufsize); - if (*wchars==NULL){ - PyErr_Format(PyExc_MemoryError, "Unable to allocate %d bytes", bufsize); - goto done; - } - ZeroMemory(*wchars, bufsize); - for (tuple_index=0;tuple_index<*str_cnt;tuple_index++){ - tuple_item=PyTuple_GET_ITEM(str_tuple, tuple_index); - if (!PyWinObject_AsWCHAR(tuple_item, &((*wchars)[tuple_index]), FALSE)){ - PyWinObject_FreeWCHARArray(*wchars, *str_cnt); - *wchars=NULL; - *str_cnt=0; - goto done; - } - } - ret=TRUE; - done: - Py_XDECREF(str_tuple); - return ret; - } extern PyObject *PyDsGetSpn(PyObject *self, PyObject *args) --- 99,102 ---- Index: win32security_sspi.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32security_sspi.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** win32security_sspi.cpp 30 May 2007 06:51:48 -0000 1.8 --- win32security_sspi.cpp 12 Aug 2007 08:16:29 -0000 1.9 *************** *** 423,436 **** { PySecBuffer *This=(PySecBuffer *)self; ! char *name, *value; ! Py_ssize_t valuelen; name=PyString_AsString(obname); if (name==NULL) return -1; if (strcmp(name,"Buffer")==0){ ! if (PyString_AsStringAndSize(obvalue, &value, &valuelen)==-1) return -1; PSecBuffer psecbuffer=This->GetSecBuffer(); ! if (valuelen>(Py_ssize_t)This->maxbufsize){ PyErr_Format(PyExc_ValueError, "Data size (%d) greater than allocated buffer size (%d)",valuelen, This->maxbufsize); return -1; --- 423,437 ---- { PySecBuffer *This=(PySecBuffer *)self; ! char *name; ! void *value; ! DWORD valuelen; name=PyString_AsString(obname); if (name==NULL) return -1; if (strcmp(name,"Buffer")==0){ ! if (!PyWinObject_AsReadBuffer(obvalue, &value, &valuelen)) return -1; PSecBuffer psecbuffer=This->GetSecBuffer(); ! if (valuelen > This->maxbufsize){ PyErr_Format(PyExc_ValueError, "Data size (%d) greater than allocated buffer size (%d)",valuelen, This->maxbufsize); return -1; Index: win32service.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32service.i,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** win32service.i 3 Jun 2007 14:53:07 -0000 1.14 --- win32service.i 12 Aug 2007 08:16:29 -0000 1.15 *************** *** 711,767 **** %{ - BOOL BuildDeps(PyObject *obDeps, TCHAR **ppDeps) - { - TCHAR *lpDeps = NULL; - BOOL rc = FALSE; - if (obDeps!=Py_None) { - if (!PySequence_Check(obDeps)) { - PyErr_SetString(PyExc_ValueError, "Dependencies must be None or a list of strings"); - goto cleanup; - } - int numStrings = PySequence_Length(obDeps); - // Need to loop twice - once to get the buffer length - int i, len = 0; - for (i=0;i<numStrings;i++) { - PyObject *obString = PySequence_GetItem(obDeps, i); - if (obString==NULL) - goto cleanup; - if (!PyString_Check(obString)) { - Py_DECREF(obString); - PyErr_SetString(PyExc_ValueError, "The list items for Dependencies must all be strings"); - goto cleanup; - } - len += PyString_Size(obString) + 1; - Py_DECREF(obString); - } - // Allocate the buffer - lpDeps = new TCHAR[len+2]; // Double '\0' terminated - TCHAR *p = lpDeps; - for (i=0;i<numStrings;i++) { - // We know the sequence is valid. - PyObject *obString = PySequence_GetItem(obDeps, i); - BSTR pStr; - if (!PyWinObject_AsTCHAR(obString, &pStr)) { - Py_DECREF(obString); - goto cleanup; - } - size_t len = _tcslen(pStr); - _tcsncpy(p, pStr, len); - p += len; - *p++ = L'\0'; - PyWinObject_FreeTCHAR(pStr); - Py_DECREF(obString); - } - *p = L'\0'; // Add second terminator. - } - *ppDeps = lpDeps; - rc = TRUE; - cleanup: - if (!rc) { - delete [] lpDeps; - } - return rc; - } - PyObject *MyCreateService( SC_HANDLE hSCManager, // handle to service control manager database --- 711,714 ---- *************** *** 785,789 **** DWORD *pTagID = bFetchTag ? &tagID : NULL; SC_HANDLE sh = 0; ! if (!BuildDeps(obDeps, &lpDeps)) goto cleanup; --- 732,736 ---- DWORD *pTagID = bFetchTag ? &tagID : NULL; SC_HANDLE sh = 0; ! if (!PyWinObject_AsMultipleString(obDeps, &lpDeps, TRUE)) goto cleanup; *************** *** 796,805 **** } else { if (bFetchTag) ! rc = Py_BuildValue("Nl", PyWinLong_FromHANDLE(sh), tagID); else ! rc = PyWinLong_FromHANDLE(sh); } cleanup: ! delete [] lpDeps; return rc; --- 743,752 ---- } else { if (bFetchTag) ! rc = Py_BuildValue("Nl", PyWinObject_FromSC_HANDLE(sh), tagID); else ! rc = PyWinObject_FromSC_HANDLE(sh); } cleanup: ! PyWinObject_FreeMultipleString(lpDeps); return rc; *************** *** 825,829 **** DWORD *pTagID = bFetchTag ? &tagID : NULL; SC_HANDLE sh = 0; ! if (!BuildDeps(obDeps, &lpDeps)) goto cleanup; --- 772,776 ---- DWORD *pTagID = bFetchTag ? &tagID : NULL; SC_HANDLE sh = 0; ! if (!PyWinObject_AsMultipleString(obDeps, &lpDeps, TRUE)) goto cleanup; *************** *** 840,844 **** } cleanup: ! delete [] lpDeps; return rc; --- 787,791 ---- } cleanup: ! PyWinObject_FreeMultipleString(lpDeps); return rc; *************** *** 847,884 **** PyObject *MyStartService( SC_HANDLE scHandle, PyObject *serviceArgs ) { ! LPTSTR *pArgs; DWORD numStrings = 0; ! if (serviceArgs==Py_None) ! pArgs = NULL; ! else if (!PySequence_Check(serviceArgs)) { ! PyErr_SetString(PyExc_ValueError, "Service arguments must be list of strings."); return NULL; ! } else { ! numStrings = PySequence_Length(serviceArgs); ! pArgs = new LPTSTR [numStrings]; ! if (pArgs==NULL) { ! PyErr_SetString(PyExc_MemoryError, "Allocating argument arrays"); ! return NULL; ! } ! for (DWORD i=0;i<numStrings;i++) { ! PyObject *obString = PySequence_GetItem(serviceArgs, (int)i); ! if (obString==NULL) { ! delete [] pArgs; ! return NULL; ! } ! pArgs[i] = NULL; ! PyWinObject_AsTCHAR(obString, pArgs+i); ! Py_DECREF(obString); ! } ! } PyObject *rc; ! if (StartService(scHandle, numStrings, (LPCTSTR *)pArgs)) { rc = Py_None; Py_INCREF(Py_None); } else rc = PyWin_SetAPIError("StartService"); ! for (DWORD i=0;i<numStrings;i++) ! PyWinObject_FreeTCHAR(pArgs[i]); ! delete [] pArgs; return rc; } --- 794,809 ---- PyObject *MyStartService( SC_HANDLE scHandle, PyObject *serviceArgs ) { ! LPWSTR *pArgs; DWORD numStrings = 0; ! if (!PyWinObject_AsWCHARArray(serviceArgs, &pArgs, &numStrings, TRUE)) return NULL; ! PyObject *rc; ! if (StartService(scHandle, numStrings, (LPCWSTR *)pArgs)) { rc = Py_None; Py_INCREF(Py_None); } else rc = PyWin_SetAPIError("StartService"); ! PyWinObject_FreeWCHARArray(pArgs, numStrings); return rc; } *************** *** 1488,1506 **** BOOL PyWinObject_AsSC_ACTIONS(PyObject *obActions, SC_ACTION **ppActions, LPDWORD cActions) { ! static char* err="SC_ACTIONS must be a tuple of 2-tuples ((int, int),...)"; DWORD action_ind; BOOL ret=TRUE; SC_ACTION *pAction; if (obActions==Py_None){ *ppActions=NULL; return TRUE; } ! if (!PyTuple_Check(obActions)){ ! PyErr_SetString(PyExc_TypeError,err); return FALSE; ! } ! *cActions=PyTuple_Size(obActions); *ppActions=(SC_ACTION *)malloc(*cActions*sizeof(SC_ACTION)); if (*ppActions==NULL){ PyErr_Format(PyExc_MemoryError,"Unable to allocate %d SC_ACTION structures", *cActions); return FALSE; --- 1413,1432 ---- BOOL PyWinObject_AsSC_ACTIONS(PyObject *obActions, SC_ACTION **ppActions, LPDWORD cActions) { ! static char* err="SC_ACTIONS must be a sequence of 2-tuples ((int, int),...)"; DWORD action_ind; BOOL ret=TRUE; SC_ACTION *pAction; if (obActions==Py_None){ + *cActions=0; *ppActions=NULL; return TRUE; } ! PyObject *actions_tuple=PyWinSequence_Tuple(obActions, cActions); ! if (actions_tuple==NULL) return FALSE; ! *ppActions=(SC_ACTION *)malloc(*cActions*sizeof(SC_ACTION)); if (*ppActions==NULL){ + Py_DECREF(actions_tuple); PyErr_Format(PyExc_MemoryError,"Unable to allocate %d SC_ACTION structures", *cActions); return FALSE; *************** *** 1508,1512 **** pAction=*ppActions; for (action_ind=0;action_ind<*cActions;action_ind++){ ! ret=PyWinObject_AsSC_ACTION(PyTuple_GET_ITEM(obActions, action_ind), pAction); if (!ret){ free(*ppActions); --- 1434,1438 ---- pAction=*ppActions; for (action_ind=0;action_ind<*cActions;action_ind++){ ! ret=PyWinObject_AsSC_ACTION(PyTuple_GET_ITEM(actions_tuple, action_ind), pAction); if (!ret){ free(*ppActions); *************** *** 1517,1520 **** --- 1443,1447 ---- pAction++; } + Py_DECREF(actions_tuple); return ret; } Index: win32security.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32security.i,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** win32security.i 8 Aug 2007 08:43:50 -0000 1.44 --- win32security.i 12 Aug 2007 08:16:29 -0000 1.45 *************** *** 331,349 **** } - // Converts sequence into a tuple and verifies that length fits in length variable - PyObject *PyWinSequence_Tuple(PyObject *obseq, DWORD *len) - { - PyObject *obtuple=PySequence_Tuple(obseq); - if (obtuple==NULL) - return NULL; - Py_ssize_t py_len=PyTuple_GET_SIZE(obtuple); - if (py_len > MAXDWORD){ - Py_DECREF(obtuple); - return PyErr_Format(PyExc_ValueError, "Sequence can contain at most %d items", MAXDWORD); - } - *len=(DWORD)py_len; - return obtuple; - } - BOOL PyWinObject_AsSID_AND_ATTRIBUTESArray(PyObject *obsids, PSID_AND_ATTRIBUTES *psid_attr_array, DWORD *sid_cnt) { --- 331,334 ---- |
From: Roger U. <ru...@us...> - 2007-08-12 08:10:30
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19185/win32/src Modified Files: PyUnicode.cpp PyWinTypes.h PyWinTypesmodule.cpp Log Message: Move some conversion functions into pywintypes Index: PyWinTypesmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypesmodule.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** PyWinTypesmodule.cpp 23 Jul 2007 05:16:05 -0000 1.32 --- PyWinTypesmodule.cpp 12 Aug 2007 08:10:28 -0000 1.33 *************** *** 488,494 **** return FALSE; } ! if ((dwords_tuple=PySequence_Tuple(obdwords))==NULL) return FALSE; // last exit without cleaning up - *item_cnt=PyTuple_Size(dwords_tuple); bufsize=*item_cnt * sizeof(DWORD); *pdwords=(DWORD *)malloc(bufsize); --- 488,493 ---- return FALSE; } ! if ((dwords_tuple=PyWinSequence_Tuple(obdwords, item_cnt))==NULL) return FALSE; // last exit without cleaning up bufsize=*item_cnt * sizeof(DWORD); *pdwords=(DWORD *)malloc(bufsize); *************** *** 729,732 **** --- 728,746 ---- } + // Converts sequence into a tuple and verifies that length fits in length variable + PyObject *PyWinSequence_Tuple(PyObject *obseq, DWORD *len) + { + PyObject *obtuple=PySequence_Tuple(obseq); + if (obtuple==NULL) + return NULL; + Py_ssize_t py_len=PyTuple_GET_SIZE(obtuple); + if (py_len > MAXDWORD){ + Py_DECREF(obtuple); + return PyErr_Format(PyExc_ValueError, "Sequence can contain at most %d items", MAXDWORD); + } + *len=(DWORD)py_len; + return obtuple; + } + /* List of functions exported by this module */ Index: PyWinTypes.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypes.h,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** PyWinTypes.h 2 Aug 2007 04:31:40 -0000 1.47 --- PyWinTypes.h 12 Aug 2007 08:10:28 -0000 1.48 *************** *** 192,195 **** --- 192,199 ---- PYWINTYPES_EXPORT BOOL PyWinObject_AsWriteBuffer(PyObject *ob, void **buf, DWORD *buf_len, BOOL bNoneOk=FALSE); + // For 64-bit python compatibility, convert sequence to tuple and check length fits in a DWORD + PYWINTYPES_EXPORT PyObject *PyWinSequence_Tuple(PyObject *obseq, DWORD *len); + + // an 'int' version (but aren't 'int' and 'DWORD' the same size? // Maybe a signed-ness issue? *************** *** 222,225 **** --- 226,237 ---- PYWINTYPES_EXPORT PyObject *PyWinObject_FromMultipleString(WCHAR *multistring); PYWINTYPES_EXPORT PyObject *PyWinObject_FromMultipleString(char *multistring); + // Converts a sequence of str/unicode objects into a series of consecutive null-terminated + // wide character strings with extra terminating null + PYWINTYPES_EXPORT BOOL PyWinObject_AsMultipleString(PyObject *ob, WCHAR **pmultistring, BOOL bNoneOK=TRUE); + PYWINTYPES_EXPORT void PyWinObject_FreeMultipleString(WCHAR *pmultistring); + + // Convert a sequence of strings to an array of WCHAR pointers + PYWINTYPES_EXPORT void PyWinObject_FreeWCHARArray(LPWSTR *wchars, DWORD str_cnt); + PYWINTYPES_EXPORT BOOL PyWinObject_AsWCHARArray(PyObject *str_seq, LPWSTR **wchars, DWORD *str_cnt, BOOL bNoneOK = FALSE); PYWINTYPES_EXPORT PyObject *PyString_FromUnicode( const OLECHAR *str ); Index: PyUnicode.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyUnicode.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** PyUnicode.cpp 20 May 2007 10:46:46 -0000 1.24 --- PyUnicode.cpp 12 Aug 2007 08:10:28 -0000 1.25 *************** *** 1089,1090 **** --- 1089,1178 ---- return ret; } + + // Converts a sequence of str/unicode objects into a series of consecutive null-terminated + // wide character strings with extra terminating null + BOOL PyWinObject_AsMultipleString(PyObject *ob, WCHAR **pmultistring, BOOL bNoneOK) + { + DWORD numStrings, i; + WCHAR **wchars; + BOOL rc=FALSE; + + *pmultistring=NULL; + if (!PyWinObject_AsWCHARArray(ob, &wchars, &numStrings, bNoneOK)) + return FALSE; + // Shortcut for None + if (wchars==NULL) + return TRUE; + + size_t len=numStrings+1; // One null for each string plus extra terminating null + // Need to loop twice - once to get the buffer length + for (i=0;i<numStrings;i++) + len += wcslen(wchars[i]); + + // Allocate the buffer + *pmultistring = (WCHAR *)malloc(len * sizeof(WCHAR)); + if (*pmultistring == NULL) + PyErr_NoMemory(); + else{ + WCHAR *p = *pmultistring; + for (i=0;i<numStrings;i++) { + wcscpy(p, wchars[i]); + p += wcslen(wchars[i]); + *p++ = L'\0'; + } + *p = L'\0'; // Add second terminator. + rc = TRUE; + } + PyWinObject_FreeWCHARArray(wchars, numStrings); + return rc; + } + + void PyWinObject_FreeMultipleString(WCHAR *pmultistring) + { + if (pmultistring) + free (pmultistring); + } + + // Converts a aequence of string or unicode objects into an array of WCHAR + void PyWinObject_FreeWCHARArray(LPWSTR *wchars, DWORD str_cnt) + { + if (wchars!=NULL){ + for (DWORD wchar_index=0; wchar_index<str_cnt; wchar_index++) + PyWinObject_FreeWCHAR(wchars[wchar_index]); + free(wchars); + } + } + + BOOL PyWinObject_AsWCHARArray(PyObject *str_seq, LPWSTR **wchars, DWORD *str_cnt, BOOL bNoneOK) + { + BOOL ret=FALSE; + PyObject *str_tuple=NULL, *tuple_item; + DWORD bufsize, tuple_index; + *wchars=NULL; + *str_cnt=0; + + if (bNoneOK && str_seq==Py_None) + return TRUE; + if ((str_tuple=PyWinSequence_Tuple(str_seq, str_cnt))==NULL) + return FALSE; + bufsize=*str_cnt * sizeof(LPWSTR); + *wchars=(LPWSTR *)malloc(bufsize); + if (*wchars==NULL){ + PyErr_Format(PyExc_MemoryError, "Unable to allocate %d bytes", bufsize); + goto done; + } + ZeroMemory(*wchars, bufsize); + for (tuple_index=0;tuple_index<*str_cnt;tuple_index++){ + tuple_item=PyTuple_GET_ITEM(str_tuple, tuple_index); + if (!PyWinObject_AsWCHAR(tuple_item, &((*wchars)[tuple_index]), FALSE)){ + PyWinObject_FreeWCHARArray(*wchars, *str_cnt); + *wchars=NULL; + *str_cnt=0; + goto done; + } + } + ret=TRUE; + done: + Py_DECREF(str_tuple); + return ret; + } |
From: Roger U. <ru...@us...> - 2007-08-08 08:43:58
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25183/win32/src Modified Files: win32security.i Log Message: Fix some 64-bit issues, and convert a few functions to keyword args Index: win32security.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32security.i,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** win32security.i 2 Aug 2007 04:35:14 -0000 1.43 --- win32security.i 8 Aug 2007 08:43:50 -0000 1.44 *************** *** 331,368 **** } BOOL PyWinObject_AsSID_AND_ATTRIBUTESArray(PyObject *obsids, PSID_AND_ATTRIBUTES *psid_attr_array, DWORD *sid_cnt) { ! PyObject *obsid_attr; *psid_attr_array=NULL; *sid_cnt=0; - static char *fmt_msg="Object must be a sequence of PySID_AND_ATTRIBUTES tuples, or None"; if (obsids==Py_None) [...999 lines suppressed...] *************** *** 3216,3219 **** --- 3231,3235 ---- return ret; } + PyCFunction pfn_PyCreateRestrictedToken = (PyCFunction)PyCreateRestrictedToken; %} *************** *** 3931,3939 **** #define UNPROTECTED_SACL_SECURITY_INFORMATION UNPROTECTED_SACL_SECURITY_INFORMATION - /** if (_WIN32_WINNT >= 0x0500) - #define SE_DS_OBJECT SE_DS_OBJECT - #define SE_DS_OBJECT_ALL SE_DS_OBJECT_ALL - #define SE_PROVIDER_DEFINED_OBJECT SE_PROVIDER_DEFINED_OBJECT - **/ #define SidTypeUser SidTypeUser // Indicates a user SID. --- 3947,3950 ---- |
From: Roger U. <ru...@us...> - 2007-08-07 17:43:09
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src/extensions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25815/com/win32com/src/extensions Modified Files: PyIStream.cpp Log Message: Return length written from PyIStream::Write Index: PyIStream.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/extensions/PyIStream.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PyIStream.cpp 30 May 2007 07:59:49 -0000 1.3 --- PyIStream.cpp 7 Aug 2007 17:43:09 -0000 1.4 *************** *** 59,62 **** --- 59,63 ---- PyObject *obstrValue; DWORD strSize; + ULONG cbWritten; // @pyparm string|data||The binary data to write. if (!PyArg_ParseTuple(args, "O:Write", &obstrValue)) *************** *** 68,77 **** PY_INTERFACE_PRECALL; ! HRESULT hr = pMy->Write(strValue, strSize, NULL); PY_INTERFACE_POSTCALL; if (FAILED(hr)) return PyCom_BuildPyException(hr, pMy, IID_IStream); ! Py_INCREF(Py_None); ! return Py_None; } --- 69,77 ---- PY_INTERFACE_PRECALL; ! HRESULT hr = pMy->Write(strValue, strSize, &cbWritten); PY_INTERFACE_POSTCALL; if (FAILED(hr)) return PyCom_BuildPyException(hr, pMy, IID_IStream); ! return PyLong_FromUnsignedLong(cbWritten); } |