[pywin32-checkins] pywin32/win32/src PyOVERLAPPED.cpp, 1.13, 1.14 PyWinObjects.h, 1.13, 1.14
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Roger U. <ru...@us...> - 2008-05-25 00:34:23
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15598 Modified Files: PyOVERLAPPED.cpp PyWinObjects.h Log Message: 64-bit fixes for PyOVERLAPPED Make all properties visible to dir() Index: PyWinObjects.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinObjects.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** PyWinObjects.h 6 Feb 2008 18:37:46 -0000 1.13 --- PyWinObjects.h 25 May 2008 00:34:23 -0000 1.14 *************** *** 141,145 **** sMyOverlapped(const OVERLAPPED &o) : OVERLAPPED(o) {obState=NULL;dwValue=0;} }; ! OVERLAPPED *GetOverlapped() {return &m_overlapped;} --- 141,145 ---- sMyOverlapped(const OVERLAPPED &o) : OVERLAPPED(o) {obState=NULL;dwValue=0;} }; ! PyObject *obDummy; OVERLAPPED *GetOverlapped() {return &m_overlapped;} Index: PyOVERLAPPED.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyOVERLAPPED.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** PyOVERLAPPED.cpp 3 Jun 2007 14:53:07 -0000 1.13 --- PyOVERLAPPED.cpp 25 May 2008 00:34:23 -0000 1.14 *************** *** 19,22 **** --- 19,23 ---- // The object can then be passed to any function which takes an OVERLAPPED object, and // the object attributes will be automatically updated. + PYWINTYPES_EXPORT BOOL PyWinObject_AsOVERLAPPED(PyObject *ob, OVERLAPPED **ppOverlapped, BOOL bNoneOK /*= TRUE*/) { *************** *** 86,97 **** /*static*/ struct memberlist PyOVERLAPPED::memberlist[] = { ! {"Internal", T_INT, OFF(m_overlapped.Internal)}, // @prop integer|Internal|Reserved for operating system use. ! {"InternalHigh",T_INT, OFF(m_overlapped.InternalHigh)}, // @prop integer|InternalHigh|Reserved for operating system use. ! {"Offset", T_INT, OFF(m_overlapped.Offset)}, // @prop integer|Offset|Specifies a file position at which to start the transfer. The file position is a byte offset from the start of the file. The calling process sets this member before calling the ReadFile or WriteFile function. This member is ignored when reading from or writing to named pipes and communications devices. ! {"OffsetHigh", T_INT, OFF(m_overlapped.OffsetHigh)}, // @prop integer|OffsetHigh|Specifies the high word of the byte offset at which to start the transfer. {NULL} }; - // @prop integer/<o PyHANDLE>|hEvent|Identifies an event set to the signaled state when the transfer has been completed. The calling process sets this member before calling the <om win32file.ReadFile>, <om win32file.WriteFile>, <om win32pipe.ConnectNamedPipe>, or <om win32pipe.TransactNamedPipe> function. - // @prop object|object|Any python object that you want to attach to your overlapped I/O request. PyOVERLAPPED::PyOVERLAPPED(void) --- 87,101 ---- /*static*/ struct memberlist PyOVERLAPPED::memberlist[] = { ! {"Offset", T_ULONG, OFF(m_overlapped.Offset)}, // @prop integer|Offset|Specifies a file position at which to start the transfer. The file position is a byte offset from the start of the file. The calling process sets this member before calling the ReadFile or WriteFile function. This member is ignored when reading from or writing to named pipes and communications devices. ! {"OffsetHigh", T_ULONG, OFF(m_overlapped.OffsetHigh)}, // @prop integer|OffsetHigh|Specifies the high word of the byte offset at which to start the transfer. ! {"object", T_OBJECT, OFF(m_overlapped.obState)}, // @prop object|object|Any python object that you want to attach to your overlapped I/O request. ! {"dword", T_ULONG, OFF(m_overlapped.dwValue)}, // @prop int|dword|An integer buffer that may be used by overlapped functions (eg, <om win32file.WaitCommEvent>) ! ! // These are handled by PyOVERLAPPED::getattr, included here so they show up as attributes ! {"hEvent", T_OBJECT, OFF(obDummy)}, // @prop <o PyHANDLE>|hEvent|Identifies an event set to the signaled state when the transfer has been completed. The calling process sets this member before calling the <om win32file.ReadFile>, <om win32file.WriteFile>, <om win32pipe.ConnectNamedPipe>, or <om win32pipe.TransactNamedPipe> function. ! {"Internal", T_OBJECT, OFF(obDummy)}, // @prop integer|Internal|Reserved for operating system use. (pointer-sized value) ! {"InternalHigh",T_OBJECT, OFF(obDummy)}, // @prop integer|InternalHigh|Reserved for operating system use. (pointer-sized value) {NULL} }; PyOVERLAPPED::PyOVERLAPPED(void) *************** *** 101,104 **** --- 105,109 ---- memset(&m_overlapped, 0, sizeof(m_overlapped)); m_obHandle = NULL; + obDummy = NULL; } *************** *** 134,138 **** PyObject *PyOVERLAPPED::getattr(PyObject *self, char *name) { - // @prop integer/<o PyHANDLE>|hEvent|Identifies an event set to the signaled state when the transfer has been completed. The calling process sets this member before calling the <om win32file.ReadFile>, <om win32file.WriteFile>, <om win32pipe.ConnectNamedPipe>, or <om win32pipe.TransactNamedPipe> function. if (strcmp("hEvent", name)==0) { PyOVERLAPPED *pO = (PyOVERLAPPED *)self; --- 139,142 ---- *************** *** 143,164 **** return PyWinLong_FromHANDLE(pO->m_overlapped.hEvent); } ! // @prop object|object|Any python object that you want to attach to your overlapped I/O request. ! else if (strcmp("object", name) == 0) ! { PyOVERLAPPED *pO = (PyOVERLAPPED *)self; ! ! if (pO->m_overlapped.obState) ! { ! Py_INCREF(pO->m_overlapped.obState); ! return pO->m_overlapped.obState; ! } ! Py_INCREF(Py_None); ! return Py_None; } ! // @prop int|dword|An integer buffer that may be used by overlapped functions (eg, <om win32file.WaitCommEvent>) ! else if (strcmp("dword", name) == 0) ! { PyOVERLAPPED *pO = (PyOVERLAPPED *)self; ! return PyInt_FromLong(pO->m_overlapped.dwValue); } return PyMember_Get((char *)self, memberlist, name); --- 147,157 ---- return PyWinLong_FromHANDLE(pO->m_overlapped.hEvent); } ! if (strcmp("Internal", name) == 0){ PyOVERLAPPED *pO = (PyOVERLAPPED *)self; ! return PyWinObject_FromULONG_PTR(pO->m_overlapped.Internal); } ! if (strcmp("InternalHigh", name) == 0){ PyOVERLAPPED *pO = (PyOVERLAPPED *)self; ! return PyWinObject_FromULONG_PTR(pO->m_overlapped.InternalHigh); } return PyMember_Get((char *)self, memberlist, name); *************** *** 187,205 **** return 0; } ! else if (strcmp("object", name) == 0) ! { PyOVERLAPPED *pO = (PyOVERLAPPED *)self; ! Py_XDECREF(pO->m_overlapped.obState); ! Py_INCREF(v); ! pO->m_overlapped.obState = v; return 0; } ! else if (strcmp("dword", name) == 0) ! { PyOVERLAPPED *pO = (PyOVERLAPPED *)self; ! DWORD dwordtmp=PyInt_AsLong(v); ! if ((dwordtmp==(DWORD)-1) && PyErr_Occurred()) return -1; ! pO->m_overlapped.dwValue=dwordtmp; return 0; } --- 180,197 ---- return 0; } ! if (strcmp("Internal", name)==0){ PyOVERLAPPED *pO = (PyOVERLAPPED *)self; ! ULONG_PTR ul_tmp; ! if (!PyWinLong_AsULONG_PTR(v, &ul_tmp)) ! return -1; ! pO->m_overlapped.Internal=ul_tmp; return 0; } ! if (strcmp("InternalHigh", name)==0){ PyOVERLAPPED *pO = (PyOVERLAPPED *)self; ! ULONG_PTR ul_tmp; ! if (!PyWinLong_AsULONG_PTR(v, &ul_tmp)) return -1; ! pO->m_overlapped.InternalHigh=ul_tmp; return 0; } |