Update of /cvsroot/pywin32/pywin32/win32/src
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11688/src
Modified Files:
PyACL.cpp PyHANDLE.cpp PyIID.cpp PyLARGE_INTEGER.cpp
PyOVERLAPPED.cpp PySECURITY_ATTRIBUTES.cpp
PySECURITY_DESCRIPTOR.cpp PySID.cpp PySecurityObjects.h
PyTime.cpp PyWinObjects.h PyWinTypes.h mmapfilemodule.cpp
win2krasmodule.cpp win32api_display.h win32apimodule.cpp
win32evtlog.i win32file.i win32file_comm.cpp win32gui.i
win32helpmodule.cpp win32process.i win32rasmodule.cpp
win32security.i win32service.i
Added Files:
win32file_comm.h
Log Message:
Merge many tp_getattro/setattro, "2 ints" and buffer changes from Roger
via the py3k branch.
Index: win32process.i
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32process.i,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** win32process.i 3 Dec 2008 22:34:21 -0000 1.36
--- win32process.i 11 Dec 2008 00:25:40 -0000 1.37
***************
*** 85,93 ****
static void deallocFunc(PyObject *ob);
! static PyObject *getattr(PyObject *self, char *name);
! static int setattr(PyObject *self, char *name, PyObject *v);
! #pragma warning( disable : 4251 )
! static struct memberlist memberlist[];
! #pragma warning( default : 4251 )
protected:
--- 85,91 ----
static void deallocFunc(PyObject *ob);
! static PyObject *getattro(PyObject *self, PyObject *obname);
! static int setattro(PyObject *self, PyObject *obname, PyObject *v);
! static struct PyMemberDef members[];
protected:
***************
*** 109,114 ****
PySTARTUPINFO::deallocFunc, /* tp_dealloc */
0, /* tp_print */
! PySTARTUPINFO::getattr, /* tp_getattr */
! PySTARTUPINFO::setattr, /* tp_setattr */
0, /* tp_compare */
0, /* tp_repr */
--- 107,112 ----
PySTARTUPINFO::deallocFunc, /* tp_dealloc */
0, /* tp_print */
! 0, /* tp_getattr */
! 0, /* tp_setattr */
0, /* tp_compare */
0, /* tp_repr */
***************
*** 119,127 ****
0, /* tp_call */
0, /* tp_str */
};
#define OFF(e) offsetof(PySTARTUPINFO, e)
! /*static*/ struct memberlist PySTARTUPINFO::memberlist[] = {
{"dwX", T_INT, OFF(m_startupinfo.dwX)}, // @prop integer|dwX|Specifies the x offset, in pixels, of the upper left corner of a window if a new window is created. The offset is from the upper left corner of the screen.
{"dwY", T_INT, OFF(m_startupinfo.dwY)}, // @prop integer|dwY|Specifies the y offset, in pixels, of the upper left corner of a window if a new window is created. The offset is from the upper left corner of the screen.
--- 117,147 ----
0, /* tp_call */
0, /* tp_str */
+ PySTARTUPINFO::getattro, /* tp_getattr */
+ PySTARTUPINFO::setattro, /* tp_setattr */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
+ "A Python object, representing a STARTUPINFO structure", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ 0, /* tp_methods */
+ PySTARTUPINFO::members, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
};
#define OFF(e) offsetof(PySTARTUPINFO, e)
! /*static*/ struct PyMemberDef PySTARTUPINFO::members[] = {
{"dwX", T_INT, OFF(m_startupinfo.dwX)}, // @prop integer|dwX|Specifies the x offset, in pixels, of the upper left corner of a window if a new window is created. The offset is from the upper left corner of the screen.
{"dwY", T_INT, OFF(m_startupinfo.dwY)}, // @prop integer|dwY|Specifies the y offset, in pixels, of the upper left corner of a window if a new window is created. The offset is from the upper left corner of the screen.
***************
*** 177,183 ****
}
! PyObject *PySTARTUPINFO::getattr(PyObject *self, char *name)
{
PySTARTUPINFO *pO = (PySTARTUPINFO *)self;
// @prop integer/<o PyHANDLE>|hStdInput|
// @prop integer/<o PyHANDLE>|hStdOutput|
--- 197,206 ----
}
! PyObject *PySTARTUPINFO::getattro(PyObject *self, PyObject *obname)
{
PySTARTUPINFO *pO = (PySTARTUPINFO *)self;
+ char *name=PYWIN_ATTR_CONVERT(obname);
+ if (name == NULL)
+ return NULL;
// @prop integer/<o PyHANDLE>|hStdInput|
// @prop integer/<o PyHANDLE>|hStdOutput|
***************
*** 195,199 ****
if (strcmp("lpTitle", name)==0)
return PyWinObject_FromTCHAR(pO->m_startupinfo.lpTitle);
! return PyMember_Get((char *)self, memberlist, name);
}
--- 218,222 ----
if (strcmp("lpTitle", name)==0)
return PyWinObject_FromTCHAR(pO->m_startupinfo.lpTitle);
! return PyObject_GenericGetAttr(self, obname);
}
***************
*** 214,218 ****
}
! int PySTARTUPINFO::setattr(PyObject *self, char *name, PyObject *v)
{
if (v == NULL) {
--- 237,241 ----
}
! int PySTARTUPINFO::setattro(PyObject *self, PyObject *obname, PyObject *v)
{
if (v == NULL) {
***************
*** 221,224 ****
--- 244,250 ----
}
PySTARTUPINFO *pO = (PySTARTUPINFO *)self;
+ char *name=PYWIN_ATTR_CONVERT(obname);
+ if (name == NULL)
+ return -1;
if (strcmp("hStdInput", name)==0)
return sethandle( &pO->m_obStdIn, &pO->m_startupinfo.hStdInput, v);
***************
*** 247,251 ****
return 0;
}
! return PyMember_Set((char *)self, memberlist, name, v);
}
--- 273,277 ----
return 0;
}
! return PyObject_GenericSetAttr(self, obname, v);
}
***************
*** 1526,1529 ****
--- 1552,1561 ----
%init %{
+
+ #if (PY_VERSION_HEX >= 0x03000000)
+ if (PyType_Ready(&PySTARTUPINFOType) == -1)
+ return NULL;
+ #endif
+
FARPROC fp=NULL;
HMODULE hmodule=NULL;
***************
*** 1532,1540 ****
hmodule=LoadLibrary(_T("Psapi.dll"));
if (hmodule!=NULL){
! pfnEnumProcesses = (EnumProcessesfunc)GetProcAddress(hmodule, _T("EnumProcesses"));
! pfnEnumProcessModules = (EnumProcessModulesfunc)GetProcAddress(hmodule, _T("EnumProcessModules"));
! pfnGetModuleFileNameEx = (GetModuleFileNameExfunc)GetProcAddress(hmodule, _T("GetModuleFileNameExW"));
#ifndef MS_WINCE
! pfnGetProcessMemoryInfo = (GetProcessMemoryInfofunc)GetProcAddress(hmodule, _T("GetProcessMemoryInfo"));
#endif
}
--- 1564,1572 ----
hmodule=LoadLibrary(_T("Psapi.dll"));
if (hmodule!=NULL){
! pfnEnumProcesses = (EnumProcessesfunc)GetProcAddress(hmodule, "EnumProcesses");
! pfnEnumProcessModules = (EnumProcessModulesfunc)GetProcAddress(hmodule, "EnumProcessModules");
! pfnGetModuleFileNameEx = (GetModuleFileNameExfunc)GetProcAddress(hmodule, "GetModuleFileNameExW");
#ifndef MS_WINCE
! pfnGetProcessMemoryInfo = (GetProcessMemoryInfofunc)GetProcAddress(hmodule, "GetProcessMemoryInfo");
#endif
}
Index: PyWinObjects.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinObjects.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** PyWinObjects.h 13 Nov 2008 11:11:58 -0000 1.15
--- PyWinObjects.h 11 Dec 2008 00:25:40 -0000 1.16
***************
*** 19,22 ****
--- 19,23 ----
/* Python support */
int compare(PyObject *ob);
+ PyObject *richcompare(PyObject *other, int op);
long hash(void);
PyObject *str(void);
***************
*** 26,29 ****
--- 27,31 ----
static int printFunc(PyObject *ob, FILE *fp, int flags);
static int compareFunc(PyObject *ob1, PyObject *ob2);
+ static PyObject *richcompareFunc(PyObject *self, PyObject *other, int op);
static long hashFunc(PyObject *ob);
static PyObject * strFunc(PyObject *ob);
***************
*** 53,58 ****
PyObject *repr();
int compare(PyObject *ob);
int print(FILE *fp, int flags);
- PyObject *getattr(char *name);
long hash(void);
//PyObject *str(void);
--- 55,61 ----
PyObject *repr();
int compare(PyObject *ob);
+ PyObject *PyTime::richcompare(PyObject *other, int op);
+
int print(FILE *fp, int flags);
long hash(void);
//PyObject *str(void);
***************
*** 64,69 ****
static void deallocFunc(PyObject *ob);
static int printFunc(PyObject *ob, FILE *fp, int flags);
! static PyObject *getattrFunc(PyObject *ob, char *attr);
static int compareFunc(PyObject *ob1, PyObject *ob2);
static long hashFunc(PyObject *ob);
//static PyObject * strFunc(PyObject *ob);
--- 67,73 ----
static void deallocFunc(PyObject *ob);
static int printFunc(PyObject *ob, FILE *fp, int flags);
! static PyObject *getattro(PyObject *self, PyObject *obname);
static int compareFunc(PyObject *ob1, PyObject *ob2);
+ static PyObject *richcompareFunc(PyObject *self, PyObject *other, int op);
static long hashFunc(PyObject *ob);
//static PyObject * strFunc(PyObject *ob);
***************
*** 73,76 ****
--- 77,81 ----
static PyObject * strFunc(PyObject *ob);
static PyObject * reprFunc(PyObject *ob);
+ static struct PyMethodDef methods[];
// Methods
static PyObject *Format(PyObject *self, PyObject *args);
***************
*** 105,120 ****
static int compareFunc(PyObject *ob1, PyObject *ob2);
! static PyObject *getattr(PyObject *self, char *name);
! static int setattr(PyObject *self, char *name, PyObject *v);
static long hashFunc(PyObject *self);
! #ifdef _MSC_VER
! #pragma warning( disable : 4251 )
! #endif // _MSC_VER
! static struct memberlist memberlist[];
! #ifdef _MSC_VER
! #pragma warning( default : 4251 )
! #endif // _MSC_VER
sMyOverlapped m_overlapped;
! PyObject *m_obHandle;
};
--- 110,128 ----
static int compareFunc(PyObject *ob1, PyObject *ob2);
! static PyObject *getattro(PyObject *self, PyObject *obname);
! static int setattro(PyObject *self, PyObject *obname, PyObject *v);
static long hashFunc(PyObject *self);
! static struct PYWINTYPES_EXPORT PyMemberDef members[];
!
! static PyObject *get_hEvent(PyObject *self, void *unused);
! static int set_hEvent(PyObject *self, PyObject *v, void *unused);
! static PyObject *get_Internal(PyObject *self, void *unused);
! static int set_Internal(PyObject *self, PyObject *v, void *unused);
! static PyObject *get_InternalHigh(PyObject *self, void *unused);
! static int set_InternalHigh(PyObject *self, PyObject *v, void *unused);
! static PyGetSetDef getset[];
!
sMyOverlapped m_overlapped;
! PyObject *m_obhEvent;
};
***************
*** 149,164 ****
static PyObject * ternaryFailureFunc(PyObject *ob1, PyObject *ob2, PyObject *ob3);
static PyObject *Close(PyObject *self, PyObject *args);
static PyObject *Detach(PyObject *self, PyObject *args);
!
! static PyObject *getattr(PyObject *self, char *name);
! static int setattr(PyObject *self, char *name, PyObject *v);
! #ifdef _MSC_VER
! #pragma warning( disable : 4251 )
! #endif // _MSC_VER
! static struct memberlist memberlist[];
! #ifdef _MSC_VER
! #pragma warning( default : 4251 )
! #endif // _MSC_VER
protected:
--- 157,166 ----
static PyObject * ternaryFailureFunc(PyObject *ob1, PyObject *ob2, PyObject *ob3);
+ static PyObject *get_handle(PyObject *self, void *unused);
+ static PyGetSetDef getset[];
+
static PyObject *Close(PyObject *self, PyObject *args);
static PyObject *Detach(PyObject *self, PyObject *args);
! static struct PyMethodDef methods[];
protected:
--- NEW FILE: win32file_comm.h ---
// The communications related functions.
// The COMM port enhancements were added by Mark Hammond, and are
// (c) 2000-2001, ActiveState Tools Corp.
// The comms port helpers.
extern PyObject *PyWinObject_FromCOMSTAT(const COMSTAT *pCOMSTAT);
extern BOOL PyWinObject_AsCOMSTAT(PyObject *ob, COMSTAT **ppCOMSTAT, BOOL bNoneOK = TRUE);
extern BOOL PyWinObject_AsDCB(PyObject *ob, DCB **ppDCB, BOOL bNoneOK = TRUE);
extern PyObject *PyWinObject_FromDCB(const DCB *pDCB);
extern PyObject *PyWinMethod_NewDCB(PyObject *self, PyObject *args);
extern PyObject *PyWinObject_FromCOMMTIMEOUTS( COMMTIMEOUTS *p);
extern BOOL PyWinObject_AsCOMMTIMEOUTS( PyObject *ob, COMMTIMEOUTS *p);
class PyDCB : public PyObject
{
public:
DCB *GetDCB() {return &m_DCB;}
PyDCB(void);
PyDCB(const DCB &);
~PyDCB();
/* Python support */
int compare(PyObject *ob);
static void deallocFunc(PyObject *ob);
static int compareFunc(PyObject *ob1, PyObject *ob2);
static PyObject *getattro(PyObject *self, PyObject *obname);
static int setattro(PyObject *self, PyObject *obname, PyObject *v);
static struct PyMemberDef members[];
static PyTypeObject type;
protected:
DCB m_DCB;
};
#define PyDCB_Check(x) ((x)->ob_type==&PyDCB::type)
////////////////////////////////////////////////////////////////
//
// COMSTAT object.
//
////////////////////////////////////////////////////////////////
class PyCOMSTAT : public PyObject
{
public:
COMSTAT *GetCOMSTAT() {return &m_COMSTAT;}
PyCOMSTAT(void);
PyCOMSTAT(const COMSTAT &);
~PyCOMSTAT();
/* Python support */
int compare(PyObject *ob);
static void deallocFunc(PyObject *ob);
static int compareFunc(PyObject *ob1, PyObject *ob2);
static PyObject *getattro(PyObject *self, PyObject *obname);
static int setattro(PyObject *self, PyObject *obname, PyObject *v);
static struct PyMemberDef members[];
static PyTypeObject type;
protected:
COMSTAT m_COMSTAT;
};
#define PyCOMSTAT_Check(x) ((x)->ob_type==&PyCOMSTAT::type)
Index: PySECURITY_DESCRIPTOR.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PySECURITY_DESCRIPTOR.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** PySECURITY_DESCRIPTOR.cpp 3 Dec 2008 22:34:21 -0000 1.21
--- PySECURITY_DESCRIPTOR.cpp 11 Dec 2008 00:25:40 -0000 1.22
***************
*** 678,682 ****
// @object PySECURITY_DESCRIPTOR|A Python object, representing a SECURITY_DESCRIPTOR structure
! static struct PyMethodDef PySECURITY_DESCRIPTOR_methods[] = {
{"Initialize", PySECURITY_DESCRIPTOR::Initialize, 1}, // @pymeth Initialize|Initializes the object.
{"GetSecurityDescriptorOwner", PySECURITY_DESCRIPTOR::GetSecurityDescriptorOwner, 1}, // @pymeth GetSecurityDescriptorOwner|Return the owner of the security descriptor. SID is returned.
--- 678,682 ----
// @object PySECURITY_DESCRIPTOR|A Python object, representing a SECURITY_DESCRIPTOR structure
! struct PyMethodDef PySECURITY_DESCRIPTOR::methods[] = {
{"Initialize", PySECURITY_DESCRIPTOR::Initialize, 1}, // @pymeth Initialize|Initializes the object.
{"GetSecurityDescriptorOwner", PySECURITY_DESCRIPTOR::GetSecurityDescriptorOwner, 1}, // @pymeth GetSecurityDescriptorOwner|Return the owner of the security descriptor. SID is returned.
***************
*** 697,700 ****
--- 697,721 ----
};
+ // Buffer interface in Python 3.0 has changed
+ #if (PY_VERSION_HEX < 0x03000000)
+ /*static*/ Py_ssize_t PySECURITY_DESCRIPTOR::getreadbuf(PyObject *self, Py_ssize_t index, void **ptr)
+ {
+ if ( index != 0 ) {
+ PyErr_SetString(PyExc_SystemError,
+ "accessing non-existent SID segment");
+ return -1;
+ }
+ PySECURITY_DESCRIPTOR *pysd = (PySECURITY_DESCRIPTOR *)self;
+ *ptr = pysd->m_psd;
+ return GetSecurityDescriptorLength(pysd->m_psd);
+ }
+
+ /*static*/ Py_ssize_t PySECURITY_DESCRIPTOR::getsegcount(PyObject *self, Py_ssize_t *lenp)
+ {
+ if ( lenp )
+ *lenp = GetSecurityDescriptorLength(((PySECURITY_DESCRIPTOR *)self)->m_psd);
+ return 1;
+ }
+
static PyBufferProcs PySECURITY_DESCRIPTOR_as_buffer = {
PySECURITY_DESCRIPTOR::getreadbuf,
***************
*** 704,707 ****
--- 725,742 ----
};
+ #else // New buffer interface for Python 3.0
+ /*static*/ int PySECURITY_DESCRIPTOR::getbufferinfo(PyObject *self, Py_buffer *view, int flags)
+ {
+ PySECURITY_DESCRIPTOR *pysd = (PySECURITY_DESCRIPTOR *)self;
+ return PyBuffer_FillInfo(view, self, pysd->m_psd,
+ GetSecurityDescriptorLength(pysd->m_psd), 1, flags);
+ }
+
+ static PyBufferProcs PySECURITY_DESCRIPTOR_as_buffer = {
+ PySECURITY_DESCRIPTOR::getbufferinfo,
+ NULL // Don't need to release any memory from Py_buffer struct
+ };
+ #endif // PY_VERSION_HEX < 0x03000000
+
PYWINTYPES_EXPORT PyTypeObject PySECURITY_DESCRIPTORType =
{
***************
*** 712,717 ****
PySECURITY_DESCRIPTOR::deallocFunc, /* tp_dealloc */
0, /* tp_print */
! PySECURITY_DESCRIPTOR::getattr, /* tp_getattr */
! PySECURITY_DESCRIPTOR::setattr, /* tp_setattr */
0, /* tp_compare */
0, /* tp_repr */
--- 747,752 ----
PySECURITY_DESCRIPTOR::deallocFunc, /* tp_dealloc */
0, /* tp_print */
! 0, /* tp_getattr */
! 0, /* tp_setattr */
0, /* tp_compare */
0, /* tp_repr */
***************
*** 722,736 ****
0, /* tp_call */
0, /* tp_str */
! 0, /*tp_getattro*/
! 0, /*tp_setattro*/
// @comm Note the PySECURITY_DESCRIPTOR object supports the buffer interface. Thus buffer(sd) can be used to obtain the raw bytes.
&PySECURITY_DESCRIPTOR_as_buffer, /*tp_as_buffer*/
};
- #define OFF(e) offsetof(PySECURITY_DESCRIPTOR, e)
-
- /*static*/ struct memberlist PySECURITY_DESCRIPTOR::memberlist[] = {
- {NULL} /* Sentinel */
- };
PySECURITY_DESCRIPTOR::PySECURITY_DESCRIPTOR(Py_ssize_t cb /*= 0*/)
--- 757,785 ----
0, /* tp_call */
0, /* tp_str */
! PyObject_GenericGetAttr, /* tp_getattro */
! PyObject_GenericSetAttr, /* tp_setattro */
// @comm Note the PySECURITY_DESCRIPTOR object supports the buffer interface. Thus buffer(sd) can be used to obtain the raw bytes.
&PySECURITY_DESCRIPTOR_as_buffer, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ PySECURITY_DESCRIPTOR::methods, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
};
PySECURITY_DESCRIPTOR::PySECURITY_DESCRIPTOR(Py_ssize_t cb /*= 0*/)
***************
*** 759,806 ****
}
- PyObject *PySECURITY_DESCRIPTOR::getattr(PyObject *self, char *name)
- {
- PyObject *res;
-
- res = Py_FindMethod(PySECURITY_DESCRIPTOR_methods, self, name);
- if (res != NULL)
- return res;
- PyErr_Clear();
- return PyMember_Get((char *)self, memberlist, name);
- }
-
- int PySECURITY_DESCRIPTOR::setattr(PyObject *self, char *name, PyObject *v)
- {
- if (v == NULL) {
- PyErr_SetString(PyExc_AttributeError, "can't delete SECURITY_DESCRIPTOR attributes");
- return -1;
- }
- return PyMember_Set((char *)self, memberlist, name, v);
- }
-
/*static*/ void PySECURITY_DESCRIPTOR::deallocFunc(PyObject *ob)
{
delete (PySECURITY_DESCRIPTOR *)ob;
}
-
- /*static*/ Py_ssize_t PySECURITY_DESCRIPTOR::getreadbuf(PyObject *self, Py_ssize_t index, void **ptr)
- {
- if ( index != 0 ) {
- PyErr_SetString(PyExc_SystemError,
- "accessing non-existent SID segment");
- return -1;
- }
- PySECURITY_DESCRIPTOR *pysd = (PySECURITY_DESCRIPTOR *)self;
- *ptr = pysd->m_psd;
- return GetSecurityDescriptorLength(pysd->m_psd);
- }
-
- /*static*/ Py_ssize_t PySECURITY_DESCRIPTOR::getsegcount(PyObject *self, Py_ssize_t *lenp)
- {
- if ( lenp )
- *lenp = GetSecurityDescriptorLength(((PySECURITY_DESCRIPTOR *)self)->m_psd);
- return 1;
- }
-
#else /* NO_PYWINTYPES_SECURITY */
--- 808,815 ----
Index: win32apimodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32apimodule.cpp,v
retrieving revision 1.92
retrieving revision 1.93
diff -C2 -d -r1.92 -r1.93
*** win32apimodule.cpp 8 Dec 2008 13:16:37 -0000 1.92
--- win32apimodule.cpp 11 Dec 2008 00:25:40 -0000 1.93
***************
*** 3793,3797 ****
DWORD nSubKeys, nValues;
FILETIME ft;
- PyObject *l;
// @pyparm <o PyHKEY>/int|key||An already open key, or or any one of the following win32con
--- 3793,3796 ----
***************
*** 3809,3816 ****
)!=ERROR_SUCCESS)
return ReturnAPIError("RegQueryInfoKey", rc);
! if (!(l=PyLong_FromTwoInts(ft.dwHighDateTime, ft.dwLowDateTime)))
! return NULL;
! PyObject *ret = Py_BuildValue("iiO",nSubKeys,nValues,l);
! Py_DECREF(l);
return ret;
}
--- 3808,3816 ----
)!=ERROR_SUCCESS)
return ReturnAPIError("RegQueryInfoKey", rc);
! ULARGE_INTEGER l;
! l.LowPart = ft.dwLowDateTime;
! l.HighPart = ft.dwHighDateTime;
! PyObject *ret = Py_BuildValue("iiN",nSubKeys,nValues,
! PyWinObject_FromULARGE_INTEGER(l));
return ret;
}
Index: win32api_display.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32api_display.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** win32api_display.h 4 Dec 2008 00:17:13 -0000 1.4
--- win32api_display.h 11 Dec 2008 00:25:40 -0000 1.5
***************
*** 45,49 ****
static struct PyMemberDef members[];
static struct PyMethodDef methods[];
-
static void deallocFunc(PyObject *ob);
PyDISPLAY_DEVICE(PDISPLAY_DEVICE);
--- 45,48 ----
Index: win32security.i
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32security.i,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -d -r1.49 -r1.50
*** win32security.i 7 Dec 2008 18:00:40 -0000 1.49
--- win32security.i 11 Dec 2008 00:25:40 -0000 1.50
***************
*** 830,834 ****
pfnDsFreeNameResult=(DsFreeNameResultfunc)loadapifunc("DsFreeNameResultW", ntdsapi_dll);
pfnDsGetDcName=(DsGetDcNamefunc)loadapifunc("DsGetDcNameW", netapi32_dll);
!
// old names, these should not be used
PyDict_SetItemString(d, "SecBufferType", (PyObject *)&PySecBufferType);
--- 830,846 ----
pfnDsFreeNameResult=(DsFreeNameResultfunc)loadapifunc("DsFreeNameResultW", ntdsapi_dll);
pfnDsGetDcName=(DsGetDcNamefunc)loadapifunc("DsGetDcNameW", netapi32_dll);
!
! // Py3k requires that *all* types have to be initialized
! #if (PY_VERSION_HEX >= 0x03000000)
! if (PyType_Ready(&PySecBufferType) == -1)
! return NULL;
! if (PyType_Ready(&PySecBufferDescType) == -1)
! return NULL;
! if (PyType_Ready(&PyCtxtHandleType) == -1)
! return NULL;
! if (PyType_Ready(&PyCredHandleType) == -1)
! return NULL;
! #endif
!
// old names, these should not be used
PyDict_SetItemString(d, "SecBufferType", (PyObject *)&PySecBufferType);
Index: PySID.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PySID.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** PySID.cpp 3 Dec 2008 22:34:21 -0000 1.14
--- PySID.cpp 11 Dec 2008 00:25:40 -0000 1.15
***************
*** 179,183 ****
// @object PySID|A Python object, representing a SID structure
! static struct PyMethodDef PySID_methods[] = {
{"Initialize", PySID::Initialize, 1}, // @pymeth Initialize|Initialize the SID.
{"IsValid", PySID::IsValid, 1}, // @pymeth IsValid|Determines if the SID is valid.
--- 179,183 ----
// @object PySID|A Python object, representing a SID structure
! struct PyMethodDef PySID::methods[] = {
{"Initialize", PySID::Initialize, 1}, // @pymeth Initialize|Initialize the SID.
{"IsValid", PySID::IsValid, 1}, // @pymeth IsValid|Determines if the SID is valid.
***************
*** 190,193 ****
--- 190,215 ----
};
+
+
+ #if (PY_VERSION_HEX < 0x03000000)
+ /*static*/ Py_ssize_t PySID::getreadbuf(PyObject *self, Py_ssize_t index, void **ptr)
+ {
+ if ( index != 0 ) {
+ PyErr_SetString(PyExc_SystemError,
+ "accessing non-existent SID segment");
+ return -1;
+ }
+ PySID *pysid = (PySID *)self;
+ *ptr = pysid->m_psid;
+ return GetLengthSid(pysid->m_psid);
+ }
+
+ /*static*/ Py_ssize_t PySID::getsegcount(PyObject *self, Py_ssize_t *lenp)
+ {
+ if ( lenp )
+ *lenp = GetLengthSid(((PySID *)self)->m_psid);
+ return 1;
+ }
+
static PyBufferProcs PySID_as_buffer = {
PySID::getreadbuf,
***************
*** 197,200 ****
--- 219,236 ----
};
+ #else // New buffer interface in Py3k
+
+ /*static*/ int PySID::getbufferinfo(PyObject *self, Py_buffer *view, int flags)
+ {
+ PySID *pysid = (PySID *)self;
+ return PyBuffer_FillInfo(view, self, pysid->m_psid, GetLengthSid(pysid->m_psid), 1, flags);
+ }
+
+ static PyBufferProcs PySID_as_buffer = {
+ PySID::getbufferinfo,
+ NULL, // Does not have any allocated mem in Py_buffer struct
+ };
+
+ #endif // PY_VERSION_HEX < 0x03000000
PYWINTYPES_EXPORT PyTypeObject PySIDType =
***************
*** 206,210 ****
PySID::deallocFunc, /* tp_dealloc */
0, /* tp_print */
! PySID::getattr, /* tp_getattr */
0, /* tp_setattr */
// @pymeth __cmp__|Used when objects are compared.
--- 242,246 ----
PySID::deallocFunc, /* tp_dealloc */
0, /* tp_print */
! 0, /* tp_getattr */
0, /* tp_setattr */
// @pymeth __cmp__|Used when objects are compared.
***************
*** 217,224 ****
0, /* tp_call */
PySID::strFunc, /* tp_str */
! 0, /*tp_getattro*/
! 0, /*tp_setattro*/
// @comm Note the PySID object supports the buffer interface. Thus buffer(sid) can be used to obtain the raw bytes.
&PySID_as_buffer, /*tp_as_buffer*/
};
--- 253,279 ----
0, /* tp_call */
PySID::strFunc, /* tp_str */
! PyObject_GenericGetAttr, /*tp_getattro*/
! 0, /*tp_setattro*/
// @comm Note the PySID object supports the buffer interface. Thus buffer(sid) can be used to obtain the raw bytes.
&PySID_as_buffer, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ 0, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ PySID::methods, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
};
***************
*** 251,265 ****
}
- PyObject *PySID::getattr(PyObject *self, char *name)
- {
- return Py_FindMethod(PySID_methods, self, name);
- }
-
int PySID::compare(PyObject *ob)
{
! PSID p1 = NULL, p2 = NULL;
! PyWinObject_AsSID(this, &p1);
! PyWinObject_AsSID(ob, &p2);
! return EqualSid(p1, p2)==FALSE;
}
--- 306,315 ----
}
int PySID::compare(PyObject *ob)
{
! PSID p2;
! if (!PyWinObject_AsSID(ob, &p2, FALSE))
! return -2;
! return EqualSid(this->GetSID(), p2)==FALSE;
}
***************
*** 277,300 ****
}
- /*static*/ Py_ssize_t PySID::getreadbuf(PyObject *self, Py_ssize_t index, void **ptr)
- {
- if ( index != 0 ) {
- PyErr_SetString(PyExc_SystemError,
- "accessing non-existent SID segment");
- return -1;
- }
- PySID *pysid = (PySID *)self;
- *ptr = pysid->m_psid;
- return GetLengthSid(pysid->m_psid);
- }
-
- /*static*/ Py_ssize_t PySID::getsegcount(PyObject *self, Py_ssize_t *lenp)
- {
- if ( lenp )
- *lenp = GetLengthSid(((PySID *)self)->m_psid);
- return 1;
- }
-
-
// NOTE: This function taken from KB Q131320.
BOOL GetTextualSid(
--- 327,330 ----
Index: PyOVERLAPPED.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PyOVERLAPPED.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** PyOVERLAPPED.cpp 3 Dec 2008 22:34:21 -0000 1.15
--- PyOVERLAPPED.cpp 11 Dec 2008 00:25:40 -0000 1.16
***************
*** 70,75 ****
PyOVERLAPPED::deallocFunc, /* tp_dealloc */
0, /* tp_print */
! PyOVERLAPPED::getattr, /* tp_getattr */
! PyOVERLAPPED::setattr, /* tp_setattr */
// @pymeth __cmp__|Used when OVERLAPPED objects are compared.
PyOVERLAPPED::compareFunc, /* tp_compare */
--- 70,75 ----
PyOVERLAPPED::deallocFunc, /* tp_dealloc */
0, /* tp_print */
! 0, /* tp_getattr */
! 0, /* tp_setattr */
// @pymeth __cmp__|Used when OVERLAPPED objects are compared.
PyOVERLAPPED::compareFunc, /* tp_compare */
***************
*** 81,89 ****
0, /* tp_call */
0, /* tp_str */
};
#define OFF(e) offsetof(PyOVERLAPPED, e)
! /*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.
--- 81,111 ----
0, /* tp_call */
0, /* tp_str */
+ PyOVERLAPPED::getattro, /* tp_getattro */
+ PyOVERLAPPED::setattro, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
+ 0, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ 0, /* tp_methods */
+ PyOVERLAPPED::members, /* tp_members and tp_getset are apparently mutually exclusive, but this isn't documented anywhere */
+ 0, //PyOVERLAPPED::getset, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
};
#define OFF(e) offsetof(PyOVERLAPPED, e)
...
[truncated message content] |