Update of /cvsroot/pywin32/pywin32/win32/src
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv26275/win32/src
Modified Files:
Tag: py3k
PyLARGE_INTEGER.cpp PyWinObjects.h win32file.i win32gui.i
win32inet.i win32inet_winhttp.cpp win32profilemodule.cpp
Log Message:
merge lots of changes from the trunk
Index: PyWinObjects.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinObjects.h,v
retrieving revision 1.14.2.1
retrieving revision 1.14.2.2
diff -C2 -d -r1.14.2.1 -r1.14.2.2
*** PyWinObjects.h 29 Aug 2008 04:59:25 -0000 1.14.2.1
--- PyWinObjects.h 11 Dec 2008 04:13:35 -0000 1.14.2.2
***************
*** 140,143 ****
--- 140,145 ----
/* Python support */
int compare(PyObject *ob);
+ PyObject *richcompare(PyObject *other, int op);
+
int print(FILE *fp, int flags);
PyObject *asStr(void);
***************
*** 147,150 ****
--- 149,153 ----
static int printFunc(PyObject *ob, FILE *fp, int flags);
static int compareFunc(PyObject *ob1, PyObject *ob2);
+ static PyObject *richcompareFunc(PyObject *ob, PyObject *other, int op);
static int nonzeroFunc(PyObject *ob);
static long hashFunc(PyObject *ob);
Index: win32inet_winhttp.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32inet_winhttp.cpp,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -C2 -d -r1.2 -r1.2.2.1
*** win32inet_winhttp.cpp 9 Apr 2008 04:31:07 -0000 1.2
--- win32inet_winhttp.cpp 11 Dec 2008 04:13:35 -0000 1.2.2.1
***************
*** 10,15 ****
#include "winhttp.h"
#include "pywintypes.h"
!
! extern PyObject *PyObject_FromHINTERNET(HINTERNET hi);
// @doc
--- 10,14 ----
#include "winhttp.h"
#include "pywintypes.h"
! #include "pywinobjects.h"
// @doc
***************
*** 17,20 ****
--- 16,22 ----
static funcWinHttpGetIEProxyConfigForCurrentUser pfnWinHttpGetIEProxyConfigForCurrentUser=NULL;
+ typedef BOOL (WINAPI *funcWinHttpGetDefaultProxyConfiguration)(WINHTTP_PROXY_INFO *);
+ static funcWinHttpGetDefaultProxyConfiguration pfnWinHttpGetDefaultProxyConfiguration=NULL;
+
typedef BOOL (WINAPI *funcWinHttpGetProxyForUrl)(HINTERNET, LPCWSTR, WINHTTP_AUTOPROXY_OPTIONS*, WINHTTP_PROXY_INFO *);
static funcWinHttpGetProxyForUrl pfnWinHttpGetProxyForUrl=NULL;
***************
*** 23,26 ****
--- 25,31 ----
static funcWinHttpOpen pfnWinHttpOpen=NULL;
+ typedef BOOL (WINAPI *funcWinHttpCloseHandle)(HINTERNET);
+ static funcWinHttpCloseHandle pfnWinHttpCloseHandle=NULL;
+
#define CHECK_PFN(fname) \
if (pfn##fname==NULL) \
***************
*** 40,44 ****
void init_win32inetstuff()
{
! HMODULE hmod = LoadLibrary("Winhttp.dll");
if (!hmod)
return; // nothing else to do!
--- 45,49 ----
void init_win32inetstuff()
{
! HMODULE hmod = LoadLibrary(_T("Winhttp.dll"));
if (!hmod)
return; // nothing else to do!
***************
*** 46,49 ****
--- 51,96 ----
LOAD_PFN(WinHttpGetProxyForUrl);
LOAD_PFN(WinHttpOpen);
+ LOAD_PFN(WinHttpCloseHandle);
+ LOAD_PFN(WinHttpGetDefaultProxyConfiguration);
+ // winhttp.dll also provides the string resources for its errors.
+ PyWin_RegisterErrorMessageModule(WINHTTP_ERROR_BASE, WINHTTP_ERROR_LAST, hmod);
+ }
+
+ // A handle used by WinHttpOpen; even though it is documented as a HINTERNET,
+ // our standard HINTERNET isn't suitable as (a) the callbacks fail and (b)
+ // the handle must be closed via WinHttpCloseHandle.
+ class PyHWINHTTP : public PyHANDLE
+ {
+ public:
+ PyHWINHTTP(HINTERNET hInit) : PyHANDLE((HANDLE)hInit) {;}
+
+ virtual BOOL Close(void) {
+ BOOL ret=TRUE;
+ // We've already checked we have the function-pointer - but
+ // it can't hurt to check again!
+ if (m_handle && pfnWinHttpCloseHandle){
+ HINTERNET h=m_handle;
+ m_handle = 0; // don't try again!
+ ret=(*pfnWinHttpCloseHandle)(h);
+ if (!ret)
+ PyWin_SetAPIError("WinHttpCloseHandle");
+ }
+ return ret;
+ }
+ virtual const char *GetTypeName() {return "PyHWINHTTP";}
+ };
+
+ PyObject *PyObject_FromWinHttpHandle(HINTERNET hi)
+ {
+ // Don't allow handles to be created if we can't close them!
+ CHECK_PFN(WinHttpCloseHandle);
+ PyHWINHTTP *ret=new PyHWINHTTP(hi);
+ if (ret==NULL)
+ return PyErr_NoMemory();
+ if (PyErr_Occurred()){
+ Py_DECREF(ret);
+ ret = NULL;
+ }
+ return ret;
}
***************
*** 75,79 ****
}
! // @object WINHTTP_AUTOPROXY_OPTIONS|Used by <om win32inet.WinHTTPGetProxyForUrl>
BOOL PyObject_AsWINHTTP_AUTOPROXY_OPTIONS(PyObject *ob, WINHTTP_AUTOPROXY_OPTIONS *out)
{
--- 122,139 ----
}
! // @object PyWINHTTP_PROXY_INFO|A tuple representing a WINHTTP_PROXY_INFO structure.
!
! PyObject *PyObject_FromWINHTTP_PROXY_INFO(WINHTTP_PROXY_INFO *i, BOOL bFreeStrings=TRUE)
! {
! PyObject *ret = Py_BuildValue("kuu",
! i->dwAccessType, // @tupleitem 0|int|dwAccessType|
! i->lpszProxy, // @tupleitem 2|string|lpszProxy|
! i->lpszProxyBypass); // @tupleitem 3|string|lpszProxy
! if (i->lpszProxy) GlobalFree(i->lpszProxy);
! if (i->lpszProxyBypass) GlobalFree(i->lpszProxyBypass);
! return ret;
! }
!
! // @object PyWINHTTP_AUTOPROXY_OPTIONS|Used by <om win32inet.WinHTTPGetProxyForUrl>
BOOL PyObject_AsWINHTTP_AUTOPROXY_OPTIONS(PyObject *ob, WINHTTP_AUTOPROXY_OPTIONS *out)
{
***************
*** 105,110 ****
}
! // @pymethod tuple|win32inet|WinHttpGetIEProxyConfigForCurrentUser|Obtains
! // the Internet Explorer proxy configuration for the current user.
PyObject *PyWinHttpGetProxyForUrl(PyObject *self, PyObject *args)
{
--- 165,190 ----
}
! // @pymethod <o PyWINHTTP_PROXY_INFO>|win32inet|WinHttpGetDefaultProxyConfiguration|
! // Retrieves the default WinHTTP proxy configuration from the registry.
! PyObject *PyWinHttpGetDefaultProxyConfiguration(PyObject *self, PyObject *args)
! {
! CHECK_PFN(WinHttpGetDefaultProxyConfiguration);
! if (!PyArg_ParseTuple(args, ":WinHttpGetDefaultProxyConfiguration"))
! return NULL;
! WINHTTP_PROXY_INFO info;
! memset(&info, 0, sizeof(info));
! BOOL ok;
! Py_BEGIN_ALLOW_THREADS
! ok = (*pfnWinHttpGetDefaultProxyConfiguration)(&info);
! Py_END_ALLOW_THREADS
! if (!ok) {
! PyWin_SetAPIError("WinHttpGetDefaultProxyConfiguration");
! return NULL;
! }
! return PyObject_FromWINHTTP_PROXY_INFO(&info);
! }
!
! // @pymethod <o PyWINHTTP_PROXY_INFO>|win32inet|WinHttpGetProxyForUrl|Obtains
! // the Internet Explorer proxy configuration for the specified URL.
PyObject *PyWinHttpGetProxyForUrl(PyObject *self, PyObject *args)
{
***************
*** 114,118 ****
&obHandle, // @pyparm <o HANDLE>/int|handle||
&obURL, // @pyparm unicode/string|url||
! &obOptions // @pyparm tuple|options||
))
return NULL;
--- 194,198 ----
&obHandle, // @pyparm <o HANDLE>/int|handle||
&obURL, // @pyparm unicode/string|url||
! &obOptions // @pyparm <o PyWINHTTP_AUTOPROXY_OPTIONS>|options||
))
return NULL;
***************
*** 143,157 ****
goto done;
}
! // @rdesc The result is a windows WINHTTP_PROXY_INFO
! // structure; a tuple of an int (bool) and 2 unicode strings
! // (dwAccessType, lpszProxy, lpszProxyBypass).
! // @pyseeapi WinHttpGetProxyForUrl
! // @pyseeapi WINHTTP_PROXY_INFO
! ret = Py_BuildValue("kuu",
! info.dwAccessType,
! info.lpszProxy,
! info.lpszProxyBypass);
! if (info.lpszProxy) GlobalFree(info.lpszProxy);
! if (info.lpszProxyBypass) GlobalFree(info.lpszProxyBypass);
done:
if (url)
--- 223,227 ----
goto done;
}
! ret = PyObject_FromWINHTTP_PROXY_INFO(&info);
done:
if (url)
***************
*** 198,202 ****
}
// @pyseeapi WinHttpOpen
! ret = PyObject_FromHINTERNET(hi);
done:
if (ua)
--- 268,272 ----
}
// @pyseeapi WinHttpOpen
! ret = PyObject_FromWinHttpHandle(hi);
done:
if (ua)
Index: win32profilemodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32profilemodule.cpp,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.2
diff -C2 -d -r1.3.2.1 -r1.3.2.2
*** win32profilemodule.cpp 29 Aug 2008 04:59:27 -0000 1.3.2.1
--- win32profilemodule.cpp 11 Dec 2008 04:13:35 -0000 1.3.2.2
***************
*** 463,498 ****
! extern "C" __declspec(dllexport)
! #if (PY_VERSION_HEX < 0x03000000)
! void initwin32profile(void)
! #else
! PyObject *PyInit_win32profile(void)
! #endif
{
! PyObject *dict, *module;
! PyWinGlobals_Ensure();
!
! #if (PY_VERSION_HEX < 0x03000000)
! module = Py_InitModule("win32profile", win32profile_functions);
! if (!module)
! return;
! dict = PyModule_GetDict(module);
! if (!dict)
! return;
! #else
! static PyModuleDef win32profile_def = {
! PyModuleDef_HEAD_INIT,
! "win32profile",
! "Interface to the Terminal Services Api.",
! -1,
! win32profile_functions
! };
! module = PyModule_Create(&win32profile_def);
! if (!module)
! return NULL;
! dict = PyModule_GetDict(module);
! if (!dict)
! return NULL;
! #endif
// PROFILEINFO flags
--- 463,470 ----
! PYWIN_MODULE_INIT_FUNC(win32profile)
{
! PYWIN_MODULE_INIT_PREPARE(win32profile, win32profile_functions,
! "Interface to the User Profile Api.");
// PROFILEINFO flags
***************
*** 508,512 ****
hmodule=GetModuleHandle(L"Userenv.dll");
if (hmodule==NULL)
! hmodule = LoadLibrary(L"Userenv.dll");
if (hmodule!=NULL){
pfnDeleteProfile=(DeleteProfilefunc)GetProcAddress(hmodule,"DeleteProfileW");
--- 480,484 ----
hmodule=GetModuleHandle(L"Userenv.dll");
if (hmodule==NULL)
! hmodule = LoadLibrary(L"Userenv.dll");
if (hmodule!=NULL){
pfnDeleteProfile=(DeleteProfilefunc)GetProcAddress(hmodule,"DeleteProfileW");
***************
*** 520,526 ****
pfnUnloadUserProfile=(UnloadUserProfilefunc)GetProcAddress(hmodule,"UnloadUserProfile");
}
- #if (PY_VERSION_HEX >= 0x03000000)
- return module;
- #endif
- }
--- 492,496 ----
pfnUnloadUserProfile=(UnloadUserProfilefunc)GetProcAddress(hmodule,"UnloadUserProfile");
}
+ PYWIN_MODULE_INIT_RETURN_SUCCESS;
+ }
Index: win32inet.i
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32inet.i,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -C2 -d -r1.10 -r1.10.2.1
*** win32inet.i 9 Apr 2008 04:31:07 -0000 1.10
--- win32inet.i 11 Dec 2008 04:13:35 -0000 1.10.2.1
***************
*** 66,69 ****
--- 66,73 ----
};
+ // NOTE: The PyHINTERNET class is only suitable for HINTERNET's returned
+ // from the win32inet functions. The WinHttp functions should use a
+ // HWINHTTP.
+
// @object PyHINTERNET|An object that wraps a HINTERNET handle. When the
// handle object is destroyed, it is automatically closed.
***************
*** 1924,1927 ****
--- 1928,1932 ----
extern void init_win32inetstuff();
extern PyObject *PyWinHttpGetIEProxyConfigForCurrentUser(PyObject *, PyObject *);
+ extern PyObject *PyWinHttpGetDefaultProxyConfiguration(PyObject *, PyObject *);
extern PyObject *PyWinHttpGetProxyForUrl(PyObject *, PyObject *);
extern PyObject *PyWinHttpOpen(PyObject *, PyObject *);
***************
*** 1929,1932 ****
--- 1934,1938 ----
%native(WinHttpGetIEProxyConfigForCurrentUser) PyWinHttpGetIEProxyConfigForCurrentUser;
+ %native(WinHttpGetDefaultProxyConfiguration) PyWinHttpGetDefaultProxyConfiguration;
%native(WinHttpGetProxyForUrl) PyWinHttpGetProxyForUrl;
%native(WinHttpOpen) PyWinHttpOpen;
Index: PyLARGE_INTEGER.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PyLARGE_INTEGER.cpp,v
retrieving revision 1.12.2.1
retrieving revision 1.12.2.2
diff -C2 -d -r1.12.2.1 -r1.12.2.2
*** PyLARGE_INTEGER.cpp 29 Aug 2008 04:59:25 -0000 1.12.2.1
--- PyLARGE_INTEGER.cpp 11 Dec 2008 04:13:35 -0000 1.12.2.2
***************
*** 22,33 ****
BOOL PyWinObject_AsLARGE_INTEGER(PyObject *ob, LARGE_INTEGER *pResult)
{
! pResult->QuadPart=PyLong_AsLongLong(ob);
! return !(pResult->QuadPart == -1 && PyErr_Occurred());
}
BOOL PyWinObject_AsULARGE_INTEGER(PyObject *ob, ULARGE_INTEGER *pResult)
{
! pResult->QuadPart=PyLong_AsUnsignedLongLong(ob);
! return !(pResult->QuadPart == (ULONGLONG) -1 && PyErr_Occurred());
}
--- 22,74 ----
BOOL PyWinObject_AsLARGE_INTEGER(PyObject *ob, LARGE_INTEGER *pResult)
{
! if (PyInt_Check(ob)) {
! // 32 bit integer value.
! int x = PyInt_AS_LONG(ob);
! if (x==(int)-1 && PyErr_Occurred())
! return FALSE;
! LISet32(*pResult, x);
! return TRUE;
! } else if (PyLong_Check(ob)) {
! pResult->QuadPart=PyLong_AsLongLong(ob);
! return !(pResult->QuadPart == -1 && PyErr_Occurred());
! } else {
! PyErr_Warn(PyExc_PendingDeprecationWarning, "Support for passing 2 integers to create a 64bit value is deprecated - pass a long instead");
! long hiVal, loVal;
! if (!PyArg_ParseTuple(ob, "ll", &hiVal, &loVal)) {
! PyErr_SetString(PyExc_TypeError, "LARGE_INTEGER must be 'int', or '(int, int)'");
! return FALSE;
! }
! // ### what to do about a "negative" loVal?!
! pResult->QuadPart = (((__int64)hiVal) << 32) | loVal;
! return TRUE;
! }
! assert(0); // not reached.
}
BOOL PyWinObject_AsULARGE_INTEGER(PyObject *ob, ULARGE_INTEGER *pResult)
{
! if (PyInt_Check(ob)) {
! // 32 bit integer value.
! int x = PyInt_AS_LONG(ob);
! if (x==(int)-1 && PyErr_Occurred())
! return FALSE;
! // ### what to do with "negative" integers? Nothing - they
! // get treated as unsigned!
! ULISet32(*pResult, x);
! return TRUE;
! } else if (PyLong_Check(ob)) {
! pResult->QuadPart=PyLong_AsUnsignedLongLong(ob);
! return !(pResult->QuadPart == (ULONGLONG) -1 && PyErr_Occurred());
! } else {
! PyErr_Warn(PyExc_PendingDeprecationWarning, "Support for passing 2 integers to create a 64bit value is deprecated - pass a long instead");
! long hiVal, loVal;
! if (!PyArg_ParseTuple(ob, "ll", &hiVal, &loVal)) {
! PyErr_SetString(PyExc_TypeError, "ULARGE_INTEGER must be 'int', or '(int, int)'");
! return FALSE;
! }
! pResult->QuadPart = (((__int64)hiVal) << 32) | loVal;
! return TRUE;
! }
! assert(0); // not reached.
}
Index: win32file.i
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32file.i,v
retrieving revision 1.93.2.4
retrieving revision 1.93.2.5
diff -C2 -d -r1.93.2.4 -r1.93.2.5
*** win32file.i 13 Nov 2008 15:12:49 -0000 1.93.2.4
--- win32file.i 11 Dec 2008 04:13:35 -0000 1.93.2.5
***************
*** 23,27 ****
%{
- #define UNICODE
#ifndef MS_WINCE
//#define FAR
--- 23,26 ----
***************
*** 29,33 ****
#define _WIN32_WINNT 0x0501
#endif
-
#include "winsock2.h"
#include "mswsock.h"
--- 28,31 ----
***************
*** 52,55 ****
--- 50,70 ----
%include "pywin32.i"
+ %{
+ // older python version's don't get the PyCObject structure definition
+ // exposed, and we need it to cleanly zap our handles (see
+ // CloseEncryptedFileRaw below).
+ // Fortunately, the PyCObject structure has been identical from versions
+ // 2.3->2.6 - and 2.6 is where it is first made public.
+ #if (PY_VERSION_HEX < 0x02060000)
+ typedef struct {
+ PyObject_HEAD
+ void *cobject;
+ void *desc;
+ void (*destructor)(void *);
+ } PyCObject;
+
+ #endif
+ %}
+
#define FILE_GENERIC_READ FILE_GENERIC_READ
#define FILE_GENERIC_WRITE FILE_GENERIC_WRITE
***************
*** 4010,4014 ****
void encryptedfilecontextdestructor(void *ctxt){
! if (pfnCloseEncryptedFileRaw)
(*pfnCloseEncryptedFileRaw)(ctxt);
}
--- 4025,4029 ----
void encryptedfilecontextdestructor(void *ctxt){
! if (pfnCloseEncryptedFileRaw && ctxt)
(*pfnCloseEncryptedFileRaw)(ctxt);
}
***************
*** 4203,4215 ****
CHECK_PFN(CloseEncryptedFileRaw);
PyObject *obctxt;
- PVOID ctxt;
if (!PyArg_ParseTuple(args, "O:CloseEncryptedFileRaw",
&obctxt)) // @pyparm PyCObject|Context||Context object returned from <om win32file.OpenEncryptedFileRaw>
return NULL;
! ctxt=PyCObject_AsVoidPtr(obctxt);
! if (ctxt==NULL)
! return NULL;
// function has no return value, make sure to check for memory leaks!
! (*pfnCloseEncryptedFileRaw)(ctxt);
Py_INCREF(Py_None);
return Py_None;
--- 4218,4239 ----
CHECK_PFN(CloseEncryptedFileRaw);
PyObject *obctxt;
if (!PyArg_ParseTuple(args, "O:CloseEncryptedFileRaw",
&obctxt)) // @pyparm PyCObject|Context||Context object returned from <om win32file.OpenEncryptedFileRaw>
return NULL;
! // We must nuke our ctxt in the CObject afer closing, else when the
! // object destructs and we attempt to close it a second time, Vista x64
! // crashes.
! // So must bypass the CObject API for this.
! if (!PyCObject_Check(obctxt))
! return PyErr_Format(PyExc_TypeError, "param must be handle to an encrypted file (got type %s)", obctxt->ob_type->tp_name);
! PyCObject *pcobj = (PyCObject *)obctxt;
! if (pcobj->destructor != encryptedfilecontextdestructor)
! return PyErr_Format(PyExc_TypeError, "param must be handle to an encrypted file (got a CObject with invalid destructor)");
! if (!pcobj->cobject)
! return PyErr_Format(PyExc_ValueError, "This handle has already been closed");
! // ok - close it, then nuke it.
// function has no return value, make sure to check for memory leaks!
! (*pfnCloseEncryptedFileRaw)(pcobj->cobject);
! pcobj->cobject = 0;
Py_INCREF(Py_None);
return Py_None;
***************
*** 5207,5225 ****
%init %{
- #if (PY_VERSION_HEX < 0x03000000)
- #define RETURN_ERROR return;
- #else
- #define RETURN_ERROR return NULL;
- #endif
-
if (PyType_Ready(&FindFileIterator_Type) == -1
||PyType_Ready(&PyDCB::type) == -1
||PyType_Ready(&PyCOMSTAT::type) == -1)
! RETURN_ERROR;
if (PyDict_SetItemString(d, "error", PyWinExc_ApiError) == -1)
! RETURN_ERROR;
if (PyDict_SetItemString(d, "INVALID_HANDLE_VALUE", PyWinLong_FromHANDLE(INVALID_HANDLE_VALUE)) == -1)
! RETURN_ERROR;
for (PyMethodDef *pmd = win32fileMethods;pmd->ml_name;pmd++)
--- 5231,5243 ----
%init %{
if (PyType_Ready(&FindFileIterator_Type) == -1
||PyType_Ready(&PyDCB::type) == -1
||PyType_Ready(&PyCOMSTAT::type) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
if (PyDict_SetItemString(d, "error", PyWinExc_ApiError) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
if (PyDict_SetItemString(d, "INVALID_HANDLE_VALUE", PyWinLong_FromHANDLE(INVALID_HANDLE_VALUE)) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
for (PyMethodDef *pmd = win32fileMethods;pmd->ml_name;pmd++)
Index: win32gui.i
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32gui.i,v
retrieving revision 1.118.2.3
retrieving revision 1.118.2.4
diff -C2 -d -r1.118.2.3 -r1.118.2.4
*** win32gui.i 11 Nov 2008 00:20:25 -0000 1.118.2.3
--- win32gui.i 11 Dec 2008 04:13:35 -0000 1.118.2.4
***************
*** 254,263 ****
// Written to the module init function.
%init %{
- #if (PY_VERSION_HEX < 0x03000000)
- #define RETURN_ERROR return;
- #else
- #define RETURN_ERROR return NULL;
- #endif
-
PyEval_InitThreads(); /* Start the interpreter's thread-awareness */
PyDict_SetItemString(d, "dllhandle", PyWinLong_FromVoidPtr(g_dllhandle));
--- 254,257 ----
***************
*** 267,271 ****
PyType_Ready(&PyBITMAPType) == -1 ||
PyType_Ready(&PyLOGFONTType) == -1)
! RETURN_ERROR;
// Expose the window procedure and window class dicts to aid debugging
--- 261,265 ----
PyType_Ready(&PyBITMAPType) == -1 ||
PyType_Ready(&PyLOGFONTType) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
// Expose the window procedure and window class dicts to aid debugging
***************
*** 1608,1612 ****
PyErr_SetString(PyExc_ValueError, "PyGetString: NULL is not valid pointer");
return NULL;
! }
if (len != -1){
if (IsBadReadPtr(addr, len)) {
--- 1602,1606 ----
PyErr_SetString(PyExc_ValueError, "PyGetString: NULL is not valid pointer");
return NULL;
! }
if (len != -1){
if (IsBadReadPtr(addr, len)) {
***************
*** 1615,1620 ****
}
return PyString_FromStringAndSize(addr, len);
! }
// This should probably be in a __try just in case.
return PyString_FromString(addr);
}
--- 1609,1618 ----
}
return PyString_FromStringAndSize(addr, len);
! }
// This should probably be in a __try just in case.
+ if (IsBadStringPtrA(addr, (DWORD_PTR)-1)) {
+ PyErr_SetString(PyExc_ValueError, "The value is not a valid null-terminated string");
+ return NULL;
+ }
return PyString_FromString(addr);
}
|