Update of /cvsroot/pywin32/pywin32/win32/src
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv17485/src
Modified Files:
win32gui.i
Log Message:
Make win32gui_struct py3k friendly by checking if win32gui itself is
built with UNICODE defined and acting accordingly. Includes new tests
and 64bit fixes.
Index: win32gui.i
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32gui.i,v
retrieving revision 1.122
retrieving revision 1.123
diff -C2 -d -r1.122 -r1.123
*** win32gui.i 11 Dec 2008 05:09:51 -0000 1.122
--- win32gui.i 13 Jan 2009 22:57:11 -0000 1.123
***************
*** 273,276 ****
--- 273,284 ----
#endif
+ PyDict_SetItemString(d, "UNICODE",
+ #ifdef UNICODE
+ Py_True
+ #else
+ Py_False
+ #endif
+ );
+
// hack borrowed from win32security since version of SWIG we use doesn't do keyword arguments
#ifdef WINXPGUI
***************
*** 1584,1591 ****
%{
! // @pyswig bytes|PyGetString|Returns bytes from an address.
static PyObject *PyGetString(PyObject *self, PyObject *args)
{
! char *addr = 0;
size_t len = -1;
#ifdef _WIN64
--- 1592,1600 ----
%{
! // @pyswig string|PyGetString|Returns a string from an address.
! // @rdesc If win32gui.UNICODE is True, this will return a unicode object.
static PyObject *PyGetString(PyObject *self, PyObject *args)
{
! TCHAR *addr = 0;
size_t len = -1;
#ifdef _WIN64
***************
*** 1608,1619 ****
return NULL;
}
! return PyString_FromStringAndSize(addr, len);
}
// This should probably be in a __try just in case.
! if (IsBadStringPtrA(addr, (DWORD_PTR)-1)) {
PyErr_SetString(PyExc_ValueError, "The value is not a valid null-terminated string");
return NULL;
}
! return PyString_FromString(addr);
}
%}
--- 1617,1628 ----
return NULL;
}
! return PyWinObject_FromTCHAR(addr, len);
}
// This should probably be in a __try just in case.
! if (IsBadStringPtr(addr, (DWORD_PTR)-1)) {
PyErr_SetString(PyExc_ValueError, "The value is not a valid null-terminated string");
return NULL;
}
! return PyWinObject_FromTCHAR(addr);
}
%}
|