pywin32-checkins Mailing List for Python for Windows Extensions (Page 20)
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...> - 2009-02-03 23:00:46
|
Update of /cvsroot/pywin32/pywin32/com/win32com/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18401/com/win32com/test Modified Files: testPyComTest.py Log Message: don't attempt to import win32timezone on python 2.3 Index: testPyComTest.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testPyComTest.py,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** testPyComTest.py 26 Jan 2009 00:47:31 -0000 1.44 --- testPyComTest.py 3 Feb 2009 23:00:36 -0000 1.45 *************** *** 12,16 **** from pywin32_testutil import str2memory import datetime ! import win32timezone importMsg = "**** PyCOMTest is not installed ***\n PyCOMTest is a Python test specific COM client and server.\n It is likely this server is not installed on this machine\n To install the server, you must get the win32com sources\n and build it using MS Visual C++" --- 12,17 ---- from pywin32_testutil import str2memory import datetime ! if sys.version_info > (2,4): ! import win32timezone # win32timezone doesn't import on 2.3... importMsg = "**** PyCOMTest is not installed ***\n PyCOMTest is a Python test specific COM client and server.\n It is likely this server is not installed on this machine\n To install the server, you must get the win32com sources\n and build it using MS Visual C++" |
|
From: Mark H. <mha...@us...> - 2009-02-03 10:15:29
|
Update of /cvsroot/pywin32/pywin32/isapi/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv4168/isapi/src Modified Files: StdAfx.h Log Message: define Py_ssize_t on py2.3 Index: StdAfx.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/StdAfx.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** StdAfx.h 3 Feb 2009 00:51:42 -0000 1.3 --- StdAfx.h 3 Feb 2009 10:15:24 -0000 1.4 *************** *** 50,53 **** --- 50,59 ---- #undef WRITE_RESTRICTED + // See PEP-353 - this is the "official" test... + #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) + // 2.3 and before have no Py_ssize_t + typedef int Py_ssize_t; + #endif + // ***** py3k support ***** // Note that when built for py3k, 'UNICODE' is defined, which conveniently |
|
From: Mark H. <mha...@us...> - 2009-02-03 05:22:30
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23991 Modified Files: PyUnicode.cpp Log Message: Try and use c++ comment markers in c++ code :) Index: PyUnicode.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyUnicode.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** PyUnicode.cpp 3 Feb 2009 05:02:59 -0000 1.33 --- PyUnicode.cpp 3 Feb 2009 05:22:25 -0000 1.34 *************** *** 297,301 **** int resultLen = 0; #if (PY_VERSION_HEX < 0x03000000) ! # Do NOT accept 'bytes' object when a plain 'WCHAR' is needed on py3k. if (PyString_Check(stringObject)) { int size=PyString_Size(stringObject); --- 297,301 ---- int resultLen = 0; #if (PY_VERSION_HEX < 0x03000000) ! // Do NOT accept 'bytes' object when a plain 'WCHAR' is needed on py3k. if (PyString_Check(stringObject)) { int size=PyString_Size(stringObject); |
|
From: Mark H. <mha...@us...> - 2009-02-03 05:16:50
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23500/win32/src Modified Files: PyWinTypesmodule.cpp Log Message: Have UnicodeFromRaw use PyWinObject_AsReadBuffer() so it works with memory views. Index: PyWinTypesmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypesmodule.cpp,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** PyWinTypesmodule.cpp 26 Jan 2009 00:12:35 -0000 1.49 --- PyWinTypesmodule.cpp 3 Feb 2009 05:16:44 -0000 1.50 *************** *** 379,389 **** static PyObject *PyWin_NewUnicodeFromRaw(PyObject *self, PyObject *args) { ! const char * value; ! unsigned int numBytes; ! // @pyparm string|str||The string containing the binary data. ! if (!PyArg_ParseTuple(args, "s#", &value, &numBytes)) return NULL; ! return PyWinObject_FromOLECHAR( (OLECHAR *)value, numBytes/sizeof(OLECHAR) ); } --- 379,392 ---- static PyObject *PyWin_NewUnicodeFromRaw(PyObject *self, PyObject *args) { ! PyObject *ob; ! // @pyparm string/buffer|str||The string containing the binary data. ! if (!PyArg_ParseTuple(args, "O", &ob)) return NULL; ! void *buf; ! DWORD nbytes; ! if (!PyWinObject_AsReadBuffer(ob, &buf, &nbytes, FALSE)) ! return NULL; ! return PyWinObject_FromWCHAR((WCHAR *)buf, nbytes/sizeof(OLECHAR) ); } |
|
From: Mark H. <mha...@us...> - 2009-02-03 05:03:09
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv21712/win32/src Modified Files: PyUnicode.cpp Log Message: don't accept bytes objects as strings on py3k Index: PyUnicode.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyUnicode.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** PyUnicode.cpp 3 Feb 2009 04:42:05 -0000 1.32 --- PyUnicode.cpp 3 Feb 2009 05:02:59 -0000 1.33 *************** *** 296,299 **** --- 296,301 ---- BOOL rc = TRUE; int resultLen = 0; + #if (PY_VERSION_HEX < 0x03000000) + # Do NOT accept 'bytes' object when a plain 'WCHAR' is needed on py3k. if (PyString_Check(stringObject)) { int size=PyString_Size(stringObject); *************** *** 316,320 **** (*pResult)[resultLen] = L'\0'; } ! else if (PyUnicode_Check(stringObject)) { resultLen = PyUnicode_GET_SIZE(stringObject); --- 318,324 ---- (*pResult)[resultLen] = L'\0'; } ! else ! #endif // py3k ! if (PyUnicode_Check(stringObject)) { resultLen = PyUnicode_GET_SIZE(stringObject); |
|
From: Mark H. <mha...@us...> - 2009-02-03 05:03:08
|
Update of /cvsroot/pywin32/pywin32/win32/help In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv21712/win32/help Modified Files: py3k.html Log Message: don't accept bytes objects as strings on py3k Index: py3k.html =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/help/py3k.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** py3k.html 3 Feb 2009 03:20:20 -0000 1.3 --- py3k.html 3 Feb 2009 05:02:59 -0000 1.4 *************** *** 22,29 **** <h1>Unicode everywhere</h1> <p> ! In general, pywin32 on both Python 2.x and 3.x will accept both str ! and unicode objects and convert as appropriate. In py3k, bytes objects ! which need to be converted to str (unicode) are still decoded as ! 'mbcs' rather than the python default encoding. </p> <p> --- 22,30 ---- <h1>Unicode everywhere</h1> <p> ! In general, pywin32 on Python 2.x will accept both str and unicode ! objects and convert as appropriate. However, in py3k, bytes objects ! will generally not be accepted when a 'string' is required - the ! intent is to restrict usage of bytes objects in py3k to where bytes ! truly are meant. </p> <p> |
|
From: Mark H. <mha...@us...> - 2009-02-03 04:42:17
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv19442 Modified Files: PyWinTypes.h PyUnicode.cpp Log Message: remove unused PyWin_WCHAR_AsString and PyWin_Bstr_AsString functions Index: PyWinTypes.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypes.h,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** PyWinTypes.h 3 Feb 2009 04:28:42 -0000 1.66 --- PyWinTypes.h 3 Feb 2009 04:42:05 -0000 1.67 *************** *** 356,362 **** PYWINTYPES_EXPORT BOOL PyWinObject_AsTaskAllocatedWCHAR(PyObject *stringObject, WCHAR **ppResult, BOOL bNoneOK /*= FALSE*/,DWORD *pResultLen /*= NULL*/); PYWINTYPES_EXPORT void PyWinObject_FreeTaskAllocatedWCHAR(WCHAR * str); - // String conversion - These must also be freed with PyWinObject_FreeString - PYWINTYPES_EXPORT BOOL PyWin_WCHAR_AsString(WCHAR *input, DWORD inLen, char **pResult); - PYWINTYPES_EXPORT BOOL PyWin_Bstr_AsString(BSTR input, char **pResult); PYWINTYPES_EXPORT void PyWinObject_FreeString(char *str); --- 356,359 ---- Index: PyUnicode.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyUnicode.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** PyUnicode.cpp 3 Feb 2009 04:28:42 -0000 1.31 --- PyUnicode.cpp 3 Feb 2009 04:42:05 -0000 1.32 *************** *** 122,146 **** } - // Convert a WCHAR string to "char *" - // If len is known, pass it, else -1 - // NOTE - string must be freed with PyWinObject_FreeString - BOOL PyWin_WCHAR_AsString(WCHAR *input, DWORD inLen, char **pResult) - { - if (inLen==-1) - inLen = wcslen(input); - // convert from string len to include terminator. - inLen++; - char *buf = (char *)PyMem_Malloc(inLen); - - DWORD len = WideCharToMultiByte(CP_ACP, 0, input, inLen, buf, inLen, NULL, NULL); - if (len==0) { - PyMem_Free(buf); - PyWin_SetAPIError("WideCharToMultiByte"); - return FALSE; - } - *pResult = buf; - return TRUE; - } - // Convert a Python object to a "char *" - allow embedded NULLs, None, etc. BOOL PyWinObject_AsString(PyObject *stringObject, char **pResult, BOOL bNoneOK /*= FALSE*/, DWORD *pResultLen /* = NULL */) --- 122,125 ---- |
Update of /cvsroot/pywin32/pywin32/win32/src/win32net In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18955 Modified Files: win32net.h win32netgroup.cpp win32netmisc.cpp win32netmodule.cpp win32netuse.cpp win32netuser.cpp Log Message: Avoid using a TCHAR as the attribute name in a PyNET_STRUCT_ITEM so we can avoid turning it back to a narrow string to use as a dict key; just stick with a plain 'char *' and avoid the conversion. Index: win32net.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32net/win32net.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** win32net.h 4 Jun 2008 08:18:55 -0000 1.7 --- win32net.h 3 Feb 2009 04:38:03 -0000 1.8 *************** *** 14,18 **** }; struct PyNET_STRUCT_ITEM { ! TCHAR *attrname; NSI_TYPE type; size_t off; --- 14,18 ---- }; struct PyNET_STRUCT_ITEM { ! char *attrname; NSI_TYPE type; size_t off; Index: win32netmisc.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32net/win32netmisc.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** win32netmisc.cpp 3 Feb 2009 04:28:18 -0000 1.16 --- win32netmisc.cpp 3 Feb 2009 04:38:03 -0000 1.17 *************** *** 10,14 **** #include "stddef.h" ! #define SI0_ENTRY(name, t, r) { _T(#name), t, offsetof(SHARE_INFO_0, shi0_##name), r } // @object PySHARE_INFO_0|A dictionary holding the infomation in a Win32 SHARE_INFO_0 structure. static struct PyNET_STRUCT_ITEM si0[] = { --- 10,14 ---- #include "stddef.h" ! #define SI0_ENTRY(name, t, r) { #name, t, offsetof(SHARE_INFO_0, shi0_##name), r } // @object PySHARE_INFO_0|A dictionary holding the infomation in a Win32 SHARE_INFO_0 structure. static struct PyNET_STRUCT_ITEM si0[] = { *************** *** 17,21 **** }; ! #define SI1_ENTRY(name, t, r) { _T(#name), t, offsetof(SHARE_INFO_1, shi1_##name), r } // @object PySHARE_INFO_1|A dictionary holding the infomation in a Win32 SHARE_INFO_1 structure. static struct PyNET_STRUCT_ITEM si1[] = { --- 17,21 ---- }; ! #define SI1_ENTRY(name, t, r) { #name, t, offsetof(SHARE_INFO_1, shi1_##name), r } // @object PySHARE_INFO_1|A dictionary holding the infomation in a Win32 SHARE_INFO_1 structure. static struct PyNET_STRUCT_ITEM si1[] = { *************** *** 26,30 **** }; ! #define SI2_ENTRY(name, t, r) { _T(#name), t, offsetof(SHARE_INFO_2, shi2_##name), r } // @object PySHARE_INFO_2|A dictionary holding the infomation in a Win32 SHARE_INFO_2 structure. static struct PyNET_STRUCT_ITEM si2[] = { --- 26,30 ---- }; ! #define SI2_ENTRY(name, t, r) { #name, t, offsetof(SHARE_INFO_2, shi2_##name), r } // @object PySHARE_INFO_2|A dictionary holding the infomation in a Win32 SHARE_INFO_2 structure. static struct PyNET_STRUCT_ITEM si2[] = { *************** *** 40,44 **** }; ! #define SI501_ENTRY(name, t, r) { _T(#name), t, offsetof(SHARE_INFO_501, shi501_##name), r } // @object PySHARE_INFO_501|A dictionary holding the infomation in a Win32 SHARE_INFO_501 structure. static struct PyNET_STRUCT_ITEM si501[] = { --- 40,44 ---- }; ! #define SI501_ENTRY(name, t, r) { #name, t, offsetof(SHARE_INFO_501, shi501_##name), r } // @object PySHARE_INFO_501|A dictionary holding the infomation in a Win32 SHARE_INFO_501 structure. static struct PyNET_STRUCT_ITEM si501[] = { *************** *** 50,54 **** }; ! #define SI502_ENTRY(name, t, r) { _T(#name), t, offsetof(SHARE_INFO_502, shi502_##name), r } // @object PySHARE_INFO_502|A dictionary holding the infomation in a Win32 SHARE_INFO_502 structure. static struct PyNET_STRUCT_ITEM si502[] = { --- 50,54 ---- }; ! #define SI502_ENTRY(name, t, r) { #name, t, offsetof(SHARE_INFO_502, shi502_##name), r } // @object PySHARE_INFO_502|A dictionary holding the infomation in a Win32 SHARE_INFO_502 structure. static struct PyNET_STRUCT_ITEM si502[] = { *************** *** 76,80 **** }; ! #define WKI100_ENTRY(name, t, r) { _T(#name), t, offsetof(WKSTA_INFO_100, wki100_##name), r } // @object PyWKSTA_INFO_100|A dictionary holding the infomation in a Win32 WKSTA_INFO_100 structure. static struct PyNET_STRUCT_ITEM wki100[] = { --- 76,80 ---- }; ! #define WKI100_ENTRY(name, t, r) { #name, t, offsetof(WKSTA_INFO_100, wki100_##name), r } // @object PyWKSTA_INFO_100|A dictionary holding the infomation in a Win32 WKSTA_INFO_100 structure. static struct PyNET_STRUCT_ITEM wki100[] = { *************** *** 87,91 **** }; ! #define WKI101_ENTRY(name, t, r) { _T(#name), t, offsetof(WKSTA_INFO_101, wki101_##name), r } // @object PyWKSTA_INFO_101|A dictionary holding the infomation in a Win32 WKSTA_INFO_101 structure. static struct PyNET_STRUCT_ITEM wki101[] = { --- 87,91 ---- }; ! #define WKI101_ENTRY(name, t, r) { #name, t, offsetof(WKSTA_INFO_101, wki101_##name), r } // @object PyWKSTA_INFO_101|A dictionary holding the infomation in a Win32 WKSTA_INFO_101 structure. static struct PyNET_STRUCT_ITEM wki101[] = { *************** *** 99,103 **** }; ! #define WKI102_ENTRY(name, t, r) { _T(#name), t, offsetof(WKSTA_INFO_102, wki102_##name), r } // @object PyWKSTA_INFO_102|A dictionary holding the infomation in a Win32 WKSTA_INFO_102 structure. static struct PyNET_STRUCT_ITEM wki102[] = { --- 99,103 ---- }; ! #define WKI102_ENTRY(name, t, r) { #name, t, offsetof(WKSTA_INFO_102, wki102_##name), r } // @object PyWKSTA_INFO_102|A dictionary holding the infomation in a Win32 WKSTA_INFO_102 structure. static struct PyNET_STRUCT_ITEM wki102[] = { *************** *** 112,116 **** }; ! #define WKI302_ENTRY(name, t, r) { _T(#name), t, offsetof(WKSTA_INFO_302, wki302_##name), r } // @object PyWKSTA_INFO_302|A dictionary holding the infomation in a Win32 WKSTA_INFO_302 structure. static struct PyNET_STRUCT_ITEM wki302[] = { --- 112,116 ---- }; ! #define WKI302_ENTRY(name, t, r) { #name, t, offsetof(WKSTA_INFO_302, wki302_##name), r } // @object PyWKSTA_INFO_302|A dictionary holding the infomation in a Win32 WKSTA_INFO_302 structure. static struct PyNET_STRUCT_ITEM wki302[] = { *************** *** 143,147 **** }; ! #define WKI402_ENTRY(name, t, r) { _T(#name), t, offsetof(WKSTA_INFO_402, wki402_##name), r } // @object PyWKSTA_INFO_402|A dictionary holding the infomation in a Win32 WKSTA_INFO_402 structure. static struct PyNET_STRUCT_ITEM wki402[] = { --- 143,147 ---- }; ! #define WKI402_ENTRY(name, t, r) { #name, t, offsetof(WKSTA_INFO_402, wki402_##name), r } // @object PyWKSTA_INFO_402|A dictionary holding the infomation in a Win32 WKSTA_INFO_402 structure. static struct PyNET_STRUCT_ITEM wki402[] = { *************** *** 170,174 **** }; ! #define WKI502_ENTRY(name, t, r) { _T(#name), t, offsetof(WKSTA_INFO_502, wki502_##name), r } // @object PyWKSTA_INFO_502|A dictionary holding the infomation in a Win32 WKSTA_INFO_502 structure. static struct PyNET_STRUCT_ITEM wki502[] = { --- 170,174 ---- }; ! #define WKI502_ENTRY(name, t, r) { #name, t, offsetof(WKSTA_INFO_502, wki502_##name), r } // @object PyWKSTA_INFO_502|A dictionary holding the infomation in a Win32 WKSTA_INFO_502 structure. static struct PyNET_STRUCT_ITEM wki502[] = { *************** *** 230,234 **** }; ! #define WKUI0_ENTRY(name, t, r) { _T(#name), t, offsetof(WKSTA_USER_INFO_0, wkui0_##name), r } // @object PyWKSTA_USER_INFO_0|A dictionary holding the infomation in a Win32 WKSTA_USER_INFO_0 structure. static struct PyNET_STRUCT_ITEM wkui0[] = { --- 230,234 ---- }; ! #define WKUI0_ENTRY(name, t, r) { #name, t, offsetof(WKSTA_USER_INFO_0, wkui0_##name), r } // @object PyWKSTA_USER_INFO_0|A dictionary holding the infomation in a Win32 WKSTA_USER_INFO_0 structure. static struct PyNET_STRUCT_ITEM wkui0[] = { *************** *** 237,241 **** }; ! #define WKUI1_ENTRY(name, t, r) { _T(#name), t, offsetof(WKSTA_USER_INFO_1, wkui1_##name), r } // @object PyWKSTA_USER_INFO_1|A dictionary holding the infomation in a Win32 WKSTA_USER_INFO_1 structure. static struct PyNET_STRUCT_ITEM wkui1[] = { --- 237,241 ---- }; ! #define WKUI1_ENTRY(name, t, r) { #name, t, offsetof(WKSTA_USER_INFO_1, wkui1_##name), r } // @object PyWKSTA_USER_INFO_1|A dictionary holding the infomation in a Win32 WKSTA_USER_INFO_1 structure. static struct PyNET_STRUCT_ITEM wkui1[] = { *************** *** 254,258 **** }; ! #define WKTI0_ENTRY(name, t, r) { _T(#name), t, offsetof(WKSTA_TRANSPORT_INFO_0, wkti0_##name), r } // @object PyWKSTA_TRANSPORT_INFO_0|A dictionary holding the infomation in a Win32 WKSTA_TRANSPORT_INFO_0 structure. static struct PyNET_STRUCT_ITEM wkti0[] = { --- 254,258 ---- }; ! #define WKTI0_ENTRY(name, t, r) { #name, t, offsetof(WKSTA_TRANSPORT_INFO_0, wkti0_##name), r } // @object PyWKSTA_TRANSPORT_INFO_0|A dictionary holding the infomation in a Win32 WKSTA_TRANSPORT_INFO_0 structure. static struct PyNET_STRUCT_ITEM wkti0[] = { *************** *** 482,486 **** } ! #define SV100_ENTRY(name, t, r) { _T(#name), t, offsetof(SERVER_INFO_100, sv100_##name), r } // @object PySERVER_INFO_100|A dictionary holding the information in a Win32 SERVER_INFO_100 structure. static struct PyNET_STRUCT_ITEM sv100[] = { --- 482,486 ---- } ! #define SV100_ENTRY(name, t, r) { #name, t, offsetof(SERVER_INFO_100, sv100_##name), r } // @object PySERVER_INFO_100|A dictionary holding the information in a Win32 SERVER_INFO_100 structure. static struct PyNET_STRUCT_ITEM sv100[] = { *************** *** 489,493 **** {NULL} }; ! #define SV101_ENTRY(name, t, r) { _T(#name), t, offsetof(SERVER_INFO_101, sv101_##name), r } // @object PySERVER_INFO_101|A dictionary holding the information in a Win32 SERVER_INFO_101 structure. static struct PyNET_STRUCT_ITEM sv101[] = { --- 489,493 ---- {NULL} }; ! #define SV101_ENTRY(name, t, r) { #name, t, offsetof(SERVER_INFO_101, sv101_##name), r } // @object PySERVER_INFO_101|A dictionary holding the information in a Win32 SERVER_INFO_101 structure. static struct PyNET_STRUCT_ITEM sv101[] = { *************** *** 501,505 **** }; ! #define SV102_ENTRY(name, t, r) { _T(#name), t, offsetof(SERVER_INFO_102, sv102_##name), r } // @object PySERVER_INFO_102|A dictionary holding the information in a Win32 SERVER_INFO_102 structure. static struct PyNET_STRUCT_ITEM sv102[] = { --- 501,505 ---- }; ! #define SV102_ENTRY(name, t, r) { #name, t, offsetof(SERVER_INFO_102, sv102_##name), r } // @object PySERVER_INFO_102|A dictionary holding the information in a Win32 SERVER_INFO_102 structure. static struct PyNET_STRUCT_ITEM sv102[] = { *************** *** 519,523 **** }; ! #define SV402_ENTRY(name, t, r) { _T(#name), t, offsetof(SERVER_INFO_402, sv402_##name), r } // @object PySERVER_INFO_402|A dictionary holding the information in a Win32 SERVER_INFO_402 structure. static struct PyNET_STRUCT_ITEM sv402[] = { --- 519,523 ---- }; ! #define SV402_ENTRY(name, t, r) { #name, t, offsetof(SERVER_INFO_402, sv402_##name), r } // @object PySERVER_INFO_402|A dictionary holding the information in a Win32 SERVER_INFO_402 structure. static struct PyNET_STRUCT_ITEM sv402[] = { *************** *** 556,560 **** ! #define SV403_ENTRY(name, t, r) { _T(#name), t, offsetof(SERVER_INFO_403, sv403_##name), r } // @object PySERVER_INFO_403|A dictionary holding the information in a Win32 SERVER_INFO_403 structure. static struct PyNET_STRUCT_ITEM sv403[] = { --- 556,560 ---- ! #define SV403_ENTRY(name, t, r) { #name, t, offsetof(SERVER_INFO_403, sv403_##name), r } // @object PySERVER_INFO_403|A dictionary holding the information in a Win32 SERVER_INFO_403 structure. static struct PyNET_STRUCT_ITEM sv403[] = { *************** *** 595,599 **** }; ! #define SV502_ENTRY(name, t) { _T(#name), t, offsetof(SERVER_INFO_502, sv502_##name), 0 } // @object PySERVER_INFO_502|A dictionary holding the information in a Win32 SERVER_INFO_502 structure. static struct PyNET_STRUCT_ITEM sv502[] = { --- 595,599 ---- }; ! #define SV502_ENTRY(name, t) { #name, t, offsetof(SERVER_INFO_502, sv502_##name), 0 } // @object PySERVER_INFO_502|A dictionary holding the information in a Win32 SERVER_INFO_502 structure. static struct PyNET_STRUCT_ITEM sv502[] = { *************** *** 618,622 **** }; ! #define SV503_ENTRY(name, t) { _T(#name), t, offsetof(SERVER_INFO_503, sv503_##name), 0 } // @object PySERVER_INFO_503|A dictionary holding the information in a Win32 SERVER_INFO_503 structure. static struct PyNET_STRUCT_ITEM sv503[] = { --- 618,622 ---- }; ! #define SV503_ENTRY(name, t) { #name, t, offsetof(SERVER_INFO_503, sv503_##name), 0 } // @object PySERVER_INFO_503|A dictionary holding the information in a Win32 SERVER_INFO_503 structure. static struct PyNET_STRUCT_ITEM sv503[] = { Index: win32netmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32net/win32netmodule.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** win32netmodule.cpp 3 Jan 2009 06:43:59 -0000 1.28 --- win32netmodule.cpp 3 Feb 2009 04:38:03 -0000 1.29 *************** *** 97,101 **** return FALSE; } - char *szAttrName = NULL; // allocate the structure, and wipe it to zero. BYTE *buf = (BYTE *)malloc(pI->structsize); --- 97,100 ---- *************** *** 103,113 **** PyNET_STRUCT_ITEM *pItem; for( pItem=pI->entries;pItem->attrname != NULL;pItem++) { ! if (szAttrName) { ! PyWinObject_FreeString(szAttrName); ! szAttrName = NULL; ! } ! if (!PyWin_WCHAR_AsString(pItem->attrname, -1, &szAttrName)) ! goto done; ! PyObject *subob = PyMapping_GetItemString(ob, szAttrName); if (subob==NULL) { --- 102,106 ---- PyNET_STRUCT_ITEM *pItem; for( pItem=pI->entries;pItem->attrname != NULL;pItem++) { ! PyObject *subob = PyMapping_GetItemString(ob, pItem->attrname); if (subob==NULL) { *************** *** 115,119 **** // See if it is OK. if (pItem->reqd) { ! PyErr_Format(PyExc_ValueError, "The mapping does not have the required attribute '%s'", szAttrName); goto done; } --- 108,112 ---- // See if it is OK. if (pItem->reqd) { ! PyErr_Format(PyExc_ValueError, "The mapping does not have the required attribute '%s'", pItem->attrname); goto done; } *************** *** 130,134 **** case NSI_DWORD: if (!PyInt_Check(subob)) { ! PyErr_Format(PyExc_TypeError, "The mapping attribute '%s' must be an integer", szAttrName); Py_DECREF(subob); goto done; --- 123,127 ---- case NSI_DWORD: if (!PyInt_Check(subob)) { ! PyErr_Format(PyExc_TypeError, "The mapping attribute '%s' must be an integer", pItem->attrname); Py_DECREF(subob); goto done; *************** *** 138,142 **** case NSI_LONG: if (!PyInt_Check(subob)) { ! PyErr_Format(PyExc_TypeError, "The mapping attribute '%s' must be an integer", szAttrName); Py_DECREF(subob); goto done; --- 131,135 ---- case NSI_LONG: if (!PyInt_Check(subob)) { ! PyErr_Format(PyExc_TypeError, "The mapping attribute '%s' must be an integer", pItem->attrname); Py_DECREF(subob); goto done; *************** *** 146,150 **** case NSI_BOOL: if (!PyInt_Check(subob)) { ! PyErr_Format(PyExc_TypeError, "The mapping attribute '%s' must be an integer", szAttrName); Py_DECREF(subob); goto done; --- 139,143 ---- case NSI_BOOL: if (!PyInt_Check(subob)) { ! PyErr_Format(PyExc_TypeError, "The mapping attribute '%s' must be an integer", pItem->attrname); Py_DECREF(subob); goto done; *************** *** 155,159 **** if (subob != Py_None) { if (!PyString_Check(subob) || PyString_Size(subob)!=21) { ! PyErr_Format(PyExc_TypeError, "The mapping attribute '%s' must be a string of exactly length 21", szAttrName); Py_DECREF(subob); goto done; --- 148,152 ---- if (subob != Py_None) { if (!PyString_Check(subob) || PyString_Size(subob)!=21) { ! PyErr_Format(PyExc_TypeError, "The mapping attribute '%s' must be a string of exactly length 21", pItem->attrname); Py_DECREF(subob); goto done; *************** *** 202,206 **** ok = TRUE; done: - if (szAttrName) PyWinObject_FreeString(szAttrName); if (!ok ) { PyObject_FreeNET_STRUCT(pI, buf); --- 195,198 ---- *************** *** 255,266 **** return NULL; } ! char *szAttrName; ! if (!PyWin_WCHAR_AsString(pItem->attrname, -1, &szAttrName)) { ! Py_DECREF(ret); ! return NULL; ! } ! PyMapping_SetItemString(ret, szAttrName, newObj); Py_DECREF(newObj); - PyWinObject_FreeString(szAttrName); } return ret; --- 247,252 ---- return NULL; } ! PyMapping_SetItemString(ret, pItem->attrname, newObj); Py_DECREF(newObj); } return ret; Index: win32netuse.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32net/win32netuse.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** win32netuse.cpp 3 Jan 2009 06:43:59 -0000 1.6 --- win32netuse.cpp 3 Feb 2009 04:38:03 -0000 1.7 *************** *** 10,14 **** #include "stddef.h" ! #define UI0_ENTRY(name, t, r) { _T(#name), t, offsetof(USE_INFO_0, ui0_##name), r } // @object PyUSE_INFO_0|A dictionary holding the infomation in a Win32 USE_INFO_0 structure. static struct PyNET_STRUCT_ITEM ui0[] = { --- 10,14 ---- #include "stddef.h" ! #define UI0_ENTRY(name, t, r) { #name, t, offsetof(USE_INFO_0, ui0_##name), r } // @object PyUSE_INFO_0|A dictionary holding the infomation in a Win32 USE_INFO_0 structure. static struct PyNET_STRUCT_ITEM ui0[] = { *************** *** 18,22 **** }; ! #define UI1_ENTRY(name, t, r) { _T(#name), t, offsetof(USE_INFO_1, ui1_##name), r } // @object PyUSE_INFO_1|A dictionary holding the infomation in a Win32 USE_INFO_1 structure. static struct PyNET_STRUCT_ITEM ui1[] = { --- 18,22 ---- }; ! #define UI1_ENTRY(name, t, r) { #name, t, offsetof(USE_INFO_1, ui1_##name), r } // @object PyUSE_INFO_1|A dictionary holding the infomation in a Win32 USE_INFO_1 structure. static struct PyNET_STRUCT_ITEM ui1[] = { *************** *** 31,35 **** }; ! #define UI2_ENTRY(name, t, r) { _T(#name), t, offsetof(USE_INFO_2, ui2_##name), r } // @object PyUSE_INFO_2|A dictionary holding the infomation in a Win32 USE_INFO_2 structure. static struct PyNET_STRUCT_ITEM ui2[] = { --- 31,35 ---- }; ! #define UI2_ENTRY(name, t, r) { #name, t, offsetof(USE_INFO_2, ui2_##name), r } // @object PyUSE_INFO_2|A dictionary holding the infomation in a Win32 USE_INFO_2 structure. static struct PyNET_STRUCT_ITEM ui2[] = { *************** *** 46,50 **** }; ! #define UI3_ENTRY(name, t, r) { _T(#name), t, offsetof(USE_INFO_3, ui3_##name), r } // @object PyUSE_INFO_3|A dictionary holding the infomation in a Win32 USE_INFO_3 structure. static struct PyNET_STRUCT_ITEM ui3[] = { --- 46,50 ---- }; ! #define UI3_ENTRY(name, t, r) { #name, t, offsetof(USE_INFO_3, ui3_##name), r } // @object PyUSE_INFO_3|A dictionary holding the infomation in a Win32 USE_INFO_3 structure. static struct PyNET_STRUCT_ITEM ui3[] = { Index: win32netuser.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32net/win32netuser.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** win32netuser.cpp 3 Jan 2009 06:43:59 -0000 1.10 --- win32netuser.cpp 3 Feb 2009 04:38:03 -0000 1.11 *************** *** 13,37 **** #include "stddef.h" ! #define UI0_ENTRY(name, t, r) { _T(#name), t, offsetof(USER_INFO_0, usri0_##name), r } ! #define UI1_ENTRY(name, t, r) { _T(#name), t, offsetof(USER_INFO_1, usri1_##name), r } ! #define UI2_ENTRY(name, t, r) { _T(#name), t, offsetof(USER_INFO_2, usri2_##name), r } ! #define UI3_ENTRY(name, t, r) { _T(#name), t, offsetof(USER_INFO_3, usri3_##name), r } ! #define UI4_ENTRY(name, t, r) { _T(#name), t, offsetof(USER_INFO_4, usri4_##name), r } ! #define UI10_ENTRY(name, t, r) { _T(#name), t, offsetof(USER_INFO_10, usri10_##name), r } ! #define UI11_ENTRY(name, t, r) { _T(#name), t, offsetof(USER_INFO_11, usri11_##name), r } ! #define UI20_ENTRY(name, t, r) { _T(#name), t, offsetof(USER_INFO_20, usri20_##name), r } ! #define UI1003_ENTRY(name, t, r) { _T(#name), t, offsetof(USER_INFO_1003, usri1003_##name), r } ! #define UI1005_ENTRY(name, t, r) { _T(#name), t, offsetof(USER_INFO_1005, usri1005_##name), r } ! #define UI1006_ENTRY(name, t, r) { _T(#name), t, offsetof(USER_INFO_1006, usri1006_##name), r } ! #define UI1007_ENTRY(name, t, r) { _T(#name), t, offsetof(USER_INFO_1007, usri1007_##name), r } ! #define UI1008_ENTRY(name, t, r) { _T(#name), t, offsetof(USER_INFO_1008, usri1008_##name), r } ! #define UI1009_ENTRY(name, t, r) { _T(#name), t, offsetof(USER_INFO_1009, usri1009_##name), r } ! #define UI1010_ENTRY(name, t, r) { _T(#name), t, offsetof(USER_INFO_1010, usri1010_##name), r } ! #define UI1011_ENTRY(name, t, r) { _T(#name), t, offsetof(USER_INFO_1011, usri1011_##name), r } ! #define UMI0_ENTRY(name, t, r) { _T(#name), t, offsetof(USER_MODALS_INFO_0, usrmod0_##name), r } ! #define UMI1_ENTRY(name, t, r) { _T(#name), t, offsetof(USER_MODALS_INFO_1, usrmod1_##name), r } ! #define UMI2_ENTRY(name, t, r) { _T(#name), t, offsetof(USER_MODALS_INFO_2, usrmod2_##name), r } ! #define UMI3_ENTRY(name, t, r) { _T(#name), t, offsetof(USER_MODALS_INFO_3, usrmod3_##name), r } // @object PyUSER_INFO_0|A dictionary holding the information in a Win32 USER_INFO_0 structure. --- 13,37 ---- #include "stddef.h" ! #define UI0_ENTRY(name, t, r) { #name, t, offsetof(USER_INFO_0, usri0_##name), r } ! #define UI1_ENTRY(name, t, r) { #name, t, offsetof(USER_INFO_1, usri1_##name), r } ! #define UI2_ENTRY(name, t, r) { #name, t, offsetof(USER_INFO_2, usri2_##name), r } ! #define UI3_ENTRY(name, t, r) { #name, t, offsetof(USER_INFO_3, usri3_##name), r } ! #define UI4_ENTRY(name, t, r) { #name, t, offsetof(USER_INFO_4, usri4_##name), r } ! #define UI10_ENTRY(name, t, r) { #name, t, offsetof(USER_INFO_10, usri10_##name), r } ! #define UI11_ENTRY(name, t, r) { #name, t, offsetof(USER_INFO_11, usri11_##name), r } ! #define UI20_ENTRY(name, t, r) { #name, t, offsetof(USER_INFO_20, usri20_##name), r } ! #define UI1003_ENTRY(name, t, r) { #name, t, offsetof(USER_INFO_1003, usri1003_##name), r } ! #define UI1005_ENTRY(name, t, r) { #name, t, offsetof(USER_INFO_1005, usri1005_##name), r } ! #define UI1006_ENTRY(name, t, r) { #name, t, offsetof(USER_INFO_1006, usri1006_##name), r } ! #define UI1007_ENTRY(name, t, r) { #name, t, offsetof(USER_INFO_1007, usri1007_##name), r } ! #define UI1008_ENTRY(name, t, r) { #name, t, offsetof(USER_INFO_1008, usri1008_##name), r } ! #define UI1009_ENTRY(name, t, r) { #name, t, offsetof(USER_INFO_1009, usri1009_##name), r } ! #define UI1010_ENTRY(name, t, r) { #name, t, offsetof(USER_INFO_1010, usri1010_##name), r } ! #define UI1011_ENTRY(name, t, r) { #name, t, offsetof(USER_INFO_1011, usri1011_##name), r } ! #define UMI0_ENTRY(name, t, r) { #name, t, offsetof(USER_MODALS_INFO_0, usrmod0_##name), r } ! #define UMI1_ENTRY(name, t, r) { #name, t, offsetof(USER_MODALS_INFO_1, usrmod1_##name), r } ! #define UMI2_ENTRY(name, t, r) { #name, t, offsetof(USER_MODALS_INFO_2, usrmod2_##name), r } ! #define UMI3_ENTRY(name, t, r) { #name, t, offsetof(USER_MODALS_INFO_3, usrmod3_##name), r } // @object PyUSER_INFO_0|A dictionary holding the information in a Win32 USER_INFO_0 structure. Index: win32netgroup.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32net/win32netgroup.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** win32netgroup.cpp 3 Jan 2009 06:43:59 -0000 1.6 --- win32netgroup.cpp 3 Feb 2009 04:38:03 -0000 1.7 *************** *** 9,17 **** #include "stddef.h" ! #define GI0_ENTRY(name, t, r) { _T(#name), t, offsetof(GROUP_INFO_0, grpi0_##name), r } ! #define GI1_ENTRY(name, t, r) { _T(#name), t, offsetof(GROUP_INFO_1, grpi1_##name), r } ! #define GI2_ENTRY(name, t, r) { _T(#name), t, offsetof(GROUP_INFO_2, grpi2_##name), r } ! #define GI1002_ENTRY(name, t, r) { _T(#name), t, offsetof(GROUP_INFO_1002, grpi1002_##name), r } ! #define GI1005_ENTRY(name, t, r) { _T(#name), t, offsetof(GROUP_INFO_1005, grpi1005_##name), r } --- 9,17 ---- #include "stddef.h" ! #define GI0_ENTRY(name, t, r) { #name, t, offsetof(GROUP_INFO_0, grpi0_##name), r } ! #define GI1_ENTRY(name, t, r) { #name, t, offsetof(GROUP_INFO_1, grpi1_##name), r } ! #define GI2_ENTRY(name, t, r) { #name, t, offsetof(GROUP_INFO_2, grpi2_##name), r } ! #define GI1002_ENTRY(name, t, r) { #name, t, offsetof(GROUP_INFO_1002, grpi1002_##name), r } ! #define GI1005_ENTRY(name, t, r) { #name, t, offsetof(GROUP_INFO_1005, grpi1005_##name), r } *************** *** 60,66 **** }; ! #define LGI0_ENTRY(name, t, r) { _T(#name), t, offsetof(LOCALGROUP_INFO_0, lgrpi0_##name), r } ! #define LGI1_ENTRY(name, t, r) { _T(#name), t, offsetof(LOCALGROUP_INFO_1, lgrpi1_##name), r } ! #define LGI1002_ENTRY(name, t, r) { _T(#name), t, offsetof(LOCALGROUP_INFO_1002, lgrpi1002_##name), r } // @object PyLOCALGROUP_INFO_0|A dictionary holding the information in a Win32 LOCALGROUP_INFO_0 structure. --- 60,66 ---- }; ! #define LGI0_ENTRY(name, t, r) { #name, t, offsetof(LOCALGROUP_INFO_0, lgrpi0_##name), r } ! #define LGI1_ENTRY(name, t, r) { #name, t, offsetof(LOCALGROUP_INFO_1, lgrpi1_##name), r } ! #define LGI1002_ENTRY(name, t, r) { #name, t, offsetof(LOCALGROUP_INFO_1002, lgrpi1002_##name), r } // @object PyLOCALGROUP_INFO_0|A dictionary holding the information in a Win32 LOCALGROUP_INFO_0 structure. *************** *** 91,95 **** }; ! #define LGMI0_ENTRY(name, t, r) { _T(#name), t, offsetof(LOCALGROUP_MEMBERS_INFO_0, lgrmi0_##name), r } // @object PyLOCALGROUP_MEMBERS_INFO_0|A dictionary holding the information in a Win32 LOCALGROUP_MEMBERS_INFO_0 structure. static struct PyNET_STRUCT_ITEM lgmi0[] = { --- 91,95 ---- }; ! #define LGMI0_ENTRY(name, t, r) { #name, t, offsetof(LOCALGROUP_MEMBERS_INFO_0, lgrmi0_##name), r } // @object PyLOCALGROUP_MEMBERS_INFO_0|A dictionary holding the information in a Win32 LOCALGROUP_MEMBERS_INFO_0 structure. static struct PyNET_STRUCT_ITEM lgmi0[] = { *************** *** 98,102 **** }; ! #define LGMI1_ENTRY(name, t, r) { _T(#name), t, offsetof(LOCALGROUP_MEMBERS_INFO_1, lgrmi1_##name), r } // @object PyLOCALGROUP_MEMBERS_INFO_1|A dictionary holding the information in a Win32 LOCALGROUP_MEMBERS_INFO_1 structure. static struct PyNET_STRUCT_ITEM lgmi1[] = { --- 98,102 ---- }; ! #define LGMI1_ENTRY(name, t, r) { #name, t, offsetof(LOCALGROUP_MEMBERS_INFO_1, lgrmi1_##name), r } // @object PyLOCALGROUP_MEMBERS_INFO_1|A dictionary holding the information in a Win32 LOCALGROUP_MEMBERS_INFO_1 structure. static struct PyNET_STRUCT_ITEM lgmi1[] = { *************** *** 107,111 **** }; ! #define LGMI2_ENTRY(name, t, r) { _T(#name), t, offsetof(LOCALGROUP_MEMBERS_INFO_2, lgrmi2_##name), r } // @object PyLOCALGROUP_MEMBERS_INFO_2|A dictionary holding the information in a Win32 LOCALGROUP_MEMBERS_INFO_2 structure. static struct PyNET_STRUCT_ITEM lgmi2[] = { --- 107,111 ---- }; ! #define LGMI2_ENTRY(name, t, r) { #name, t, offsetof(LOCALGROUP_MEMBERS_INFO_2, lgrmi2_##name), r } // @object PyLOCALGROUP_MEMBERS_INFO_2|A dictionary holding the information in a Win32 LOCALGROUP_MEMBERS_INFO_2 structure. static struct PyNET_STRUCT_ITEM lgmi2[] = { *************** *** 116,120 **** }; ! #define LGMI3_ENTRY(name, t, r) { _T(#name), t, offsetof(LOCALGROUP_MEMBERS_INFO_3, lgrmi3_##name), r } // @object PyLOCALGROUP_MEMBERS_INFO_3|A dictionary holding the information in a Win32 LOCALGROUP_MEMBERS_INFO_3 structure. static struct PyNET_STRUCT_ITEM lgmi3[] = { --- 116,120 ---- }; ! #define LGMI3_ENTRY(name, t, r) { #name, t, offsetof(LOCALGROUP_MEMBERS_INFO_3, lgrmi3_##name), r } // @object PyLOCALGROUP_MEMBERS_INFO_3|A dictionary holding the information in a Win32 LOCALGROUP_MEMBERS_INFO_3 structure. static struct PyNET_STRUCT_ITEM lgmi3[] = { *************** *** 132,137 **** }; ! #define GUI0_ENTRY(name, t, r) { _T(#name), t, offsetof(GROUP_USERS_INFO_0, grui0_##name), r } ! #define GUI1_ENTRY(name, t, r) { _T(#name), t, offsetof(GROUP_USERS_INFO_1, grui1_##name), r } // @object PyGROUP_USERS_INFO_0|A dictionary holding the information in a Win32 GROUP_USERS_INFO_0 structure. static struct PyNET_STRUCT_ITEM gui0[] = { --- 132,137 ---- }; ! #define GUI0_ENTRY(name, t, r) { #name, t, offsetof(GROUP_USERS_INFO_0, grui0_##name), r } ! #define GUI1_ENTRY(name, t, r) { #name, t, offsetof(GROUP_USERS_INFO_1, grui1_##name), r } // @object PyGROUP_USERS_INFO_0|A dictionary holding the information in a Win32 GROUP_USERS_INFO_0 structure. static struct PyNET_STRUCT_ITEM gui0[] = { |
|
From: Mark H. <mha...@us...> - 2009-02-03 04:28:47
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18320/win32/src Modified Files: PyWinTypes.h PyUnicode.cpp Log Message: remove unused PyWin_String_AsWCHAR function Index: PyWinTypes.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypes.h,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** PyWinTypes.h 3 Feb 2009 03:52:29 -0000 1.65 --- PyWinTypes.h 3 Feb 2009 04:28:42 -0000 1.66 *************** *** 359,363 **** PYWINTYPES_EXPORT BOOL PyWin_WCHAR_AsString(WCHAR *input, DWORD inLen, char **pResult); PYWINTYPES_EXPORT BOOL PyWin_Bstr_AsString(BSTR input, char **pResult); - PYWINTYPES_EXPORT BOOL PyWin_String_AsWCHAR(char *input, DWORD inLen, WCHAR **pResult); PYWINTYPES_EXPORT void PyWinObject_FreeString(char *str); --- 359,362 ---- Index: PyUnicode.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyUnicode.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** PyUnicode.cpp 3 Feb 2009 03:52:29 -0000 1.30 --- PyUnicode.cpp 3 Feb 2009 04:28:42 -0000 1.31 *************** *** 176,205 **** } - // Convert a "char *" string to "WCHAR *" - // If len is known, pass it, else -1 - // NOTE - string must be freed with PyWinObject_FreeString - BOOL PyWin_String_AsWCHAR(char *input, DWORD inLen, WCHAR **pResult) - { - if (inLen==(DWORD)-1) - inLen = strlen(input); - inLen += 1; // include NULL term in all ops - /* use MultiByteToWideChar() to see how much we need. */ - /* NOTE: this will include the null-term in the length */ - DWORD cchWideChar = MultiByteToWideChar(CP_ACP, 0, input, inLen, NULL, 0); - // alloc the buffer - *pResult = (WCHAR *)PyMem_Malloc(cchWideChar * sizeof(WCHAR)); - if (*pResult==NULL) { - PyErr_SetString(PyExc_MemoryError, "Not enough memory to allocate wide string buffer."); - return FALSE; - } - /* do the conversion */ - if (0==MultiByteToWideChar(CP_ACP, 0, input, inLen, *pResult, cchWideChar)) { - PyMem_Free(*pResult); - PyWin_SetAPIError("MultiByteToWideChar"); - return FALSE; - } - return TRUE; - } - void PyWinObject_FreeString(char *str) { --- 176,179 ---- |
|
From: Mark H. <mha...@us...> - 2009-02-03 04:28:22
|
Update of /cvsroot/pywin32/pywin32/win32/src/win32net In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18296/win32/src/win32net Modified Files: win32netmisc.cpp Log Message: fix unicode arg handling of NetShareEnum Index: win32netmisc.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32net/win32netmisc.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** win32netmisc.cpp 3 Jan 2009 06:43:59 -0000 1.15 --- win32netmisc.cpp 3 Feb 2009 04:28:18 -0000 1.16 *************** *** 349,362 **** PyNetShareEnum(PyObject *self, PyObject *args) { ! LPSTR szServerName; // @pyparmalt1 string|serverName||The name of the server on which the call should execute, or None for the local computer. // @comm If the old style is used, the result is a list of [(shareName, type, remarks), ...] ! if (PyArg_ParseTuple(args, "z:NetShareEnum",&szServerName)) { ! WCHAR *wServerName = NULL; ! if (szServerName && !PyWin_String_AsWCHAR(szServerName, -1, &wServerName)) return NULL; PyObject *ret = PyNetShareEnum1(wServerName); ! if (wServerName) ! PyWinObject_FreeString(wServerName); return ret; } --- 349,361 ---- PyNetShareEnum(PyObject *self, PyObject *args) { ! PyObject *obServerName; // @pyparmalt1 string|serverName||The name of the server on which the call should execute, or None for the local computer. // @comm If the old style is used, the result is a list of [(shareName, type, remarks), ...] ! if (PyArg_ParseTuple(args, "O:NetShareEnum",&obServerName)) { ! WCHAR *wServerName; ! if (!PyWinObject_AsWCHAR(obServerName, &wServerName, TRUE)) return NULL; PyObject *ret = PyNetShareEnum1(wServerName); ! PyWinObject_FreeWCHAR(wServerName); return ret; } |
|
From: Mark H. <mha...@us...> - 2009-02-03 04:27:51
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src/extensions In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18193/com/win32com/src/extensions Modified Files: PyICatRegister.cpp Log Message: Correct unicode conversion of category descriptions and fix some 64bit Py_ssizt_t warnings. Index: PyICatRegister.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/extensions/PyICatRegister.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PyICatRegister.cpp 2 Dec 2003 00:15:15 -0000 1.5 --- PyICatRegister.cpp 3 Feb 2009 04:27:40 -0000 1.6 *************** *** 21,28 **** return FALSE; } ! int len = PyObject_Length(obCatIds); CATID *ids = new CATID[len]; BOOL rc = TRUE; ! for (int i=0;rc && i<len;i++) { PyObject *obThis = PySequence_GetItem(obCatIds, i); if (obThis==NULL) { --- 21,28 ---- return FALSE; } ! Py_ssize_t len = PyObject_Length(obCatIds); CATID *ids = new CATID[len]; BOOL rc = TRUE; ! for (Py_ssize_t i=0;rc && i<len;i++) { PyObject *obThis = PySequence_GetItem(obCatIds, i); if (obThis==NULL) { *************** *** 38,42 **** if (rc) { *ppCatIds = ids; ! *pNumIds = len; } else { delete [] ids; --- 38,42 ---- if (rc) { *ppCatIds = ids; ! *pNumIds = PyWin_SAFE_DOWNCAST(len, Py_ssize_t, UINT); } else { delete [] ids; *************** *** 80,84 **** return NULL; } ! int noInfos = PyObject_Length(obCatList); CATEGORYINFO *infos = new CATEGORYINFO [noInfos]; if (infos==NULL) { --- 80,84 ---- return NULL; } ! Py_ssize_t noInfos = PyObject_Length(obCatList); CATEGORYINFO *infos = new CATEGORYINFO [noInfos]; if (infos==NULL) { *************** *** 86,97 **** return NULL; } ! for (int i=0;i<noInfos;i++) { PyObject *obCatId; - char *desc; PyObject *obThis = PySequence_GetItem(obCatList, i); if (obThis==NULL) return NULL; BOOL ok = TRUE; ! int descLen; ! if (!PyArg_ParseTuple(obThis, "Ols#", &obCatId, (long *)&infos[i].lcid, &desc, &descLen)) { Py_DECREF(obThis); PyErr_SetString(PyExc_TypeError, "Category infos must be CATID, lcid, description"); --- 86,96 ---- return NULL; } ! for (Py_ssize_t i=0;i<noInfos;i++) { PyObject *obCatId; PyObject *obThis = PySequence_GetItem(obCatList, i); if (obThis==NULL) return NULL; BOOL ok = TRUE; ! PyObject *obDesc; ! if (!PyArg_ParseTuple(obThis, "OlO", &obCatId, (long *)&infos[i].lcid, &obDesc)) { Py_DECREF(obThis); PyErr_SetString(PyExc_TypeError, "Category infos must be CATID, lcid, description"); *************** *** 99,119 **** return NULL; } if (!PyWinObject_AsIID(obCatId, &infos[i].catid)) { - Py_DECREF(obThis); - PyErr_SetString(PyExc_TypeError, "CATID is not valid"); delete [] infos; return NULL; } - Py_DECREF(obThis); OLECHAR *oc; ! if (PyWin_String_AsWCHAR(desc, (DWORD)-1, &oc)) { ! wcsncpy(infos[i].szDescription, oc, ! sizeof(infos->szDescription)/sizeof(infos->szDescription[0])); ! PyWinObject_FreeString(oc); } } PY_INTERFACE_PRECALL; ! HRESULT hr = pICR->RegisterCategories(noInfos, infos); PY_INTERFACE_POSTCALL; delete [] infos; --- 98,119 ---- return NULL; } + Py_DECREF(obThis); if (!PyWinObject_AsIID(obCatId, &infos[i].catid)) { delete [] infos; return NULL; } OLECHAR *oc; ! if (!PyWinObject_AsWCHAR(obDesc, &oc, FALSE)) { ! delete [] infos; ! return NULL; } + wcsncpy(infos[i].szDescription, oc, + sizeof(infos->szDescription)/sizeof(infos->szDescription[0])); + PyWinObject_FreeWCHAR(oc); } PY_INTERFACE_PRECALL; ! HRESULT hr = pICR->RegisterCategories(PyWin_SAFE_DOWNCAST(noInfos, Py_ssize_t, ULONG), ! infos); PY_INTERFACE_POSTCALL; delete [] infos; |
|
From: Mark H. <mha...@us...> - 2009-02-03 03:52:32
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13276/com/win32com/src Modified Files: ErrorUtils.cpp Log Message: make PyWin_String_AsBstr a private function in the 1 place its used Index: ErrorUtils.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/ErrorUtils.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** ErrorUtils.cpp 26 Nov 2008 01:18:31 -0000 1.32 --- ErrorUtils.cpp 3 Feb 2009 03:52:29 -0000 1.33 *************** *** 25,28 **** --- 25,57 ---- PYCOM_EXPORT void PyCom_StreamMessage(const char *msg); + // Private helper to convert a "char *" to a BSTR for use in the error + // structures. + BSTR PyWin_String_AsBstr(const char *value) + { + if (value==NULL || *value=='\0') + return SysAllocStringLen(L"", 0); + /* use MultiByteToWideChar() as a "good" strlen() */ + /* NOTE: this will include the null-term in the length */ + int cchWideChar = MultiByteToWideChar(CP_ACP, 0, value, -1, NULL, 0); + + /* alloc a temporary conversion buffer, but dont use alloca, as super + large strings will blow our stack */ + LPWSTR wstr = (LPWSTR)malloc(cchWideChar * sizeof(WCHAR)); + if (wstr==NULL) { + PyErr_SetString(PyExc_MemoryError, "Not enough memory to allocate wide string buffer."); + return NULL; + } + + /* convert the input into the temporary buffer */ + MultiByteToWideChar(CP_ACP, 0, value, -1, wstr, cchWideChar); + + /* don't place the null-term into the BSTR */ + BSTR ret = SysAllocStringLen(wstr, cchWideChar - 1); + if (ret==NULL) + PyErr_SetString(PyExc_MemoryError, "allocating BSTR"); + free(wstr); + return ret; + } + //////////////////////////////////////////////////////////////////////// // |
|
From: Mark H. <mha...@us...> - 2009-02-03 03:52:32
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13276/win32/src Modified Files: PyWinTypes.h PyUnicode.cpp Log Message: make PyWin_String_AsBstr a private function in the 1 place its used Index: PyWinTypes.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypes.h,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** PyWinTypes.h 3 Feb 2009 03:47:01 -0000 1.64 --- PyWinTypes.h 3 Feb 2009 03:52:29 -0000 1.65 *************** *** 241,247 **** PYWINTYPES_EXPORT PyObject *PyWinObject_FromBstr(const BSTR bstr, BOOL takeOwnership=FALSE); - // Convert a "char *" to a BSTR - free via ::SysFreeString() - PYWINTYPES_EXPORT BSTR PyWin_String_AsBstr(const char *str); - // Given a string or Unicode object, get WCHAR characters. PYWINTYPES_EXPORT BOOL PyWinObject_AsWCHAR(PyObject *stringObject, WCHAR **pResult, BOOL bNoneOK = FALSE, DWORD *pResultLen = NULL); --- 241,244 ---- Index: PyUnicode.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyUnicode.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** PyUnicode.cpp 3 Feb 2009 03:47:01 -0000 1.29 --- PyUnicode.cpp 3 Feb 2009 03:52:29 -0000 1.30 *************** *** 211,242 **** } - // Convert a "char *" to a BSTR - free via ::SysFreeString() - BSTR PyWin_String_AsBstr(const char *value) - { - if (value==NULL || *value=='\0') - return SysAllocStringLen(L"", 0); - /* use MultiByteToWideChar() as a "good" strlen() */ - /* NOTE: this will include the null-term in the length */ - int cchWideChar = MultiByteToWideChar(CP_ACP, 0, value, -1, NULL, 0); - - /* alloc a temporary conversion buffer, but dont use alloca, as super - large strings will blow our stack */ - LPWSTR wstr = (LPWSTR)malloc(cchWideChar * sizeof(WCHAR)); - if (wstr==NULL) { - PyErr_SetString(PyExc_MemoryError, "Not enough memory to allocate wide string buffer."); - return NULL; - } - - /* convert the input into the temporary buffer */ - MultiByteToWideChar(CP_ACP, 0, value, -1, wstr, cchWideChar); - - /* don't place the null-term into the BSTR */ - BSTR ret = SysAllocStringLen(wstr, cchWideChar - 1); - if (ret==NULL) - PyErr_SetString(PyExc_MemoryError, "allocating BSTR"); - free(wstr); - return ret; - } - // Size info is available (eg, a fn returns a string and also fills in a size variable) PyObject *PyWinObject_FromOLECHAR(const OLECHAR * str, int numChars) --- 211,214 ---- |
|
From: Mark H. <mha...@us...> - 2009-02-03 03:47:04
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12905 Modified Files: PyWinTypes.h PyUnicode.cpp Log Message: un-inline some of the new unicode helpers and remove PyUnicodeObject_FromString completely. Index: PyWinTypes.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypes.h,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** PyWinTypes.h 1 Feb 2009 17:26:47 -0000 1.63 --- PyWinTypes.h 3 Feb 2009 03:47:01 -0000 1.64 *************** *** 303,328 **** // that always returns a unicode object (ie, most of the "PyWinObject_From*CHAR" // functions) ! // XXX - move these from being inlines... ! inline PyObject *PyWinCoreString_FromString(const char *str, Py_ssize_t len=(Py_ssize_t)-1) ! { ! if (len==(Py_ssize_t)-1) ! len = strlen(str); ! #if (PY_VERSION_HEX < 0x03000000) ! return PyString_FromStringAndSize(str, len); ! #else ! return PyUnicode_DecodeMBCS(str, len, "ignore"); ! #endif ! } ! ! inline PyObject *PyWinCoreString_FromString(const WCHAR *str, Py_ssize_t len=(Py_ssize_t)-1) ! { ! if (len==(Py_ssize_t)-1) ! len = wcslen(str); ! #if (PY_VERSION_HEX < 0x03000000) ! return PyUnicode_EncodeMBCS(str, len, "ignore"); ! #else ! return PyUnicode_FromWideChar(str, len); ! #endif ! } #define PyWinObject_FromWCHAR PyWinObject_FromOLECHAR --- 303,308 ---- // that always returns a unicode object (ie, most of the "PyWinObject_From*CHAR" // functions) ! PYWINTYPES_EXPORT PyObject *PyWinCoreString_FromString(const char *str, Py_ssize_t len=(Py_ssize_t)-1); ! PYWINTYPES_EXPORT PyObject *PyWinCoreString_FromString(const WCHAR *str, Py_ssize_t len=(Py_ssize_t)-1); #define PyWinObject_FromWCHAR PyWinObject_FromOLECHAR *************** *** 349,353 **** PYWINTYPES_EXPORT BOOL PyWinObject_AsCharArray(PyObject *str_seq, char ***pchars, DWORD *str_cnt, BOOL bNoneOK = FALSE); - PYWINTYPES_EXPORT PyObject *PyUnicodeObject_FromString(const char *string, Py_ssize_t len=(Py_ssize_t)-1); PYWINTYPES_EXPORT PyObject *PyWinObject_FromOLECHAR(const OLECHAR * str); PYWINTYPES_EXPORT PyObject *PyWinObject_FromOLECHAR(const OLECHAR * str, int numChars); --- 329,332 ---- *************** *** 370,392 **** #define PyWinObject_FreeTCHAR PyWinObject_FreeString - inline PyObject *PyWinObject_FromTCHAR(const char *str, Py_ssize_t len=(Py_ssize_t)-1) - { - if (str==NULL) { - Py_INCREF(Py_None); - return Py_None; - } // PyWinObject_FromTCHAR in a non-unicode build still depends on py3k or not: // py2x a string object is returned (no conversions). py3x a unicode object // is returned (ie, the string is decoded) ! #if (PY_VERSION_HEX < 0x03000000) ! if (len==(Py_ssize_t)-1) ! return PyString_FromString(str); ! else ! return PyString_FromStringAndSize(str, len); ! #else ! return PyUnicodeObject_FromString(str, len); ! #endif ! } ! #endif // String support for buffers allocated via CoTaskMemAlloc and CoTaskMemFree --- 349,358 ---- #define PyWinObject_FreeTCHAR PyWinObject_FreeString // PyWinObject_FromTCHAR in a non-unicode build still depends on py3k or not: // py2x a string object is returned (no conversions). py3x a unicode object // is returned (ie, the string is decoded) ! PYWINTYPES_EXPORT PyObject *PyWinObject_FromTCHAR(const char *str, Py_ssize_t len=(Py_ssize_t)-1); ! ! #endif // UNICODE // String support for buffers allocated via CoTaskMemAlloc and CoTaskMemFree Index: PyUnicode.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyUnicode.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** PyUnicode.cpp 13 Nov 2008 04:04:51 -0000 1.28 --- PyUnicode.cpp 3 Feb 2009 03:47:01 -0000 1.29 *************** *** 81,93 **** /* Implement our Windows Unicode API using the Python widestring object */ ! PyObject *PyUnicodeObject_FromString(const char *string, Py_ssize_t len /* = -1 */) { ! if (string==NULL) { Py_INCREF(Py_None); return Py_None; } if (len==(Py_ssize_t)-1) ! len = strlen(string); ! return (PyObject *)PyUnicode_DecodeMBCS(string, len, NULL); } --- 81,123 ---- /* Implement our Windows Unicode API using the Python widestring object */ ! ! // non-unicode version of PyWinObject_FromTCHAR; returned object depends on ! // if we are running py3k or not. ! PyObject *PyWinObject_FromTCHAR(const char *str, Py_ssize_t len /*=(Py_ssize_t)-1*/) { ! if (str==NULL) { Py_INCREF(Py_None); return Py_None; } if (len==(Py_ssize_t)-1) ! len = strlen(str); ! #if (PY_VERSION_HEX < 0x03000000) ! return PyString_FromStringAndSize(str, len); ! #else ! // py3k - decode char * via mbcs encoding. ! return (PyObject *)PyUnicode_DecodeMBCS(str, len, NULL); ! #endif ! } ! ! PyObject *PyWinCoreString_FromString(const char *str, Py_ssize_t len /*=(Py_ssize_t)-1*/) ! { ! if (len==(Py_ssize_t)-1) ! len = strlen(str); ! #if (PY_VERSION_HEX < 0x03000000) ! return PyString_FromStringAndSize(str, len); ! #else ! return PyUnicode_DecodeMBCS(str, len, "ignore"); ! #endif ! } ! ! PyObject *PyWinCoreString_FromString(const WCHAR *str, Py_ssize_t len /*=(Py_ssize_t)-1*/) ! { ! if (len==(Py_ssize_t)-1) ! len = wcslen(str); ! #if (PY_VERSION_HEX < 0x03000000) ! return PyUnicode_EncodeMBCS(str, len, "ignore"); ! #else ! return PyUnicode_FromWideChar(str, len); ! #endif } |
|
From: Mark H. <mha...@us...> - 2009-02-03 03:23:19
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11302/win32/src Modified Files: win32gui.i Log Message: remove long obsolete Unicode() function from pythoncom and win32gui Index: win32gui.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32gui.i,v retrieving revision 1.124 retrieving revision 1.125 diff -C2 -d -r1.124 -r1.125 *** win32gui.i 30 Jan 2009 23:29:00 -0000 1.124 --- win32gui.i 3 Feb 2009 03:23:07 -0000 1.125 *************** *** 3375,3392 **** UINT remove); // @pyparm int|removalOptions|| - // DELETE ME! - %{ - static PyObject *Unicode(PyObject *self, PyObject *args) - { - char *text; - #if PY_VERSION_HEX > 0x2030300 - PyErr_Warn(PyExc_PendingDeprecationWarning, "win32gui.Unicode will die!"); - #endif - if (!PyArg_ParseTuple(args, "s", &text)) - return NULL; - return PyUnicodeObject_FromString(text); - } - %} - %native (Unicode) Unicode; %{ --- 3375,3378 ---- |
|
From: Mark H. <mha...@us...> - 2009-02-03 03:23:11
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11302/com/win32com/src Modified Files: PythonCOM.cpp Log Message: remove long obsolete Unicode() function from pythoncom and win32gui Index: PythonCOM.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PythonCOM.cpp,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** PythonCOM.cpp 2 Feb 2009 19:30:31 -0000 1.58 --- PythonCOM.cpp 3 Feb 2009 03:23:07 -0000 1.59 *************** *** 750,754 **** } ! // no autoduct - this is deprecated. static PyObject *pythoncom_MakeTime(PyObject *self, PyObject *args) { --- 750,754 ---- } ! // no autoduck - this is deprecated. static PyObject *pythoncom_MakeTime(PyObject *self, PyObject *args) { *************** *** 757,772 **** } - // @pymethod <o PyUnicode>|pythoncom|Unicode|Converts a string into a <o PyUnicode> object. - static PyObject *pythoncom_Unicode(PyObject *self, PyObject *args) - { - const char *s; - - // @pyparm string|s||The string to convert into a Unicode object - if ( !PyArg_ParseTuple(args, "s:Unicode", &s)) - return NULL; - return PyUnicodeObject_FromString(s); - // @comm As Python itself becomes Unicode aware, this function will not be necessary. - } - #ifndef MS_WINCE // @pymethod <o PyIMoniker>,int,<o PyIBindCtx>|pythoncom|MkParseDisplayName|Parses a moniker display name into a moniker object. The inverse of <om PyIMoniker.GetDisplayName> --- 757,760 ---- *************** *** 1983,1987 **** { "WriteClassStm", pythoncom_WriteClassStm, 1}, // @pymeth WriteClassStm|Sets the CLSID of a stream { "UnwrapObject", pythoncom_UnwrapObject, 1 }, // @pymeth UnwrapObject|Unwraps a Python instance in a gateway object. - { "Unicode", pythoncom_Unicode, 1 }, // @pymeth Unicode|Converts a string into a <o PyUnicode> object. { "FmtIdToPropStgName", pythoncom_FmtIdToPropStgName, 1}, //@pymeth FmtIdToPropStgName|Convert a FMTID to its stream name { "PropStgNameToFmtId", pythoncom_PropStgNameToFmtId, 1}, //@pymeth PropStgNameToFmtId|Convert property set name to FMTID --- 1971,1974 ---- |
|
From: Mark H. <mha...@us...> - 2009-02-03 03:23:11
|
Update of /cvsroot/pywin32/pywin32/com/win32com/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11302/com/win32com/test Modified Files: testvb.py Log Message: remove long obsolete Unicode() function from pythoncom and win32gui Index: testvb.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testvb.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** testvb.py 7 Jan 2009 06:03:29 -0000 1.26 --- testvb.py 3 Feb 2009 03:23:07 -0000 1.27 *************** *** 305,309 **** # This time, instead of an explicit str() for 1.5, we just # pass Unicode, so the result should compare equal ! testData = [1, 2.0, pythoncom.Unicode("3")] resultData, byRefParam = vbtest.PassSAFEARRAYVariant(testData) assert testData == list(byRefParam) --- 305,309 ---- # This time, instead of an explicit str() for 1.5, we just # pass Unicode, so the result should compare equal ! testData = [1, 2.0, u"3"] resultData, byRefParam = vbtest.PassSAFEARRAYVariant(testData) assert testData == list(byRefParam) |
|
From: Mark H. <mha...@us...> - 2009-02-03 03:20:24
|
Update of /cvsroot/pywin32/pywin32/win32/help In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11097/win32/help Modified Files: py3k.html Log Message: update state of py3k work Index: py3k.html =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/help/py3k.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** py3k.html 31 Jan 2009 05:50:41 -0000 1.2 --- py3k.html 3 Feb 2009 03:20:20 -0000 1.3 *************** *** 12,20 **** </p> <h1>Unicode everywhere</h1> <p> ! In general, pywin32 on Python 2.x will accept both str and unicode ! objects and convert as appropriate. In Python 3.x byte() objects ! are generally not accepted; strings must be unicode. </p> <p> --- 12,29 ---- </p> + <p> + <strong>Important:</strong> This py3k support is experimental and + things are subject to change. In particular, we may occasionally + accept 'insane' args, such as accepting bytes when only a unicode + string object makes sense etc. We reserve the right to cleanup any + such issues that may arise in a backwards incompatible manner. + </p> + <h1>Unicode everywhere</h1> <p> ! In general, pywin32 on both Python 2.x and 3.x will accept both str ! and unicode objects and convert as appropriate. In py3k, bytes objects ! which need to be converted to str (unicode) are still decoded as ! 'mbcs' rather than the python default encoding. </p> <p> *************** *** 22,25 **** --- 31,57 ---- thus will call the Unicode versions of the Windows API. </p> + <h1>Specific module notes</h1> + <h2>isapi</h2> + <p> + The isapi package supports py3k, but note that currently only the + <code>redirector.py</code> sample has been converted to work in + both environments - in particular, subtle urllib changes will + probably require attention - see the redirector sample for details. + </p> + <p> + Note that ISAPI itself is a narrow-character based API. As a result, + functions such as + <a href="EXTENSION_CONTROL_BLOCK__GetServerVariable_meth.html">GetServerVariable()</a> + etc all return bytes objects - it is up to the application to + interpret those bytes. pywin32 detects server variables starting + with UNICODE_ and does return unicode objects in that case - see + the IIS documentation for more details. + </p> + <p>If you pass a unicode object to the ISAPI functions, it will be + automatically encoded using the default encoding rather than the + 'mbcs' encoding used by the rest of pywin32. In general this should + be avoided as IIS doesn't define an encoding. + </p> + <h1>datetime objects</h1> <p> *************** *** 34,37 **** --- 66,77 ---- </p> <p> + Note that it is possible we will support "time zone naive" objects + in the future, as supporting such objects in the future will be fully + backwards compatible. However, it is not yet clear that supporting + such objects is helpful due to the ambiguities that may arise, and + attempting to remove such support in the future would cause more + problems than enabling it. + </p> + <p> The <a href="win32timezone__now_meth.html">win32timezone.now</a> and <a href="win32timezone__utcnow_meth.html">win32timezone.utcnow</a> methods |
|
From: Mark H. <mha...@us...> - 2009-02-03 00:52:36
|
Update of /cvsroot/pywin32/pywin32/isapi/samples In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv25911/samples Modified Files: redirector.py Log Message: make one of the isapi samples py3k-friendly Index: redirector.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/samples/redirector.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** redirector.py 1 Jan 2009 22:38:46 -0000 1.4 --- redirector.py 3 Feb 2009 00:52:28 -0000 1.5 *************** *** 20,24 **** import sys import traceback ! import urllib import win32api --- 20,28 ---- import sys import traceback ! try: ! from urllib import urlopen ! except ImportError: ! # py3k spelling... ! from urllib.request import urlopen import win32api *************** *** 52,62 **** # That is perfect for this sample, so we don't catch our own. #print 'IIS dispatching "%s"' % (ecb.GetServerVariable("URL"),) ! url = ecb.GetServerVariable("URL") ! if ecb.Version < 0x60000: ! print "IIS5 or earlier - can't do 'excludes'" ! else: ! for exclude in excludes: ! if url.lower().startswith(exclude): ! print "excluding %s" % url ecb.IOCompletion(io_callback, url) ecb.ExecURL(None, None, None, None, None, isapicon.HSE_EXEC_URL_IGNORE_CURRENT_INTERCEPTOR) --- 56,66 ---- # That is perfect for this sample, so we don't catch our own. #print 'IIS dispatching "%s"' % (ecb.GetServerVariable("URL"),) ! url = ecb.GetServerVariable("URL").decode("ascii") ! for exclude in excludes: ! if url.lower().startswith(exclude): ! print "excluding %s" % url ! if ecb.Version < 0x60000: ! print "(but this is IIS5 or earlier - can't do 'excludes')" ! else: ecb.IOCompletion(io_callback, url) ecb.ExecURL(None, None, None, None, None, isapicon.HSE_EXEC_URL_IGNORE_CURRENT_INTERCEPTOR) *************** *** 65,74 **** new_url = proxy + url print "Opening %s" % new_url ! fp = urllib.urlopen(new_url) headers = fp.info() ! ecb.SendResponseHeaders("200 OK", str(headers) + "\r\n", False) ecb.WriteClient(fp.read()) ecb.DoneWithSession() ! print "Returned data from '%s'!" % (new_url,) return isapicon.HSE_STATUS_SUCCESS --- 69,87 ---- new_url = proxy + url print "Opening %s" % new_url ! fp = urlopen(new_url) headers = fp.info() ! # subtle py3k breakage: in py3k, str(headers) has normalized \r\n ! # back to \n and also stuck an extra \n term. py2k leaves the ! # \r\n from the server in tact and finishes with a single term. ! if sys.version_info < (3,0): ! header_text = str(headers) + "\r\n" ! else: ! # take *all* trailing \n off, replace remaining with ! # \r\n, then add the 2 trailing \r\n. ! header_text = str(headers).rstrip('\n').replace('\n', '\r\n') + '\r\n\r\n' ! ecb.SendResponseHeaders("200 OK", header_text, False) ecb.WriteClient(fp.read()) ecb.DoneWithSession() ! print "Returned data from '%s'" % (new_url,) return isapicon.HSE_STATUS_SUCCESS |
|
From: Mark H. <mha...@us...> - 2009-02-03 00:51:47
|
Update of /cvsroot/pywin32/pywin32 In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv25746 Modified Files: setup.py Log Message: make isapi sources py3k-friendly Index: setup.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup.py,v retrieving revision 1.98 retrieving revision 1.99 diff -C2 -d -r1.98 -r1.99 *** setup.py 2 Feb 2009 19:39:10 -0000 1.98 --- setup.py 3 Feb 2009 00:51:42 -0000 1.99 *************** *** 2021,2025 **** if is_py3k: py3k_skip_modules = \ ! """adsi mapi isapi PyISAPI_loader""".split() ext_modules = [e for e in ext_modules if e.name not in py3k_skip_modules] --- 2021,2025 ---- if is_py3k: py3k_skip_modules = \ ! """adsi mapi""".split() ext_modules = [e for e in ext_modules if e.name not in py3k_skip_modules] |
|
From: Mark H. <mha...@us...> - 2009-02-03 00:51:47
|
Update of /cvsroot/pywin32/pywin32/isapi/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv25746/isapi/src Modified Files: ControlBlock.h FilterContext.h PyExtensionObjects.cpp PyExtensionObjects.h PyFilterObjects.cpp PyFilterObjects.h PythonEng.cpp PythonEng.h StdAfx.h Utils.cpp Utils.h pyISAPI.cpp Log Message: make isapi sources py3k-friendly Index: ControlBlock.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/ControlBlock.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ControlBlock.h 15 May 2008 10:57:09 -0000 1.6 --- ControlBlock.h 3 Feb 2009 00:51:42 -0000 1.7 *************** *** 34,43 **** ! void SetLogMessage(LPCTSTR msg) { strncpy(m_pECB->lpszLogData, msg, HSE_LOG_BUFFER_LEN); } ! DWORD WriteStream(LPCTSTR buffer, const int buffLen, const int reserved=0) { DWORD dwBufLen = buffLen; --- 34,43 ---- ! void SetLogMessage(const char *msg) { strncpy(m_pECB->lpszLogData, msg, HSE_LOG_BUFFER_LEN); } ! DWORD WriteStream(char *buffer, const int buffLen, const int reserved=0) { DWORD dwBufLen = buffLen; *************** *** 45,49 **** return dwBufLen; } ! BOOL WriteClient(LPCTSTR buffer, DWORD *buffLen, const int reserved = 0) { return m_pECB->WriteClient(m_pECB->ConnID, (void *) buffer, buffLen, reserved); --- 45,49 ---- return dwBufLen; } ! BOOL WriteClient(char *buffer, DWORD *buffLen, const int reserved = 0) { return m_pECB->WriteClient(m_pECB->ConnID, (void *) buffer, buffLen, reserved); *************** *** 63,69 **** } ! bool GetServerVariable(LPCTSTR varName, LPSTR lpBuff, DWORD *pBuffSize) { ! BOOL bOK = m_pECB->GetServerVariable(m_pECB->ConnID,(LPSTR) varName,lpBuff,pBuffSize); if (!bOK) *pBuffSize = 0; --- 63,69 ---- } ! bool GetServerVariable(char *varName, LPSTR lpBuff, DWORD *pBuffSize) { ! BOOL bOK = m_pECB->GetServerVariable(m_pECB->ConnID, varName, lpBuff, pBuffSize); if (!bOK) *pBuffSize = 0; *************** *** 86,97 **** } ! BOOL Redirect(LPCTSTR url) { ! DWORD buffSize = strlen(url); ! BOOL bOK = (m_pECB->ServerSupportFunction)( m_pECB->ConnID, HSE_REQ_SEND_URL_REDIRECT_RESP, (LPSTR) url, &buffSize,0); return bOK; } ! BOOL MapURLToPath(LPCTSTR buffer, LPDWORD pSizeofBuffer) { BOOL bOK = (m_pECB->ServerSupportFunction)(m_pECB->ConnID, --- 86,97 ---- } ! BOOL Redirect(char *url) { ! DWORD buffSize = (DWORD)strlen(url); ! BOOL bOK = (m_pECB->ServerSupportFunction)( m_pECB->ConnID, HSE_REQ_SEND_URL_REDIRECT_RESP, url, &buffSize,0); return bOK; } ! BOOL MapURLToPath(char *buffer, LPDWORD pSizeofBuffer) { BOOL bOK = (m_pECB->ServerSupportFunction)(m_pECB->ConnID, *************** *** 115,119 **** DWORD bufsize = sizeof(buf)/sizeof(buf[0]); if (GetServerVariable("HTTP_CONNECTION",buf, &bufsize)){ ! bKeepAlive = strcmpi(buf, "keep-alive")==0; } return bKeepAlive; --- 115,119 ---- DWORD bufsize = sizeof(buf)/sizeof(buf[0]); if (GetServerVariable("HTTP_CONNECTION",buf, &bufsize)){ ! bKeepAlive = _strcmpi(buf, "keep-alive")==0; } return bKeepAlive; Index: PyFilterObjects.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/PyFilterObjects.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PyFilterObjects.h 3 Jan 2009 06:11:46 -0000 1.8 --- PyFilterObjects.h 3 Feb 2009 00:51:42 -0000 1.9 *************** *** 40,45 **** // Python support static void deallocFunc(PyObject *ob); ! static PyObject *getattr(PyObject *self, char *name); ! static int setattr(PyObject *self, char *name, PyObject *v); }; --- 40,45 ---- // Python support static void deallocFunc(PyObject *ob); ! static PyObject *getattro(PyObject *self, PyObject *ob); ! static int setattro(PyObject *self, PyObject *obname, PyObject *v); }; *************** *** 56,61 **** // Python support static void deallocFunc(PyObject *ob); ! static PyObject *getattr(PyObject *self, char *name); ! static int setattr(PyObject *self, char *name, PyObject *v); // class methods --- 56,61 ---- // Python support static void deallocFunc(PyObject *ob); ! static PyObject *getattro(PyObject *self, PyObject *obname); ! static int setattro(PyObject *self, PyObject *obname, PyObject *v); // class methods *************** *** 67,77 **** static PyObject * SendResponseHeader(PyObject *self, PyObject *args); static PyObject * DisableNotifications(PyObject *self, PyObject *args); protected: - #pragma warning( disable : 4251 ) - static struct memberlist PyHFC_memberlist[]; - #pragma warning( default : 4251 ) - DWORD m_notificationType; DWORD m_revision; --- 67,74 ---- static PyObject * SendResponseHeader(PyObject *self, PyObject *args); static PyObject * DisableNotifications(PyObject *self, PyObject *args); + static struct PyMemberDef members[]; protected: DWORD m_notificationType; DWORD m_revision; *************** *** 90,95 **** // Python support static void deallocFunc(PyObject *ob); ! static PyObject *getattr(PyObject *self, char *name); ! static int setattr(PyObject *self, char *name, PyObject *v); }; --- 87,92 ---- // Python support static void deallocFunc(PyObject *ob); ! static PyObject *getattro(PyObject *self, PyObject *obname); ! static int setattro(PyObject *self, PyObject *obname, PyObject *v); }; *************** *** 106,111 **** // Python support static void deallocFunc(PyObject *ob); - static PyObject *getattr(PyObject *self, char *name); - static int setattr(PyObject *self, char *name, PyObject *v); }; --- 103,106 ---- *************** *** 122,127 **** // Python support static void deallocFunc(PyObject *ob); ! static PyObject *getattr(PyObject *self, char *name); ! static int setattr(PyObject *self, char *name, PyObject *v); }; --- 117,122 ---- // Python support static void deallocFunc(PyObject *ob); ! static PyObject *getattro(PyObject *self, PyObject *obname); ! static int setattro(PyObject *self, PyObject *obname, PyObject *v); }; *************** *** 138,143 **** // Python support static void deallocFunc(PyObject *ob); ! static PyObject *getattr(PyObject *self, char *name); ! static int setattr(PyObject *self, char *name, PyObject *v); }; --- 133,138 ---- // Python support static void deallocFunc(PyObject *ob); ! static PyObject *getattro(PyObject *self, PyObject *obname); ! static int setattro(PyObject *self, PyObject *obname, PyObject *v); }; *************** *** 153,158 **** // Python support static void deallocFunc(PyObject *ob); ! static PyObject *getattr(PyObject *self, char *name); ! static int setattr(PyObject *self, char *name, PyObject *v); }; --- 148,153 ---- // Python support static void deallocFunc(PyObject *ob); ! static PyObject *getattro(PyObject *self, PyObject *obname); ! static int setattro(PyObject *self, PyObject *obname, PyObject *v); }; Index: Utils.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/Utils.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Utils.h 17 Jan 2007 04:40:12 -0000 1.2 --- Utils.h 3 Feb 2009 00:51:42 -0000 1.3 *************** *** 53,60 **** // Dump out an HTML error response page ! char *HTMLErrorResp(LPCTSTR msg); // returns the pathname of this module ! char *GetModulePath(void); // Write entry to the event log --- 53,60 ---- // Dump out an HTML error response page ! char *HTMLErrorResp(const char *msg); // returns the pathname of this module ! TCHAR *GetModulePath(void); // Write entry to the event log Index: pyISAPI.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/pyISAPI.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pyISAPI.cpp 17 Jan 2007 04:36:54 -0000 1.8 --- pyISAPI.cpp 3 Feb 2009 00:51:42 -0000 1.9 *************** *** 50,54 **** char g_CallbackModuleName[_MAX_PATH + _MAX_FNAME] = ""; ! #define TRACE OutputDebugString // This is an entry point for py2exe. --- 50,54 ---- char g_CallbackModuleName[_MAX_PATH + _MAX_FNAME] = ""; ! #define TRACE(x) OutputDebugString(_T(x)) // This is an entry point for py2exe. *************** *** 56,60 **** { strncpy(g_CallbackModuleName, modname, ! sizeof(g_CallbackModuleName)/sizeof(g_CallbackModuleName[0])); // cast BOOL->bool without compiler warning! g_IsFrozen = is_frozen ? TRUE : FALSE; --- 56,60 ---- { strncpy(g_CallbackModuleName, modname, ! sizeof(g_CallbackModuleName)/sizeof(g_CallbackModuleName[0])); // cast BOOL->bool without compiler warning! g_IsFrozen = is_frozen ? TRUE : FALSE; Index: PythonEng.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/PythonEng.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PythonEng.cpp 15 May 2008 10:57:09 -0000 1.6 --- PythonEng.cpp 3 Feb 2009 00:51:42 -0000 1.7 *************** *** 38,41 **** --- 38,44 ---- extern char g_CallbackModuleName[_MAX_PATH + _MAX_FNAME]; + extern void InitExtensionTypes(); + extern void InitFilterTypes(); + ///////////////////////////////////////////////////////////////////// // Python Engine *************** *** 71,75 **** if (!g_IsFrozen) { ! char *dll_path = GetModulePath(); AddToPythonPath(dll_path); free(dll_path); --- 74,78 ---- if (!g_IsFrozen) { ! TCHAR *dll_path = GetModulePath(); AddToPythonPath(dll_path); free(dll_path); *************** *** 88,91 **** --- 91,99 ---- "InternalReloadException"); Py_XDECREF(isapi_package); + + // ready our types. + InitExtensionTypes(); + InitFilterTypes(); + PyGILState_Release(old_state); FindModuleName(); *************** *** 97,103 **** void CPythonEngine::FindModuleName() { ! TCHAR szFilePath[_MAX_PATH]; ! TCHAR szBase[_MAX_FNAME]; ! TCHAR *module_name; // If a name for the module has been magically setup (eg, via a frozen --- 105,111 ---- void CPythonEngine::FindModuleName() { ! char szFilePath[_MAX_PATH]; ! char szBase[_MAX_FNAME]; ! char *module_name; // If a name for the module has been magically setup (eg, via a frozen *************** *** 109,113 **** // find out where our DLL/EXE module lives // NOTE: the long file name does not get returned (don't know why) ! ::GetModuleFileName(g_hInstance, szFilePath, sizeof(szFilePath)); ::_splitpath( szFilePath, NULL, NULL, szBase, NULL); module_name = szBase + 1; // skip first char. --- 117,121 ---- // find out where our DLL/EXE module lives // NOTE: the long file name does not get returned (don't know why) ! ::GetModuleFileNameA(g_hInstance, szFilePath, sizeof(szFilePath)); ::_splitpath( szFilePath, NULL, NULL, szBase, NULL); module_name = szBase + 1; // skip first char. *************** *** 118,122 **** bool CPythonEngine::AddToPythonPath(LPCTSTR pPathName) { ! PyObject *obPathList = PySys_GetObject(_T("path")); if (obPathList==NULL) { return false; --- 126,130 ---- bool CPythonEngine::AddToPythonPath(LPCTSTR pPathName) { ! PyObject *obPathList = PySys_GetObject("path"); if (obPathList==NULL) { return false; *************** *** 129,138 **** // Current Python versions handle neither this, nor Unicode on // sys.path, so correct this here. ! size_t len = strlen(pPathName); ! if (len > 4 && strncmp(pPathName, "\\\\?\\", 4)==0) { pPathName += 4; len -= 4; } PyObject *obNew = PyString_FromStringAndSize(pPathName, len); if (obNew==NULL) { return false; --- 137,150 ---- // Current Python versions handle neither this, nor Unicode on // sys.path, so correct this here. ! size_t len = _tcslen(pPathName); ! if (len > 4 && _tcsncmp(pPathName, _T("\\\\?\\"), 4)==0) { pPathName += 4; len -= 4; } + #if (PY_VERSION_HEX < 0x03000000) PyObject *obNew = PyString_FromStringAndSize(pPathName, len); + #else + PyObject *obNew = PyUnicode_FromWideChar(pPathName, len); + #endif if (obNew==NULL) { return false; *************** *** 349,353 **** // general error handler ! void ExtensionError(CControlBlock *pcb, LPCTSTR errmsg) { char *windows_error = ::GetLastError() ? --- 361,365 ---- // general error handler ! void ExtensionError(CControlBlock *pcb, const char *errmsg) { char *windows_error = ::GetLastError() ? *************** *** 390,394 **** } ! void FilterError(CFilterContext *pfc, LPCTSTR errmsg) { char *windows_error = ::GetLastError() ? --- 402,406 ---- } ! void FilterError(CFilterContext *pfc, const char *errmsg) { char *windows_error = ::GetLastError() ? Index: PyExtensionObjects.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/PyExtensionObjects.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PyExtensionObjects.h 3 Jan 2009 06:11:46 -0000 1.9 --- PyExtensionObjects.h 3 Feb 2009 00:51:42 -0000 1.10 *************** *** 39,44 **** // Python support static void deallocFunc(PyObject *ob); ! static PyObject *getattr(PyObject *self, char *name); ! static int setattr(PyObject *self, char *name, PyObject *v); }; --- 39,44 ---- // Python support static void deallocFunc(PyObject *ob); ! static PyObject *getattro(PyObject *self, PyObject *name); ! static int setattro(PyObject *self, PyObject *name, PyObject *v); }; *************** *** 46,65 **** { CControlBlock * m_pcb; - DWORD m_version; // Version info of this spec - HCONN m_connID; // Context number not to be modified! - - PyObject * m_method; // REQUEST_METHOD - PyObject * m_queryString; // QUERY_STRING - PyObject * m_pathInfo; // PATH_INFO - PyObject * m_pathTranslated; // PATH_TRANSLATED - DWORD m_totalBytes; // Total bytes indicated from client DWORD m_available; // Available number of bytes - PyObject * m_data; // Pointer to cbAvailable bytes - PyObject * m_contentType; // Content type of client data - DWORD m_HttpStatusCode; // The status of the current transaction when the request is completed. - PyObject * m_logData; // log data string public: --- 46,53 ---- *************** *** 77,82 **** // Python support static void deallocFunc(PyObject *ob); ! static PyObject *getattr(PyObject *self, char *name); ! static int setattr(PyObject *self, char *name, PyObject *v); // class methods --- 65,70 ---- // Python support static void deallocFunc(PyObject *ob); ! static PyObject *getattro(PyObject *self, PyObject *obname); ! static int setattro(PyObject *self, PyObject *obname, PyObject *v); // class methods *************** *** 106,113 **** static PyObject * IsSessionActive(PyObject *self, PyObject * args); ! protected: ! #pragma warning( disable : 4251 ) ! static struct memberlist PyECB_memberlist[]; ! #pragma warning( default : 4251 ) }; --- 94,98 ---- static PyObject * IsSessionActive(PyObject *self, PyObject * args); ! static struct PyMemberDef members[]; }; Index: PythonEng.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/PythonEng.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PythonEng.h 11 Oct 2006 07:55:10 -0000 1.2 --- PythonEng.h 3 Feb 2009 00:51:42 -0000 1.3 *************** *** 30,46 **** #include "FilterContext.h" - ///////////////////////////////////////////////////// - // Engine exception - //////////////////////////////////////////////////// - - class CPythonEngineException - { - public: - CPythonEngineException(LPCTSTR errMsg = "") {m_errStr = strdup(errMsg);} - ~CPythonEngineException(){free(m_errStr);} - public: - char *m_errStr; - }; - class CPythonEngine { --- 30,33 ---- *************** *** 92,97 **** // general error handler ! void ExtensionError(CControlBlock *pcb, LPCTSTR errmsg); ! void FilterError(CFilterContext *pfc, LPCTSTR errmsg); class CEnterLeavePython { --- 79,84 ---- // general error handler ! void ExtensionError(CControlBlock *pcb, const char *errmsg); ! void FilterError(CFilterContext *pfc, const char *errmsg); class CEnterLeavePython { Index: Utils.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/Utils.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Utils.cpp 17 Jan 2007 04:40:12 -0000 1.3 --- Utils.cpp 3 Feb 2009 00:51:42 -0000 1.4 *************** *** 33,39 **** static WCHAR *source_name = L"ISAPI Filter or Extension"; // returns the pathname of this module ! char *GetModulePath(void) { // directory values --- 33,60 ---- static WCHAR *source_name = L"ISAPI Filter or Extension"; + // some py3k-friendly type conversions. + const char *PyISAPIString_AsBytes(PyObject *ob, DWORD *psize /* = NULL */) + { + #if (PY_VERSION_HEX >= 0x03000000) + // py3k - check for unicode object and use default encoding. + if (PyUnicode_Check(ob)) { + ob = _PyUnicode_AsDefaultEncodedString(ob, NULL); + if (ob == NULL) + return NULL; + } + #endif + // These 'PyString_' calls are all mapped to the bytes API in py3k... + if (!PyString_Check(ob)) { + PyErr_Format(PyExc_ValueError, "Expected a string object (got %s)", ob->ob_type->tp_name); + return NULL; + } + if (psize) + *psize = PyString_Size(ob); + return PyString_AsString(ob); + } + // returns the pathname of this module ! TCHAR *GetModulePath(void) { // directory values *************** *** 45,57 **** // NOTE: the long file name does not get returned (don't know why) ::GetModuleFileName(g_hInstance, szFilePath, sizeof(szFilePath)); ! ::_splitpath( szFilePath, szDrive, szDir, NULL, NULL ); ! int dir_len = strlen(szDir); ! if (dir_len && szDir[dir_len-1] == '\\') ! szDir[dir_len-1] = '\0'; ! char *result = (char *)malloc(strlen(szDrive)+strlen(szDir)+1); if (result) { ! strcpy(result, szDrive); ! strcat(result, szDir); } return result; --- 66,78 ---- // NOTE: the long file name does not get returned (don't know why) ::GetModuleFileName(g_hInstance, szFilePath, sizeof(szFilePath)); ! ::_tsplitpath( szFilePath, szDrive, szDir, NULL, NULL ); ! int dir_len = _tcslen(szDir); ! if (dir_len && szDir[dir_len-1] == _T('\\')) ! szDir[dir_len-1] = _T('\0'); ! TCHAR *result = (TCHAR *)malloc((_tcslen(szDrive)+_tcslen(szDir)+1)*sizeof(TCHAR)); if (result) { ! _tcscpy(result, szDrive); ! _tcscat(result, szDir); } return result; *************** *** 66,70 **** if (!result) return NULL; result[0] = '\0'; ! int nLen =FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, nErrNo, --- 87,91 ---- if (!result) return NULL; result[0] = '\0'; ! int nLen =FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, nErrNo, *************** *** 83,87 **** // format an error ! char *HTMLErrorResp(LPCTSTR msg) { const char *htmlBody = "<html><head><title>Python ISAPI Error</title></head>" --- 104,108 ---- // format an error ! char *HTMLErrorResp(const char *msg) { const char *htmlBody = "<html><head><title>Python ISAPI Error</title></head>" *************** *** 106,110 **** sizeof mod_name/sizeof WCHAR); if (!mod_name[0]) { ! OutputDebugString("GetModuleFileNameW failed!"); return; } --- 127,131 ---- sizeof mod_name/sizeof WCHAR); if (!mod_name[0]) { ! OutputDebugString(_T("GetModuleFileNameW failed!")); return; } *************** *** 147,151 **** hEventSource = RegisterEventSourceW(NULL, source_name); if (hEventSource) { ! ReportEvent(hEventSource, // handle of event source eventType, // event type 0, // event category --- 168,172 ---- hEventSource = RegisterEventSourceW(NULL, source_name); if (hEventSource) { ! ReportEventA(hEventSource, // handle of event source eventType, // event type 0, // event category Index: PyExtensionObjects.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/PyExtensionObjects.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** PyExtensionObjects.cpp 27 Jan 2009 13:07:21 -0000 1.14 --- PyExtensionObjects.cpp 3 Feb 2009 00:51:42 -0000 1.15 *************** *** 136,141 **** PyTypeObject PyVERSION_INFOType = { ! PyObject_HEAD_INIT(&PyType_Type) ! 0, "HSE_VERSION_INFO", sizeof(PyVERSION_INFO), --- 136,140 ---- PyTypeObject PyVERSION_INFOType = { ! PYISAPI_OBJECT_HEAD "HSE_VERSION_INFO", sizeof(PyVERSION_INFO), *************** *** 143,148 **** PyVERSION_INFO::deallocFunc, /* tp_dealloc */ 0, /* tp_print */ ! PyVERSION_INFO::getattr, /* tp_getattr */ ! PyVERSION_INFO::setattr, /* tp_setattr */ 0, 0, /* tp_repr */ --- 142,147 ---- PyVERSION_INFO::deallocFunc, /* tp_dealloc */ 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ 0, 0, /* tp_repr */ *************** *** 153,159 **** 0, /* tp_call */ 0, /* tp_str */ }; - PyVERSION_INFO::PyVERSION_INFO(HSE_VERSION_INFO *pvi) { --- 152,161 ---- 0, /* tp_call */ 0, /* tp_str */ + PyVERSION_INFO::getattro, /* tp_getattro */ + PyVERSION_INFO::setattro, /* tp_setattro */ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT, /* tp_flags */ }; PyVERSION_INFO::PyVERSION_INFO(HSE_VERSION_INFO *pvi) { *************** *** 167,184 **** } ! PyObject *PyVERSION_INFO::getattr(PyObject *self, char *name) { PyVERSION_INFO *me = (PyVERSION_INFO *)self; if (!me->m_pvi) return PyErr_Format(PyExc_RuntimeError, "VERSION_INFO structure no longer exists"); ! if (strcmp(name, "ExtensionDesc")==0) { return PyString_FromString(me->m_pvi->lpszExtensionDesc); } ! return PyErr_Format(PyExc_AttributeError, "PyVERSION_INFO has no attribute '%s'", name); } ! int PyVERSION_INFO::setattr(PyObject *self, char *name, PyObject *v) { PyVERSION_INFO *me = (PyVERSION_INFO *)self; if (!me->m_pvi) { PyErr_Format(PyExc_RuntimeError, "VERSION_INFO structure no longer exists"); --- 169,188 ---- } ! PyObject *PyVERSION_INFO::getattro(PyObject *self, PyObject *obname) { PyVERSION_INFO *me = (PyVERSION_INFO *)self; if (!me->m_pvi) return PyErr_Format(PyExc_RuntimeError, "VERSION_INFO structure no longer exists"); ! TCHAR *name=PYISAPI_ATTR_CONVERT(obname); ! if (_tcscmp(name, _T("ExtensionDesc"))==0) { return PyString_FromString(me->m_pvi->lpszExtensionDesc); } ! return PyObject_GenericGetAttr(self, obname); } ! int PyVERSION_INFO::setattro(PyObject *self, PyObject *obname, PyObject *v) { PyVERSION_INFO *me = (PyVERSION_INFO *)self; + TCHAR *name=PYISAPI_ATTR_CONVERT(obname); if (!me->m_pvi) { PyErr_Format(PyExc_RuntimeError, "VERSION_INFO structure no longer exists"); *************** *** 190,206 **** } // @prop string|ExtensionDesc|The description of the extension. ! else if (strcmp(name, "ExtensionDesc")==0) { ! if (!PyString_Check(v)) { ! PyErr_Format(PyExc_ValueError, "FilterDesc must be a string (got %s)", v->ob_type->tp_name); return -1; ! } ! if (PyString_Size(v) > HSE_MAX_EXT_DLL_NAME_LEN) { PyErr_Format(PyExc_ValueError, "String is too long - max of %d chars", HSE_MAX_EXT_DLL_NAME_LEN); return -1; } ! strcpy(me->m_pvi->lpszExtensionDesc, PyString_AsString(v)); } else { ! PyErr_SetString(PyExc_AttributeError, "can't modify read only VERSION_INFO attributes."); ! return -1; } return 0; --- 194,210 ---- } // @prop string|ExtensionDesc|The description of the extension. ! else if (_tcscmp(name, _T("ExtensionDesc"))==0) { ! DWORD size; ! const char *bytes = PyISAPIString_AsBytes(v, &size); ! if (!bytes) return -1; ! if (size > HSE_MAX_EXT_DLL_NAME_LEN) { PyErr_Format(PyExc_ValueError, "String is too long - max of %d chars", HSE_MAX_EXT_DLL_NAME_LEN); return -1; } ! strcpy(me->m_pvi->lpszExtensionDesc, bytes); ! return 0; } else { ! return PyObject_GenericSetAttr(self, obname, v); } return 0; *************** *** 226,246 **** // @object EXTENSION_CONTROL_BLOCK|A python representation of an ISAPI // EXTENSION_CONTROL_BLOCK. ! struct memberlist PyECB::PyECB_memberlist[] = { {"Version", T_INT, ECBOFF(m_version), READONLY}, - // XXX - ConnID 64bit issue? - {"ConnID", T_INT, ECBOFF(m_connID), READONLY}, - - {"Method", T_OBJECT, ECBOFF(m_method), READONLY}, - {"QueryString", T_OBJECT, ECBOFF(m_queryString), READONLY}, - {"PathInfo", T_OBJECT, ECBOFF(m_pathInfo), READONLY}, - {"PathTranslated", T_OBJECT, ECBOFF(m_pathTranslated), READONLY}, - {"TotalBytes", T_INT, ECBOFF(m_totalBytes), READONLY}, {"AvailableBytes", T_INT, ECBOFF(m_available), READONLY}, - {"AvailableData", T_OBJECT, ECBOFF(m_data), READONLY}, - {"ContentType", T_OBJECT, ECBOFF(m_contentType), READONLY}, - {"HttpStatusCode", T_INT, ECBOFF(m_HttpStatusCode)}, - {"LogData", T_OBJECT, ECBOFF(m_logData)}, {NULL} }; --- 230,238 ---- // @object EXTENSION_CONTROL_BLOCK|A python representation of an ISAPI // EXTENSION_CONTROL_BLOCK. ! struct PyMemberDef PyECB::members[] = { {"Version", T_INT, ECBOFF(m_version), READONLY}, {"TotalBytes", T_INT, ECBOFF(m_totalBytes), READONLY}, {"AvailableBytes", T_INT, ECBOFF(m_available), READONLY}, {"HttpStatusCode", T_INT, ECBOFF(m_HttpStatusCode)}, {NULL} }; *************** *** 272,277 **** PyTypeObject PyECBType = { ! PyObject_HEAD_INIT(&PyType_Type) ! 0, "EXTENSION_CONTROL_BLOCK", sizeof(PyECB), --- 264,268 ---- PyTypeObject PyECBType = { ! PYISAPI_OBJECT_HEAD "EXTENSION_CONTROL_BLOCK", sizeof(PyECB), *************** *** 279,284 **** PyECB::deallocFunc, /* tp_dealloc */ 0, /* tp_print */ ! PyECB::getattr, /* tp_getattr */ ! PyECB::setattr, /* tp_setattr */ 0, 0, /* tp_repr */ --- 270,275 ---- PyECB::deallocFunc, /* tp_dealloc */ 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ 0, 0, /* tp_repr */ *************** *** 289,312 **** 0, /* tp_call */ 0, /* tp_str */ }; PyECB::PyECB(CControlBlock * pcb): - - m_version(0), // @prop integer|Version|Version info of this spec (read-only) - m_connID(0), // @prop integer|ConnID|Context number (read-only) - - m_method(NULL), // @prop string|Method|REQUEST_METHOD - m_queryString(NULL), // @prop string|QueryString|QUERY_STRING - m_pathInfo(NULL), // @prop string|PathInfo|PATH_INFO - m_pathTranslated(NULL), // @prop string|PathTranslated|PATH_TRANSLATED m_totalBytes(0), // @prop int|TotalBytes|Total bytes indicated from client m_available(0), // @prop int|AvailableBytes|Available number of bytes ! m_data(NULL), // @prop string|AvailableData|Pointer to cbAvailable bytes ! m_contentType(NULL), // @prop string|ContentType|Content type of client data ! m_HttpStatusCode(0), // @prop int|HttpStatusCode|The status of the current transaction when the request is completed. ! m_logData(NULL) // @prop string|LogData|log data string { ob_type = &PyECBType; --- 280,324 ---- 0, /* tp_call */ 0, /* tp_str */ + PyECB::getattro, /* tp_getattro */ + PyECB::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 */ + PyECB_methods, /* tp_methods */ + PyECB::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 */ }; PyECB::PyECB(CControlBlock * pcb): + m_version(0), // @prop integer|Version|Version info of this spec (read-only) m_totalBytes(0), // @prop int|TotalBytes|Total bytes indicated from client m_available(0), // @prop int|AvailableBytes|Available number of bytes ! m_HttpStatusCode(0) // @prop int|HttpStatusCode|The status of the current transaction when the request is completed. ! // <keep a blank line above this for autoduck!> these props are managed manually... ! // @prop bytes|Method|REQUEST_METHOD ! // @prop long|ConnID|Context number (read-only) ! // @prop bytes|QueryString|QUERY_STRING ! // @prop bytes|PathInfo|PATH_INFO ! // @prop bytes|PathTranslated|PATH_TRANSLATED ! // @prop bytes|AvailableData|Pointer to cbAvailable bytes ! // @prop bytes|ContentType|Content type of client data ! // @prop bytes|LogData|log data string { ob_type = &PyECBType; *************** *** 317,345 **** EXTENSION_CONTROL_BLOCK * pecb = pcb->GetECB(); ! m_version = pecb->dwVersion; ! ! m_connID = pecb->ConnID; m_HttpStatusCode = pecb->dwHttpStatusCode; - m_logData = PyString_FromString(""); - m_method = PyString_FromString(pecb->lpszMethod); - m_queryString = PyString_FromString(pecb->lpszQueryString); - m_pathInfo = PyString_FromString(pecb->lpszPathInfo); - m_pathTranslated = PyString_FromString(pecb->lpszPathTranslated); m_totalBytes = pecb->cbTotalBytes; m_available = pecb->cbAvailable; - m_data = PyString_FromStringAndSize((const char *) pecb->lpbData, pecb->cbAvailable); - m_contentType = PyString_FromString(pecb->lpszContentType); } PyECB::~PyECB() { - Py_XDECREF(m_logData); - Py_XDECREF(m_method); - Py_XDECREF(m_queryString); - Py_XDECREF(m_pathInfo); - Py_XDECREF(m_pathTranslated); - Py_XDECREF(m_data); - Py_XDECREF(m_contentType); - if (m_pcb) delete m_pcb; --- 329,342 ---- EXTENSION_CONTROL_BLOCK * pecb = pcb->GetECB(); ! m_version = pecb->dwVersion; ! // load up the simple integers etc into members so we can use normal ! // python structmember T_ macros. m_HttpStatusCode = pecb->dwHttpStatusCode; m_totalBytes = pecb->cbTotalBytes; m_available = pecb->cbAvailable; } PyECB::~PyECB() { if (m_pcb) delete m_pcb; *************** *** 347,370 **** ! PyObject *PyECB::getattr(PyObject *self, char *name) { ! // see if its a member variable ! for (int i=0; i<ARRAYSIZE(PyECB::PyECB_memberlist); i++){ ! if (PyECB::PyECB_memberlist[i].name && _tcsicmp(name, PyECB::PyECB_memberlist[i].name) == 0) ! return PyMember_Get((char *)self, PyECB::PyECB_memberlist, name); ! } ! ! // see if its the special members attribute ! if (_tcscmp(name, _T("__members__"))==0) ! return PyMember_Get((char *)self, PyECB::PyECB_memberlist, name); if (_tcscmp(name, _T("softspace"))==0) // help 'print' semantics. return PyInt_FromLong(1); ! // must be a method ! return Py_FindMethod(PyECB_methods, self, name); } ! int PyECB::setattr(PyObject *self, char *name, PyObject *v) { if (v == NULL) { --- 344,384 ---- ! PyObject *PyECB::getattro(PyObject *self, PyObject *obname) { ! TCHAR *name=PYISAPI_ATTR_CONVERT(obname); if (_tcscmp(name, _T("softspace"))==0) // help 'print' semantics. return PyInt_FromLong(1); ! EXTENSION_CONTROL_BLOCK * pecb = ((PyECB *)self)->m_pcb->GetECB(); ! ! if (_tcscmp(name, _T("Method"))==0) ! return PyString_FromString(pecb->lpszMethod); ! ! if (_tcscmp(name, _T("QueryString"))==0) ! return PyString_FromString(pecb->lpszQueryString); ! ! if (_tcscmp(name, _T("PathInfo"))==0) ! return PyString_FromString(pecb->lpszPathInfo); ! ! if (_tcscmp(name, _T("PathTranslated"))==0) ! return PyString_FromString(pecb->lpszPathTranslated); ! ! if (_tcscmp(name, _T("AvailableData"))==0) ! return PyString_FromStringAndSize((const char *) pecb->lpbData, pecb->cbAvailable); ! ! if (_tcscmp(name, _T("ContentType"))==0) ! return PyString_FromString(pecb->lpszContentType); ! ! if (_tcscmp(name, _T("LogData"))==0) ! return PyErr_Format(PyExc_AttributeError, "LogData attribute can only be set"); ! ! if (_tcscmp(name, _T("ConnID"))==0) ! return PyLong_FromVoidPtr(pecb->ConnID); ! ! return PyObject_GenericGetAttr(self, obname); } ! int PyECB::setattro(PyObject *self, PyObject *obname, PyObject *v) { if (v == NULL) { *************** *** 372,405 **** return -1; } ! if (_tcscmp(name, _T("HttpStatusCode"))==0){ ! int res = PyMember_Set((char *)self, PyECB::PyECB_memberlist, name, v); ! if (res == 0){ ! DWORD status = PyInt_AsLong(v); ! PyECB * pecb = (PyECB *) self; ! if (pecb->m_pcb) ! pecb->m_pcb->SetStatus(status); ! ! } ! ! return res; } - - if ( _tcscmp(name, _T("LogData"))==0){ - int res = PyMember_Set((char *)self, PyECB::PyECB_memberlist, name, v); - if (res == 0){ - char * logMsg = PyString_AsString(v); - PyECB * pecb = (PyECB *) self; - if (pecb->m_pcb) - pecb->m_pcb->SetLogMessage(logMsg); - - } ! return res; } PyErr_SetString(PyExc_AttributeError, "can't modify read only ECB attributes only HTTPStatusCode and LogData can be changed."); return -1; - } --- 386,412 ---- return -1; } + TCHAR *name=PYISAPI_ATTR_CONVERT(obname); ! if (_tcscmp(name, _T("HttpStatusCode"))==0) { ! PyECB * pecb = (PyECB *) self; ! DWORD status = PyInt_AsLong(v); ! pecb->m_HttpStatusCode = status; ! if (pecb->m_pcb) ! pecb->m_pcb->SetStatus(status); ! return 0; } ! if ( _tcscmp(name, _T("LogData"))==0) { ! const char *logMsg = PyISAPIString_AsBytes(v); ! if (!logMsg) ! return -1; ! PyECB * pecb = (PyECB *) self; ! if (pecb->m_pcb) ! pecb->m_pcb->SetLogMessage(logMsg); ! return 0; } PyErr_SetString(PyExc_AttributeError, "can't modify read only ECB attributes only HTTPStatusCode and LogData can be changed."); return -1; } *************** *** 415,420 **** { BOOL bRes = FALSE; ! TCHAR * buffer = NULL; ! DWORD buffLen = 0; int reserved = 0; --- 422,428 ---- { BOOL bRes = FALSE; ! char *buffer = NULL; ! Py_ssize_t buffLenIn = 0; ! DWORD buffLenOut = 0; int reserved = 0; *************** *** 422,437 **** // @pyparm string/buffer|data||The data to write // @pyparm int|reserved|0| ! if (!PyArg_ParseTuple(args, "s#|l:WriteClient", &buffer, &buffLen, &reserved)) return NULL; DWORD bytesWritten = 0; if (pecb->m_pcb){ Py_BEGIN_ALLOW_THREADS ! bRes = pecb->m_pcb->WriteClient(buffer, &buffLen, reserved); Py_END_ALLOW_THREADS if (!bRes) return SetPyECBError("WriteClient"); } ! return PyInt_FromLong(buffLen); // @rdesc the result is the number of bytes written. } --- 430,446 ---- // @pyparm string/buffer|data||The data to write // @pyparm int|reserved|0| ! if (!PyArg_ParseTuple(args, "s#|l:WriteClient", &buffer, &buffLenIn, &reserved)) return NULL; DWORD bytesWritten = 0; + buffLenOut = Py_SAFE_DOWNCAST(buffLenIn, Py_ssize_t, DWORD); if (pecb->m_pcb){ Py_BEGIN_ALLOW_THREADS ! bRes = pecb->m_pcb->WriteClient(buffer, &buffLenOut, reserved); Py_END_ALLOW_THREADS if (!bRes) return SetPyECBError("WriteClient"); } ! return PyInt_FromLong(buffLenOut); // @rdesc the result is the number of bytes written. } *************** *** 444,448 **** { BOOL bRes = FALSE; ! TCHAR * variable = NULL; PyObject *def = NULL; --- 453,457 ---- { BOOL bRes = FALSE; ! char *variable = NULL; PyObject *def = NULL; *************** *** 544,550 **** PyObject * pyRes = NULL; if (nSize>0) ! pyRes =PyString_FromStringAndSize((LPCTSTR) pBuff, nSize); else ! pyRes = PyString_FromString(""); delete [] pBuff; --- 553,559 ---- PyObject * pyRes = NULL; if (nSize>0) ! pyRes =PyString_FromStringAndSize((const char *)pBuff, nSize); else ! pyRes = PyString_FromStringAndSize("", 0); delete [] pBuff; *************** *** 558,564 **** { BOOL bRes = FALSE; ! TCHAR * reply = NULL; ! TCHAR * headers = NULL; int bKeepAlive = 0; PyECB * pecb = (PyECB *) self; --- 567,574 ---- { BOOL bRes = FALSE; ! char *reply = NULL; ! char *headers = NULL; int bKeepAlive = 0; + Py_ssize_t cchStatus, cchHeader; PyECB * pecb = (PyECB *) self; *************** *** 570,578 **** // @pyparm bool|keepAlive|False| if (!PyArg_ParseTuple(args, "s#s#|i:SendResponseHeaders", ! &SendHeaderExInfo.pszStatus, &SendHeaderExInfo.cchStatus, ! &SendHeaderExInfo.pszHeader, &SendHeaderExInfo.cchHeader, &bKeepAlive)) return NULL; SendHeaderExInfo.fKeepConn = (bKeepAlive) ? TRUE:FALSE; if (pecb->m_pcb){ --- 580,590 ---- // @pyparm bool|keepAlive|False| if (!PyArg_ParseTuple(args, "s#s#|i:SendResponseHeaders", ! &SendHeaderExInfo.pszStatus, &cchStatus, ! &SendHeaderExInfo.pszHeader, &cchHeader, &bKeepAlive)) return NULL; + SendHeaderExInfo.cchStatus = Py_SAFE_DOWNCAST(cchStatus, Py_ssize_t, DWORD); + SendHeaderExInfo.cchHeader = Py_SAFE_DOWNCAST(cchHeader, Py_ssize_t, DWORD); SendHeaderExInfo.fKeepConn = (bKeepAlive) ? TRUE:FALSE; if (pecb->m_pcb){ *************** *** 628,632 **** { BOOL bRes = FALSE; ! TCHAR * url = NULL; PyECB * pecb = (PyECB *) self; --- 640,644 ---- { BOOL bRes = FALSE; ! char *url = NULL; PyECB * pecb = (PyECB *) self; *************** *** 1011,1012 **** --- 1023,1030 ---- return NULL; } + + void InitExtensionTypes() + { + PyType_Ready(&PyVERSION_INFOType); + PyType_Ready(&PyECBType); + } Index: FilterContext.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/FilterContext.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FilterContext.h 22 Feb 2008 23:03:06 -0000 1.2 --- FilterContext.h 3 Feb 2009 00:51:42 -0000 1.3 *************** *** 2,5 **** --- 2,6 ---- #define __FILTER_CONTEXT_H__ + // This class should slowly die - its indirection offers no value... class CFilterContext { *************** *** 37,47 **** } - DWORD WriteClient(LPCTSTR buffer, const int buffLen, const int reserved=0) - { - DWORD dwBufLen = buffLen; - m_pHFC->WriteClient(m_pHFC, (void *) buffer, &dwBufLen, reserved); - return dwBufLen; - } - BOOL AddResponseHeaders(LPSTR headers, const int reserved=0) { --- 38,41 ---- *************** *** 50,56 **** ! bool GetServerVariable(LPCTSTR varName, LPSTR lpBuff, DWORD *pBuffSize) { ! BOOL bOK = m_pHFC->GetServerVariable(m_pHFC,(LPSTR) varName,lpBuff,pBuffSize); if (!bOK) *pBuffSize = 0; --- 44,50 ---- ! bool GetServerVariable(char *varName, LPSTR lpBuff, DWORD *pBuffSize) { ! BOOL bOK = m_pHFC->GetServerVariable(m_pHFC, varName, lpBuff, pBuffSize); if (!bOK) *pBuffSize = 0; *************** *** 64,69 **** return m_pHFC->ServerSupportFunction(m_pHFC,sfReq, pData, ul1, ul2); } - private: HTTP_FILTER_CONTEXT* m_pHFC; // IIS filter context block DWORD m_notificationType; void *m_data; --- 58,63 ---- return m_pHFC->ServerSupportFunction(m_pHFC,sfReq, pData, ul1, ul2); } HTTP_FILTER_CONTEXT* m_pHFC; // IIS filter context block + private: DWORD m_notificationType; void *m_data; Index: StdAfx.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/StdAfx.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** StdAfx.h 3 Jan 2009 06:11:46 -0000 1.2 --- StdAfx.h 3 Feb 2009 00:51:42 -0000 1.3 *************** *** 33,36 **** --- 33,37 ---- #include "Utils.h" + #define PY_SSIZE_T_CLEAN #include "Python.h" *************** *** 49,52 **** --- 50,91 ---- #undef WRITE_RESTRICTED + // ***** py3k support ***** + // Note that when built for py3k, 'UNICODE' is defined, which conveniently + // means TCHAR is the same size as the native unicode object in all versions. + // Note however that ISAPI is always an ANSI API - so even when UNICODE is + // defined, most strings passed and received from ISAPI itself remain 'char *' + // in all versions. + + // most of these taken from pywintypes... + #if (PY_VERSION_HEX < 0x03000000) + + // Macros to handle PyObject layout changes in Py3k + #define PYISAPI_OBJECT_HEAD PyObject_HEAD_INIT(&PyType_Type) 0, + #define PYISAPI_ATTR_CONVERT PyString_AsString + + #else // Py3k definitions + + // Macros to handle PyObject layout changes in Py3k + #define PYISAPI_OBJECT_HEAD PyVarObject_HEAD_INIT(NULL, 0) + #define PYISAPI_ATTR_CONVERT PyUnicode_AsUnicode + + // And some old py2k functions we can map to their new names... + #define PyString_Check PyBytes_Check + #define PyString_Size PyBytes_Size + #define PyString_AsString PyBytes_AsString + #define PyString_FromString PyBytes_FromString + #define PyString_FromStringAndSize PyBytes_FromStringAndSize + #define PyString_AS_STRING PyBytes_AS_STRING + #define PyInt_AsLong PyLong_AsLong + #define PyInt_FromLong PyLong_FromLong + #define PyInt_Check PyLong_Check + + #endif + + // A helper that on py3k takes a str or unicode as input and returns a + // string - exactly how the 's#' PyArg_ParseTuple format string does... + // On py2k accepts str objects only. + const char *PyISAPIString_AsBytes(PyObject *ob, DWORD *psize=NULL); + //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. Index: PyFilterObjects.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/src/PyFilterObjects.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** PyFilterObjects.cpp 3 Jul 2008 13:30:04 -0000 1.11 --- PyFilterObjects.cpp 3 Feb 2009 00:51:42 -0000 1.12 *************** *** 34,39 **** PyTypeObject PyFILTER_VERSIONType = { ! PyObject_HEAD_INIT(&PyType_Type) ! 0, "HTTP_FILTER_VERSION", sizeof(PyFILTER_VERSION), --- 34,38 ---- PyTypeObject PyFILTER_VERSIONType = { ! PYISAPI_OBJECT_HEAD [...995 lines suppressed...] CHECK_SET_FILTER_LOG_LONG(Win32Status); ! return PyObject_GenericSetAttr(self, obname, v); } *************** *** 1128,1129 **** --- 1167,1179 ---- delete (PyFILTER_LOG *)ob; } + + void InitFilterTypes() + { + PyType_Ready(&PyFILTER_VERSIONType); + PyType_Ready(&PyHFCType); + PyType_Ready(&PyURL_MAPType); + PyType_Ready(&PyPREPROC_HEADERSType); + PyType_Ready(&PyRAW_DATAType); + PyType_Ready(&PyAUTHENTType); + PyType_Ready(&PyFILTER_LOGType); + } |
|
From: Mark H. <mha...@us...> - 2009-02-03 00:20:06
|
Update of /cvsroot/pywin32/pywin32/isapi/samples In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv21450 Modified Files: advanced.py Log Message: Fix query string handling and don't fail for invalid server vars Index: advanced.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/samples/advanced.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** advanced.py 1 Jan 2009 22:40:01 -0000 1.3 --- advanced.py 3 Feb 2009 00:19:56 -0000 1.4 *************** *** 122,130 **** print >> ecb, "<HTML><BODY>" ! queries = ecb.GetServerVariable("QUERY_STRING").split("&") ! if queries: print >> ecb, "<PRE>" for q in queries: ! val = ecb.GetServerVariable(q) print >> ecb, "%s=%r" % (q, val) print >> ecb, "</PRE><P/>" --- 122,131 ---- print >> ecb, "<HTML><BODY>" ! qs = ecb.GetServerVariable("QUERY_STRING") ! if qs: ! queries = qs.split("&") print >> ecb, "<PRE>" for q in queries: ! val = ecb.GetServerVariable(q, '<no such variable>') print >> ecb, "%s=%r" % (q, val) print >> ecb, "</PRE><P/>" |
|
From: Mark H. <mha...@us...> - 2009-02-03 00:19:17
|
Update of /cvsroot/pywin32/pywin32/isapi/samples In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv21405 Modified Files: redirector_with_filter.py Log Message: fix silly error in isapi sample Index: redirector_with_filter.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/isapi/samples/redirector_with_filter.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** redirector_with_filter.py 30 Dec 2008 12:26:55 -0000 1.1 --- redirector_with_filter.py 3 Feb 2009 00:19:10 -0000 1.2 *************** *** 94,98 **** #print "URL is '%s'" % (url,) prefix = virtualdir ! if not url.startswith(exclude) and not url.startswith(prefix): new_url = prefix + url print "New proxied URL is '%s'" % (new_url,) --- 94,98 ---- #print "URL is '%s'" % (url,) prefix = virtualdir ! if not url.startswith(prefix): new_url = prefix + url print "New proxied URL is '%s'" % (new_url,) |
|
From: Roger U. <ru...@us...> - 2009-02-02 19:39:19
|
Update of /cvsroot/pywin32/pywin32 In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv28562 Modified Files: setup.py Log Message: Add urlmon to libraries for pythoncom Index: setup.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup.py,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** setup.py 2 Feb 2009 06:51:54 -0000 1.97 --- setup.py 2 Feb 2009 19:39:10 -0000 1.98 *************** *** 1588,1592 **** pythoncom = WinExt_system32('pythoncom', dsp_file=r"com\win32com.dsp", ! libraries = "oleaut32 ole32 user32", export_symbol_file = 'com/win32com/src/PythonCOM.def', extra_compile_args = ['-DBUILD_PYTHONCOM'], --- 1588,1592 ---- pythoncom = WinExt_system32('pythoncom', dsp_file=r"com\win32com.dsp", ! libraries = "oleaut32 ole32 user32 urlmon", export_symbol_file = 'com/win32com/src/PythonCOM.def', extra_compile_args = ['-DBUILD_PYTHONCOM'], |
|
From: Roger U. <ru...@us...> - 2009-02-02 19:30:41
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv27598 Modified Files: PythonCOM.cpp Log Message: Add CreateURLMonikerEx Index: PythonCOM.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PythonCOM.cpp,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** PythonCOM.cpp 8 Jan 2009 22:35:50 -0000 1.57 --- PythonCOM.cpp 2 Feb 2009 19:30:31 -0000 1.58 *************** *** 920,923 **** --- 920,955 ---- } + // @pymethod <o PyIMoniker>|pythoncom|CreateURLMonikerEx|Create a URL moniker from a full url or partial url and base moniker + // @pyseeapi CreateURLMonikerEx + static PyObject *pythoncom_CreateURLMonikerEx(PyObject *self, PyObject *args) + { + WCHAR *url = NULL; + PyObject *obbase, *oburl, *ret = NULL; + IMoniker *base_moniker = NULL, *output_moniker = NULL; + HRESULT hr; + DWORD flags = URL_MK_UNIFORM; + if (!PyArg_ParseTuple(args, "OO|k:CreateURLMonikerEx", + &obbase, // @pyparm <o PyIMoniker>|Context||An IMoniker interface to be used as a base with a partial URL, can be None + &oburl, // @pyparm <o PyUNICODE>|URL||Full or partial url for which to create a moniker + &flags)) // @pyparm int|Flags|URL_MK_UNIFORM|URL_MK_UNIFORM or URL_MK_LEGACY + return NULL; + + if (!PyWinObject_AsWCHAR(oburl, &url, FALSE)) + return NULL; + if (PyCom_InterfaceFromPyObject(obbase, IID_IMoniker, (LPVOID*)&base_moniker, TRUE)){ + PY_INTERFACE_PRECALL; + hr = CreateURLMonikerEx(base_moniker, url, &output_moniker, flags); + if (base_moniker) + base_moniker->Release(); + PY_INTERFACE_POSTCALL; + if (FAILED(hr)) + PyCom_BuildPyException(hr); + else + ret=PyCom_PyObjectFromIUnknown(output_moniker, IID_IMoniker, FALSE); + } + PyWinObject_FreeWCHAR(url); + return ret; + } + // @pymethod <o PyIID>|pythoncom|GetClassFile|Supplies the CLSID associated with the given filename. static PyObject *pythoncom_GetClassFile(PyObject *self, PyObject *args) *************** *** 1873,1876 **** --- 1905,1911 ---- { "CreateItemMoniker", pythoncom_CreateItemMoniker, 1 }, // @pymeth CreateItemMoniker|Creates an item moniker that identifies an object within a containing object (typically a compound document). { "CreatePointerMoniker", pythoncom_CreatePointerMoniker, 1 }, // @pymeth CreatePointerMoniker|Creates a pointer moniker based on a pointer to an object. + + { "CreateURLMonikerEx", pythoncom_CreateURLMonikerEx, 1 }, // @pymeth CreateURLMoniker|Create a URL moniker from a full url or partial url and base moniker + { "CreateTypeLib", pythoncom_CreateTypeLib, 1}, // @pymeth CreateTypeLib|Provides access to a new object instance that supports the ICreateTypeLib interface. { "CreateTypeLib2", pythoncom_CreateTypeLib2, 1}, // @pymeth CreateTypeLib2|Provides access to a new object instance that supports the ICreateTypeLib2 interface. *************** *** 2344,2347 **** --- 2379,2386 ---- ADD_CONSTANT(MSHLFLAGS_NOPING); + // Flags for CreateUrlMoniker + ADD_CONSTANT(URL_MK_UNIFORM); + ADD_CONSTANT(URL_MK_LEGACY); + #ifndef NO_PYCOM_IDISPATCHEX ADD_CONSTANT(fdexNameCaseSensitive); // Request that the name lookup be done in a case-sensitive manner. May be ignored by object that does not support case-sensitive lookup. |