diff -urN pywin32-b304-orig/com/win32com/src/ErrorUtils.cpp pywin32-b304/com/win32com/src/ErrorUtils.cpp --- pywin32-b304-orig/com/win32com/src/ErrorUtils.cpp 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32com/src/ErrorUtils.cpp 2022-11-06 01:29:04.336883800 +0800 @@ -1076,18 +1076,18 @@ } static const RANGE_ENTRY hrRangeTable[] = { - MAKE_RANGE_ENTRY(CACHE_E), MAKE_RANGE_ENTRY(CACHE_S), MAKE_RANGE_ENTRY(CLASSFACTORY_E), - MAKE_RANGE_ENTRY(CLASSFACTORY_S), MAKE_RANGE_ENTRY(CLIENTSITE_E), MAKE_RANGE_ENTRY(CLIENTSITE_S), - MAKE_RANGE_ENTRY(CLIPBRD_E), MAKE_RANGE_ENTRY(CLIPBRD_S), MAKE_RANGE_ENTRY(CONVERT10_E), - MAKE_RANGE_ENTRY(CONVERT10_S), MAKE_RANGE_ENTRY(CO_E), MAKE_RANGE_ENTRY(CO_S), - MAKE_RANGE_ENTRY(DATA_E), MAKE_RANGE_ENTRY(DATA_S), MAKE_RANGE_ENTRY(DRAGDROP_E), - MAKE_RANGE_ENTRY(DRAGDROP_S), MAKE_RANGE_ENTRY(ENUM_E), MAKE_RANGE_ENTRY(ENUM_S), - MAKE_RANGE_ENTRY(INPLACE_E), MAKE_RANGE_ENTRY(INPLACE_S), MAKE_RANGE_ENTRY(MARSHAL_E), - MAKE_RANGE_ENTRY(MARSHAL_S), MAKE_RANGE_ENTRY(MK_E), MAKE_RANGE_ENTRY(MK_S), - MAKE_RANGE_ENTRY(OLEOBJ_E), MAKE_RANGE_ENTRY(OLEOBJ_S), MAKE_RANGE_ENTRY(OLE_E), - MAKE_RANGE_ENTRY(OLE_S), MAKE_RANGE_ENTRY(REGDB_E), MAKE_RANGE_ENTRY(REGDB_S), - MAKE_RANGE_ENTRY(VIEW_E), MAKE_RANGE_ENTRY(VIEW_S), MAKE_RANGE_ENTRY(CONNECT_E), - MAKE_RANGE_ENTRY(CONNECT_S), + MAKE_RANGE_ENTRY((LONG)CACHE_E), MAKE_RANGE_ENTRY((LONG)CACHE_S), MAKE_RANGE_ENTRY((LONG)CLASSFACTORY_E), + MAKE_RANGE_ENTRY((LONG)CLASSFACTORY_S), MAKE_RANGE_ENTRY((LONG)CLIENTSITE_E), MAKE_RANGE_ENTRY((LONG)CLIENTSITE_S), + MAKE_RANGE_ENTRY((LONG)CLIPBRD_E), MAKE_RANGE_ENTRY((LONG)CLIPBRD_S), MAKE_RANGE_ENTRY((LONG)CONVERT10_E), + MAKE_RANGE_ENTRY((LONG)CONVERT10_S), MAKE_RANGE_ENTRY((LONG)CO_E), MAKE_RANGE_ENTRY((LONG)CO_S), + MAKE_RANGE_ENTRY((LONG)DATA_E), MAKE_RANGE_ENTRY((LONG)DATA_S), MAKE_RANGE_ENTRY((LONG)DRAGDROP_E), + MAKE_RANGE_ENTRY((LONG)DRAGDROP_S), MAKE_RANGE_ENTRY((LONG)ENUM_E), MAKE_RANGE_ENTRY((LONG)ENUM_S), + MAKE_RANGE_ENTRY((LONG)INPLACE_E), MAKE_RANGE_ENTRY((LONG)INPLACE_S), MAKE_RANGE_ENTRY((LONG)MARSHAL_E), + MAKE_RANGE_ENTRY((LONG)MARSHAL_S), MAKE_RANGE_ENTRY((LONG)MK_E), MAKE_RANGE_ENTRY((LONG)MK_S), + MAKE_RANGE_ENTRY((LONG)OLEOBJ_E), MAKE_RANGE_ENTRY((LONG)OLEOBJ_S), MAKE_RANGE_ENTRY((LONG)OLE_E), + MAKE_RANGE_ENTRY((LONG)OLE_S), MAKE_RANGE_ENTRY((LONG)REGDB_E), MAKE_RANGE_ENTRY((LONG)REGDB_S), + MAKE_RANGE_ENTRY((LONG)VIEW_E), MAKE_RANGE_ENTRY((LONG)VIEW_S), MAKE_RANGE_ENTRY((LONG)CONNECT_E), + MAKE_RANGE_ENTRY((LONG)CONNECT_S), }; #undef MAKE_RANGE_ENTRY diff -urN pywin32-b304-orig/com/win32com/src/MiscTypes.cpp pywin32-b304/com/win32com/src/MiscTypes.cpp --- pywin32-b304-orig/com/win32com/src/MiscTypes.cpp 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32com/src/MiscTypes.cpp 2022-11-06 01:29:04.341884100 +0800 @@ -294,7 +294,7 @@ BOOL PyObject_AsOLEMENUGROUPWIDTHS(PyObject *oblpMenuWidths, OLEMENUGROUPWIDTHS *pWidths) { return PyArg_ParseTuple(oblpMenuWidths, "iiiiii", &pWidths->width[0], &pWidths->width[1], &pWidths->width[2], - &pWidths->width[3], &pWidths->width[4], &pWidths->width[5]) != NULL; + &pWidths->width[3], &pWidths->width[4], &pWidths->width[5]) != 0; } PyObject *PyObject_FromOLEMENUGROUPWIDTHS(const OLEMENUGROUPWIDTHS *pWidths) diff -urN pywin32-b304-orig/com/win32com/src/PyFactory.cpp pywin32-b304/com/win32com/src/PyFactory.cpp --- pywin32-b304-orig/com/win32com/src/PyFactory.cpp 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32com/src/PyFactory.cpp 2022-11-06 01:29:04.345884300 +0800 @@ -38,7 +38,7 @@ { LONG cRef = InterlockedDecrement(&m_cRef); if (cRef == 0) - delete this; + operator delete(this); return cRef; } diff -urN pywin32-b304-orig/com/win32com/src/PyIUnknown.cpp pywin32-b304/com/win32com/src/PyIUnknown.cpp --- pywin32-b304-orig/com/win32com/src/PyIUnknown.cpp 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32com/src/PyIUnknown.cpp 2022-11-06 01:29:04.348884500 +0800 @@ -31,8 +31,16 @@ { // @comm The repr of this object displays both the object's address, and its attached IUnknown's address char buf[256]; +#ifdef _MSC_VER _snprintf(buf, 256, "<%hs at 0x%0p with obj at 0x%0p>", ob_type->tp_name, this, m_obj); +#else + _snprintf(buf, 256, "<%s at 0x%p with obj at 0x%p>", ob_type->tp_name, this, m_obj); +#endif +#if (PY_VERSION_HEX < 0x03000000) + return PyBytes_FromString(buf); +#else return PyUnicode_FromString(buf); +#endif } /*static*/ IUnknown *PyIUnknown::GetI(PyObject *self) diff -urN pywin32-b304-orig/com/win32com/src/dllmain.cpp pywin32-b304/com/win32com/src/dllmain.cpp --- pywin32-b304-orig/com/win32com/src/dllmain.cpp 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32com/src/dllmain.cpp 2022-11-06 01:29:04.353884700 +0800 @@ -133,7 +133,7 @@ ** tell us). */ - /* We don't assume anything about Python's init state here! + /* We don't assume anything about Python's init state here! */ /* ** we don't need to be notified about threads @@ -309,7 +309,7 @@ PySys_SetArgv(argc, argv); #else PySys_SetArgv(argc, __wargv); -#endif; +#endif if (PyRun_SimpleFile(fp, (char *)fileName) != 0) { // Convert the Python error to a HRESULT. diff -urN pywin32-b304-orig/com/win32com/src/extensions/PyIPropertySetStorage.cpp pywin32-b304/com/win32com/src/extensions/PyIPropertySetStorage.cpp --- pywin32-b304-orig/com/win32com/src/extensions/PyIPropertySetStorage.cpp 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32com/src/extensions/PyIPropertySetStorage.cpp 2022-11-06 01:29:04.356884900 +0800 @@ -173,7 +173,7 @@ TmpPyObject obfmtid = PyWinObject_FromIID(rfmtid); if (obfmtid == NULL) return MAKE_PYCOM_GATEWAY_FAILURE_CODE("Create"); - hr = InvokeViaPolicy("Create", &result, "OOkk", obfmtid, obclsid, grfFlags, grfMode); + hr = InvokeViaPolicy("Create", &result, "OOkk", &obfmtid, &obclsid, grfFlags, grfMode); } if (FAILED(hr)) return hr; @@ -196,7 +196,7 @@ if (ppprstg == NULL) return E_POINTER; PyObject *result; - HRESULT hr = InvokeViaPolicy("Open", &result, "Ok", obfmtid, grfMode); + HRESULT hr = InvokeViaPolicy("Open", &result, "Ok", &obfmtid, grfMode); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params diff -urN pywin32-b304-orig/com/win32com/src/extensions/PyIPropertyStorage.cpp pywin32-b304/com/win32com/src/extensions/PyIPropertyStorage.cpp --- pywin32-b304-orig/com/win32com/src/extensions/PyIPropertyStorage.cpp 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32com/src/extensions/PyIPropertyStorage.cpp 2022-11-06 01:29:04.360885100 +0800 @@ -958,7 +958,7 @@ TmpPyObject obpropvars = PyObject_FromPROPVARIANTs((PROPVARIANT *)rgpropvar, cpspec); if (obpropvars == NULL) return MAKE_PYCOM_GATEWAY_FAILURE_CODE("WriteMultiple"); - hr = InvokeViaPolicy("WriteMultiple", NULL, "OOk", obpropspecs, obpropvars, propidNameFirst); + hr = InvokeViaPolicy("WriteMultiple", NULL, "OOk", &obpropspecs, &obpropvars, propidNameFirst); } return hr; } @@ -1052,7 +1052,7 @@ TmpPyObject obnames = PyWinObject_FromWCHARArray(rglpwstrName, cpropid); if (obnames == NULL) return MAKE_PYCOM_GATEWAY_FAILURE_CODE("WritePropertyNames"); - return InvokeViaPolicy("WritePropertyNames", NULL, "OO", obpropids, obnames); + return InvokeViaPolicy("WritePropertyNames", NULL, "OO", &obpropids, &obnames); } } @@ -1137,7 +1137,7 @@ Py_INCREF(Py_None); obmtime = Py_None; } - hr = InvokeViaPolicy("SetTimes", NULL, "OOO", obctime, obatime, obmtime); + hr = InvokeViaPolicy("SetTimes", NULL, "OOO", &obctime, &obatime, &obmtime); } return hr; } diff -urN pywin32-b304-orig/com/win32com/src/include/PythonCOM.h pywin32-b304/com/win32com/src/include/PythonCOM.h --- pywin32-b304-orig/com/win32com/src/include/PythonCOM.h 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32com/src/include/PythonCOM.h 2022-11-06 01:29:04.364885400 +0800 @@ -110,10 +110,21 @@ #ifdef __MINGW32__ // Special Mingw32 considerations. -#define NO_PYCOM_ENUMSTATPROPSTG +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0601 +#undef _WIN32_IE +#define _WIN32_IE 0x0700 + #define __try try -#define __except catch +#define __except(filter) catch(...) #include +#include +#include +#include +#include +#include +#include + #endif // __MINGW32__ @@ -432,9 +443,9 @@ // We need to dynamically create C++ Python objects // These helpers allow each type object to create it. #define MAKE_PYCOM_CTOR(classname) \ - static PyIUnknown *classname::PyObConstruct(IUnknown *pInitObj) { return new classname(pInitObj); } + static PyIUnknown *PyObConstruct(IUnknown *pInitObj) { return new classname(pInitObj); } #define MAKE_PYCOM_CTOR_ERRORINFO(classname, iid) \ - static PyIUnknown *classname::PyObConstruct(IUnknown *pInitObj) { return new classname(pInitObj); } \ + static PyIUnknown *PyObConstruct(IUnknown *pInitObj) { return new classname(pInitObj); } \ static PyObject *SetPythonCOMError(PyObject *self, HRESULT hr) \ { \ return PyCom_BuildPyException(hr, GetI(self), iid); \ diff -urN pywin32-b304-orig/com/win32com/src/include/PythonCOMServer.h pywin32-b304/com/win32com/src/include/PythonCOMServer.h --- pywin32-b304-orig/com/win32com/src/include/PythonCOMServer.h 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32com/src/include/PythonCOMServer.h 2022-11-06 01:29:04.369885700 +0800 @@ -29,7 +29,7 @@ // other than IUnknown #define PYGATEWAY_MAKE_SUPPORT2(classname, IInterface, theIID, gatewaybaseclass) \ public: \ - static HRESULT classname::PyGatewayConstruct(PyObject *pPyInstance, PyGatewayBase *unkBase, void **ppResult, \ + static HRESULT PyGatewayConstruct(PyObject *pPyInstance, PyGatewayBase *unkBase, void **ppResult, \ REFIID iid) \ { \ if (ppResult == NULL) \ @@ -134,7 +134,7 @@ // Basically just PYGATEWAY_MAKE_SUPPORT(PyGatewayBase, IDispatch, IID_IDispatch); // but with special handling as its the base class. - static HRESULT PyGatewayBase::PyGatewayConstruct(PyObject *pPyInstance, PyGatewayBase *gatewayBase, void **ppResult, + static HRESULT PyGatewayConstruct(PyObject *pPyInstance, PyGatewayBase *gatewayBase, void **ppResult, REFIID iid) { if (ppResult == NULL) diff -urN pywin32-b304-orig/com/win32com/src/univgw.cpp pywin32-b304/com/win32com/src/univgw.cpp --- pywin32-b304-orig/com/win32com/src/univgw.cpp 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32com/src/univgw.cpp 2022-11-06 01:29:04.374885900 +0800 @@ -253,7 +253,7 @@ } *(int *)(code + 30) = index; - *(void **)(code + 36) = &univgw_dispatch; + *(void **)(code + 36) = (void*)&univgw_dispatch; DWORD oldprotect; if (!VirtualProtect(code, sizeof(wrapper), PAGE_EXECUTE, &oldprotect)) { diff -urN pywin32-b304-orig/com/win32comext/adsi/src/PyADSIUtil.cpp pywin32-b304/com/win32comext/adsi/src/PyADSIUtil.cpp --- pywin32-b304-orig/com/win32comext/adsi/src/PyADSIUtil.cpp 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32comext/adsi/src/PyADSIUtil.cpp 2022-11-06 01:29:04.378886200 +0800 @@ -315,7 +315,7 @@ static void deallocFunc(PyObject *ob) { delete (PyADS_OBJECT_INFO *)ob; } static struct PyMemberDef memberlist[]; - static PyTypeObject PyADS_OBJECT_INFO::Type; + static PyTypeObject Type; protected: PyObject *obRDN, *obObjectDN, *obParentDN, *obClassName; @@ -473,7 +473,7 @@ //#pragma warning( disable : 4251 ) static struct PyMemberDef memberlist[]; //#pragma warning( default : 4251 ) - static PyTypeObject PyADS_ATTR_INFO::Type; + static PyTypeObject Type; protected: DWORD dwControlCode; diff -urN pywin32-b304-orig/com/win32comext/adsi/src/PyIADs.cpp pywin32-b304/com/win32comext/adsi/src/PyIADs.cpp --- pywin32-b304-orig/com/win32comext/adsi/src/PyIADs.cpp 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32comext/adsi/src/PyIADs.cpp 2022-11-06 01:29:04.382886400 +0800 @@ -4,8 +4,8 @@ // getattr for the type. // All "get_" methods have been exposed as properties. -#include "pythoncom.h" -#include "PyADSIutil.h" +#include "PythonCOM.h" +#include "PyADSIUtil.h" #include "PyIADs.h" // @doc - This file contains autoduck documentation diff -urN pywin32-b304-orig/com/win32comext/adsi/src/PyIDirectoryObject.i pywin32-b304/com/win32comext/adsi/src/PyIDirectoryObject.i --- pywin32-b304-orig/com/win32comext/adsi/src/PyIDirectoryObject.i 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32comext/adsi/src/PyIDirectoryObject.i 2022-11-06 01:29:04.386886600 +0800 @@ -120,17 +120,17 @@ if (!PyArg_ParseTuple(args, "OO:CreateDSObject", &obName, &obAttr)) return NULL; - WCHAR *szName= NULL; - if (!PyWinObject_AsWCHAR(obName, &szName, FALSE)) - return NULL; + WCHAR *szName= NULL; + if (!PyWinObject_AsWCHAR(obName, &szName, FALSE)) + return NULL; PADS_ATTR_INFO attr; DWORD cattr; if (!PyADSIObject_AsADS_ATTR_INFOs(obAttr, &attr, &cattr)) { - PyWinObject_FreeWCHAR(szName); + PyWinObject_FreeWCHAR(szName); return NULL; - } - IDispatch *pRet = NULL; + } + IDispatch *pRet = NULL; Py_BEGIN_ALLOW_THREADS _result = (HRESULT )_swig_self->CreateDSObject(szName, attr, cattr, &pRet); diff -urN pywin32-b304-orig/com/win32comext/adsi/src/PyIDirectorySearch.i pywin32-b304/com/win32comext/adsi/src/PyIDirectorySearch.i --- pywin32-b304-orig/com/win32comext/adsi/src/PyIDirectorySearch.i 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32comext/adsi/src/PyIDirectorySearch.i 2022-11-06 01:29:04.389886800 +0800 @@ -81,9 +81,9 @@ // @pyparm [, ...]|attrNames|| if (!PyArg_ParseTuple(args, "OO", &obFilter, &obNames)) return NULL; - WCHAR *szFilter = NULL; - if (!PyWinObject_AsWCHAR(obFilter, &szFilter, FALSE)) - return NULL; + WCHAR *szFilter = NULL; + if (!PyWinObject_AsWCHAR(obFilter, &szFilter, FALSE)) + return NULL; WCHAR **names = NULL; DWORD cnames = -1; @@ -94,7 +94,7 @@ } HRESULT _result; - ADS_SEARCH_HANDLE handle; + ADS_SEARCH_HANDLE handle; Py_BEGIN_ALLOW_THREADS _result = (HRESULT )_swig_self->ExecuteSearch(szFilter, names, cnames, &handle); @@ -106,7 +106,7 @@ ret = PyLong_FromSsize_t((Py_ssize_t)handle); } PyADSI_FreeNames(names, cnames); - PyWinObject_FreeWCHAR(szFilter); + PyWinObject_FreeWCHAR(szFilter); return ret; } diff -urN pywin32-b304-orig/com/win32comext/adsi/src/adsilib.i pywin32-b304/com/win32comext/adsi/src/adsilib.i --- pywin32-b304-orig/com/win32comext/adsi/src/adsilib.i 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32comext/adsi/src/adsilib.i 2022-11-06 01:29:04.393887000 +0800 @@ -1,7 +1,12 @@ /* ADSI SWIG Support */ +typedef VARIANT VARIANT; +typedef ADS_OBJECT_INFO ADS_OBJECT_INFO; +typedef IDataObject IDataObject; +typedef IDispatch IDispatch; + %{ -#include "pyadsiutil.h" +#include "PyADSIUtil.h" extern PyObject *OleSetADSIError(HRESULT hr, IUnknown *pUnk, REFIID iid); %} diff -urN pywin32-b304-orig/com/win32comext/authorization/src/PyGSecurityInformation.h pywin32-b304/com/win32comext/authorization/src/PyGSecurityInformation.h --- pywin32-b304-orig/com/win32comext/authorization/src/PyGSecurityInformation.h 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32comext/authorization/src/PyGSecurityInformation.h 2022-11-06 01:29:04.396887200 +0800 @@ -22,7 +22,7 @@ ObjectInfoAcquired = FALSE; } PYGATEWAY_MAKE_SUPPORT2(PyGSecurityInformation, ISecurityInformation, IID_ISecurityInformation, PyGatewayBase) - PyGSecurityInformation::~PyGSecurityInformation(void); + ~PyGSecurityInformation(void); // ISecurityInformation // @pymeth GetObjectInformation|Returns information identifying the object diff -urN pywin32-b304-orig/com/win32comext/axcontrol/src/PyIOleInPlaceSiteWindowless.cpp pywin32-b304/com/win32comext/axcontrol/src/PyIOleInPlaceSiteWindowless.cpp --- pywin32-b304-orig/com/win32comext/axcontrol/src/PyIOleInPlaceSiteWindowless.cpp 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32comext/axcontrol/src/PyIOleInPlaceSiteWindowless.cpp 2022-11-06 01:29:04.400887400 +0800 @@ -394,7 +394,7 @@ /* [in] */ BOOL fErase) { PY_GATEWAY_METHOD; - HRESULT hr = InvokeViaPolicy("InvalidateRgn", NULL, "li", (long)hRGN, fErase); + HRESULT hr = InvokeViaPolicy("InvalidateRgn", NULL, "li", (LONG_PTR)hRGN, fErase); return hr; } diff -urN pywin32-b304-orig/com/win32comext/axcontrol/src/PyIViewObject.cpp pywin32-b304/com/win32comext/axcontrol/src/PyIViewObject.cpp --- pywin32-b304-orig/com/win32comext/axcontrol/src/PyIViewObject.cpp 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32comext/axcontrol/src/PyIViewObject.cpp 2022-11-06 01:29:04.404887700 +0800 @@ -256,7 +256,7 @@ Py_BuildValue("llll", lprcWBounds->left, lprcWBounds->top, lprcWBounds->right, lprcWBounds->bottom); if (oblprcWBounds == NULL) return PyCom_HandlePythonFailureToCOM(); - PyObject *obFuncContinue = PyLong_FromVoidPtr(pfnContinue); + PyObject *obFuncContinue = PyLong_FromVoidPtr((PVOID)pfnContinue); if (obFuncContinue == NULL) return PyCom_HandlePythonFailureToCOM(); PyObject *obContinue = PyWinObject_FromULONG_PTR(dwContinue); diff -urN pywin32-b304-orig/com/win32comext/ifilter/src/stdafx.h pywin32-b304/com/win32comext/ifilter/src/stdafx.h --- pywin32-b304-orig/com/win32comext/ifilter/src/stdafx.h 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32comext/ifilter/src/stdafx.h 2022-11-06 01:29:04.467891300 +0800 @@ -13,7 +13,9 @@ #include #include +#ifndef __MINGW32__ #define MISSING_PROPSTG +#endif #ifdef MISSING_PROPSTG // Ack - NTQuery.h is failing with the Vista SDK - pull in what we need // Problem is missing propstg.h, and all the work-arounds are uglier than diff -urN pywin32-b304-orig/com/win32comext/mapi/src/PyIAddrBook.i pywin32-b304/com/win32comext/mapi/src/PyIAddrBook.i --- pywin32-b304-orig/com/win32comext/mapi/src/PyIAddrBook.i 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32comext/mapi/src/PyIAddrBook.i 2022-11-06 01:29:04.408887900 +0800 @@ -39,14 +39,14 @@ // @pyswig |OpenEntry|Opens a folder or message and returns an interface object for further access. PyObject *PyIAddrBook::OpenEntry(PyObject *self, PyObject *args) { - HRESULT _result; - char * entryString; + HRESULT _result; + char * entryString; int entryStrLen; - IID iid; + IID iid; IID *pIID; - PyObject * objIID = 0; - unsigned long flags; - IUnknown * pUnk = NULL; + PyObject * objIID = 0; + unsigned long flags; + IUnknown * pUnk = NULL; ULONG resType; PyObject *obEntry; @@ -55,8 +55,8 @@ // @pyparm string|entryId||The entryID of the object // @pyparm |iid||The IID of the object to return, or None for the default IID // @pyparm int|flags||Bitmask of flags that controls how the object is opened. - if(!PyArg_ParseTuple(args,"OOl:OpenEntry",&obEntry, &objIID,&flags)) - return NULL; + if(!PyArg_ParseTuple(args,"OOl:OpenEntry",&obEntry, &objIID,&flags)) + return NULL; if (obEntry==Py_None) { entryString = NULL; entryStrLen = 0; @@ -75,12 +75,12 @@ return NULL; } Py_BEGIN_ALLOW_THREADS - _result = (HRESULT )_swig_self->OpenEntry(entryStrLen,(ENTRYID *)entryString,pIID,flags, &resType, &pUnk); + _result = (HRESULT )_swig_self->OpenEntry(entryStrLen,(ENTRYID *)entryString,pIID,flags, &resType, &pUnk); Py_END_ALLOW_THREADS - if (FAILED(_result)) { - return OleSetOleError(_result); - } - return PyMAPIObject_FromTypedUnknown( resType, pUnk, FALSE /*bAddRef*/); + if (FAILED(_result)) { + return OleSetOleError(_result); + } + return PyMAPIObject_FromTypedUnknown( resType, pUnk, FALSE /*bAddRef*/); } %} @@ -101,17 +101,17 @@ IAddrBook *_swig_self; PyObject *obE1, *obE2; if ((_swig_self=GetI(self))==NULL) return NULL; - if(!PyArg_ParseTuple(args,"OO|i:CompareEntryIDs", + if(!PyArg_ParseTuple(args,"OO|i:CompareEntryIDs", &obE1, // @pyparm string|entryId||The first entry ID to be compared &obE2, // @pyparm string|entryId||The second entry ID to be compared &flags)) // @pyparm int|flags|0|Reserved - must be zero. - goto done; + goto done; if (!PyWinObject_AsString(obE1, (char **)&peid1, FALSE, &cb1)) - goto done; + goto done; if (!PyWinObject_AsString(obE2, (char **)&peid2, FALSE, &cb2)) - goto done; + goto done; Py_BEGIN_ALLOW_THREADS hr=_swig_self->CompareEntryIDs(cb1, peid1, cb2, peid2, flags, &ulResult); diff -urN pywin32-b304-orig/com/win32comext/mapi/src/PyIConverterSession.i pywin32-b304/com/win32comext/mapi/src/PyIConverterSession.i --- pywin32-b304-orig/com/win32comext/mapi/src/PyIConverterSession.i 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32comext/mapi/src/PyIConverterSession.i 2022-11-06 01:29:04.412888100 +0800 @@ -72,9 +72,12 @@ IMessage *pMsg = NULL; if (!PyCom_InterfaceFromPyObject(obStream, IID_IStream, (void **)&pStream, FALSE)) - goto done; + if (pStream) + pStream->Release(); + if (!PyCom_InterfaceFromPyObject(obMsg, IID_IMessage, (void **)&pMsg, FALSE)) - goto done; + if (pMsg) + pMsg->Release(); { PY_INTERFACE_PRECALL; @@ -90,12 +93,6 @@ result = Py_None; } -done: - if (pStream) - pStream->Release(); - if (pMsg) - pMsg->Release(); - return result; } @@ -117,9 +114,12 @@ IMessage *pMsg = NULL; if (!PyCom_InterfaceFromPyObject(obMsg, IID_IMessage, (void **)&pMsg, FALSE)) - goto done; + if (pStream) + pStream->Release(); + if (!PyCom_InterfaceFromPyObject(obStream, IID_IStream, (void **)&pStream, FALSE)) - goto done; + if (pMsg) + pMsg->Release(); { PY_INTERFACE_PRECALL; @@ -135,12 +135,6 @@ result = Py_None; } -done: - if (pStream) - pStream->Release(); - if (pMsg) - pMsg->Release(); - return result; } diff -urN pywin32-b304-orig/com/win32comext/mapi/src/PyIMAPIContainer.i pywin32-b304/com/win32comext/mapi/src/PyIMAPIContainer.i --- pywin32-b304-orig/com/win32comext/mapi/src/PyIMAPIContainer.i 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32comext/mapi/src/PyIMAPIContainer.i 2022-11-06 01:29:04.416888300 +0800 @@ -30,24 +30,24 @@ // @pyswig |OpenEntry|Opens an object and returns an interface object for further access. PyObject *PyIMAPIContainer::OpenEntry(PyObject *self, PyObject *args) { - HRESULT _result; - char * entryString; + HRESULT _result; + char * entryString; int entryStrLen; - IID iid; + IID iid; IID *pIID; - PyObject * objIID = 0; - unsigned long flags; - IUnknown * pUnk = NULL; + PyObject * objIID = 0; + unsigned long flags; + IUnknown * pUnk = NULL; ULONG resType; PyObject *obEntry; IMAPIContainer *_swig_self; if ((_swig_self=GetI(self))==NULL) return NULL; - // @pyparm string|entryId||The EntryID to open. - // @pyparm |iid||The IID of the returned interface, or None for the default interface. - // @pyparm int|flags||Flags for the call. May include MAPI_BEST_ACCESS, MAPI_DEFERRED_ERRORS, MAPI_MODIFY and possibly others (see the MAPI documentation) - if(!PyArg_ParseTuple(args,"OOl:OpenEntry",&obEntry, &objIID,&flags)) - return NULL; + // @pyparm string|entryId||The EntryID to open. + // @pyparm |iid||The IID of the returned interface, or None for the default interface. + // @pyparm int|flags||Flags for the call. May include MAPI_BEST_ACCESS, MAPI_DEFERRED_ERRORS, MAPI_MODIFY and possibly others (see the MAPI documentation) + if(!PyArg_ParseTuple(args,"OOl:OpenEntry",&obEntry, &objIID,&flags)) + return NULL; if (obEntry==Py_None) { entryString = NULL; entryStrLen = 0; @@ -66,12 +66,12 @@ return NULL; } Py_BEGIN_ALLOW_THREADS - _result = (HRESULT )_swig_self->OpenEntry(entryStrLen,(ENTRYID *)entryString,pIID,flags, &resType, &pUnk); + _result = (HRESULT )_swig_self->OpenEntry(entryStrLen,(ENTRYID *)entryString,pIID,flags, &resType, &pUnk); Py_END_ALLOW_THREADS - if (FAILED(_result)) { - return OleSetOleError(_result); - } - return PyMAPIObject_FromTypedUnknown( resType, pUnk, FALSE /*bAddRef*/); + if (FAILED(_result)) { + return OleSetOleError(_result); + } + return PyMAPIObject_FromTypedUnknown( resType, pUnk, FALSE /*bAddRef*/); } diff -urN pywin32-b304-orig/com/win32comext/mapi/src/PyIMAPIFolder.i pywin32-b304/com/win32comext/mapi/src/PyIMAPIFolder.i --- pywin32-b304-orig/com/win32comext/mapi/src/PyIMAPIFolder.i 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32comext/mapi/src/PyIMAPIFolder.i 2022-11-06 01:29:04.420888600 +0800 @@ -43,10 +43,10 @@ IMAPIFolder *_swig_self; if ((_swig_self=GetI(self))==NULL) return NULL; - if(!PyArg_ParseTuple(args,"l|l:GetLastError", + if(!PyArg_ParseTuple(args,"l|l:GetLastError", &hr, // @pyparm int|hr||Contains the error code generated in the previous method call. &flags)) // @pyparm int|flags||Indicates for format for the output. - return NULL; + return NULL; Py_BEGIN_ALLOW_THREADS hRes = _swig_self->GetLastError(hr, flags, &me); @@ -156,12 +156,12 @@ IMAPIFolder *_swig_self; if ((_swig_self=GetI(self))==NULL) return NULL; - if(!PyArg_ParseTuple(args,"OOO|l:DeleteFolder", + if(!PyArg_ParseTuple(args,"OOO|l:DeleteFolder", &obEntryId, // @pyparm string|entryId||The EntryID of the subfolder to delete. &obUIParam, // @pyparm long|uiParam||Handle of the parent window of the progress indicator. &obProgress, // @pyparm |progress||A progress object, or None &flags)) - return NULL; + return NULL; if (PyBytes_Check(obEntryId)) { eid = (LPENTRYID)PyBytes_AsString(obEntryId); cbEID = PyBytes_Size(obEntryId); diff -urN pywin32-b304-orig/com/win32comext/mapi/src/PyIMAPIProp.i pywin32-b304/com/win32comext/mapi/src/PyIMAPIProp.i --- pywin32-b304-orig/com/win32comext/mapi/src/PyIMAPIProp.i 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32comext/mapi/src/PyIMAPIProp.i 2022-11-06 01:29:04.424888800 +0800 @@ -36,29 +36,29 @@ // @pyswig int, [items, ]|GetProps|Returns a list of property values. PyObject *PyIMAPIProp::GetProps(PyObject *self, PyObject *args) { - PyObject * _resultobj; - HRESULT _result; - SPropTagArray * _arg0 = NULL; - unsigned long _arg1=0; - PyObject * _obj0 = 0; + PyObject * _resultobj; + HRESULT _result; + SPropTagArray * _arg0 = NULL; + unsigned long _arg1=0; + PyObject * _obj0 = 0; IMAPIProp *_swig_self; if ((_swig_self=GetI(self))==NULL) return NULL; // @pyparm |propList||The list of properties // @pyparm int|flags|0| - if(!PyArg_ParseTuple(args,"O|l:GetProps",&_obj0,&_arg1)) - return NULL; + if(!PyArg_ParseTuple(args,"O|l:GetProps",&_obj0,&_arg1)) + return NULL; if (!PyMAPIObject_AsSPropTagArray(_obj0, &_arg0)) return NULL; ULONG numValues; SPropValue *pv; Py_BEGIN_ALLOW_THREADS - _result = (HRESULT )_swig_self->GetProps(_arg0,_arg1, &numValues, &pv); + _result = (HRESULT )_swig_self->GetProps(_arg0,_arg1, &numValues, &pv); Py_END_ALLOW_THREADS PyMAPIObject_FreeSPropTagArray(_arg0); - if (FAILED(_result)) { - return OleSetOleError(_result); - } + if (FAILED(_result)) { + return OleSetOleError(_result); + } _resultobj = PyTuple_New(numValues); if (_resultobj==NULL) { @@ -86,7 +86,7 @@ PyObject *PyIMAPIProp::DeleteProps(PyObject *self, PyObject *args) { PyObject *obs; - SPropTagArray * _arg0; + SPropTagArray * _arg0; HRESULT hr; IMAPIProp *pMAPIProp; PyObject *obWantProblems = Py_False; @@ -94,7 +94,7 @@ if ((pMAPIProp=GetI(self))==NULL) return NULL; // @pyparm |propList||The list of properties // @pyparm bool|wantProblems|False|Return detailed error information - if(!PyArg_ParseTuple(args,"O|O:DeleteProps",&obs, &obWantProblems)) + if(!PyArg_ParseTuple(args,"O|O:DeleteProps",&obs, &obWantProblems)) return NULL; int wantProblems = PyObject_IsTrue(obWantProblems); if (wantProblems == -1) @@ -128,7 +128,7 @@ if ((pMAPIProp=GetI(self))==NULL) return NULL; // @pyparm [, ]|propList||The list of properties // @pyparm bool|wantProblems|False|Return detailed error information - if(!PyArg_ParseTuple(args,"O|O:SetProps",&obs, &obWantProblems)) + if(!PyArg_ParseTuple(args,"O|O:SetProps",&obs, &obWantProblems)) return NULL; if (!PySequence_Check(obs)) { PyErr_SetString(PyExc_TypeError, "Properties must be a sequence of tuples"); @@ -183,7 +183,7 @@ // @pyparm |dest||The destination object // @pyparm int|flags||flags // @pyparm bool|wantProblems|False|Return detailed error information - if(!PyArg_ParseTuple(args,"OOlzOOl|O:CopyTo",&obIIDExclude, &obPropTags, &ulUIParam, &szIgnore, &obIID, &obDest, &flags, &obWantProblems)) + if(!PyArg_ParseTuple(args,"OOlzOOl|O:CopyTo",&obIIDExclude, &obPropTags, &ulUIParam, &szIgnore, &obIID, &obDest, &flags, &obWantProblems)) return NULL; int wantProblems = PyObject_IsTrue(obWantProblems); if (wantProblems == -1) @@ -264,7 +264,7 @@ // @pyparm |dest||The destination object // @pyparm int|flags||flags // @pyparm bool|wantProblems|False|Return detailed error information - if(!PyArg_ParseTuple(args,"OlzOOl|O:CopyProps",&obPropTags, &ulUIParam, &szIgnore, &obIID, &obDest, &flags, &obWantProblems)) + if(!PyArg_ParseTuple(args,"OlzOOl|O:CopyProps",&obPropTags, &ulUIParam, &szIgnore, &obIID, &obDest, &flags, &obWantProblems)) return NULL; int wantProblems = PyObject_IsTrue(obWantProblems); if (wantProblems == -1) @@ -314,7 +314,7 @@ // @pyparm |iid||The IID of the resulting interface. // @pyparm int|interfaceOptions||Data that relates to the interface identified by the lpiid parameter. // @pyparm int|flags||flags - if(!PyArg_ParseTuple(args,"kOll:OpenProperty",&propTag, &obIID, &interfaceOptions, &flags)) + if(!PyArg_ParseTuple(args,"kOll:OpenProperty",&propTag, &obIID, &interfaceOptions, &flags)) return NULL; // IID. if (!PyWinObject_AsIID(obIID, &iid)) @@ -418,10 +418,10 @@ IMAPIProp *_swig_self; if ((_swig_self=GetI(self))==NULL) return NULL; - if(!PyArg_ParseTuple(args,"l|l:GetLastError", + if(!PyArg_ParseTuple(args,"l|l:GetLastError", &hr, // @pyparm int|hr||Contains the error code generated in the previous method call. &flags)) // @pyparm int|flags||Indicates for format for the output. - return NULL; + return NULL; Py_BEGIN_ALLOW_THREADS hRes = _swig_self->GetLastError(hr, flags, &me); diff -urN pywin32-b304-orig/com/win32comext/mapi/src/PyIMAPISession.i pywin32-b304/com/win32comext/mapi/src/PyIMAPISession.i --- pywin32-b304-orig/com/win32comext/mapi/src/PyIMAPISession.i 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32comext/mapi/src/PyIMAPISession.i 2022-11-06 01:29:04.429889100 +0800 @@ -35,14 +35,14 @@ // @pyswig |OpenEntry|Opens an object and returns an interface object for further access. PyObject *PyIMAPISession::OpenEntry(PyObject *self, PyObject *args) { - HRESULT _result; - char *entryString; + HRESULT _result; + char *entryString; int entryStrLen; - IID iid; + IID iid; IID *pIID; - PyObject * objIID = 0; - unsigned long flags; - IUnknown * pUnk = NULL; + PyObject * objIID = 0; + unsigned long flags; + IUnknown * pUnk = NULL; ULONG resType; PyObject *obEntry; @@ -51,8 +51,8 @@ // @pyparm string|entryId||The EntryID to open. // @pyparm |iid||The IID of the returned interface, or None for the default interface. // @pyparm int|flags||Flags for the call. May include MAPI_BEST_ACCESS, MAPI_DEFERRED_ERRORS, MAPI_MODIFY and possibly others (see the MAPI documentation) - if(!PyArg_ParseTuple(args,"OOl:OpenEntry", &obEntry, &objIID, &flags)) - return NULL; + if(!PyArg_ParseTuple(args,"OOl:OpenEntry", &obEntry, &objIID, &flags)) + return NULL; if (obEntry==Py_None) { entryString = NULL; entryStrLen = 0; @@ -71,11 +71,11 @@ return NULL; } Py_BEGIN_ALLOW_THREADS - _result = (HRESULT )_swig_self->OpenEntry(entryStrLen,(ENTRYID *)entryString,pIID,flags, &resType, &pUnk); + _result = (HRESULT )_swig_self->OpenEntry(entryStrLen,(ENTRYID *)entryString,pIID,flags, &resType, &pUnk); Py_END_ALLOW_THREADS - if (FAILED(_result)) { - return OleSetOleError(_result); - } + if (FAILED(_result)) { + return OleSetOleError(_result); + } return PyMAPIObject_FromTypedUnknown( resType, pUnk, FALSE /*bAddRef*/); } %} @@ -85,24 +85,24 @@ // @pyswig |OpenMsgStore|Opens a message store. PyObject *PyIMAPISession::OpenMsgStore(PyObject *self, PyObject *args) { - HRESULT _result; - char * entryString; + HRESULT _result; + char * entryString; Py_ssize_t entryStrLen; - IID iid; + IID iid; IID *pIID; - PyObject * objIID = 0; - unsigned long ulParm; - unsigned long flags; - IMsgStore * pMS = NULL; + PyObject * objIID = 0; + unsigned long ulParm; + unsigned long flags; + IMsgStore * pMS = NULL; IMAPISession *_swig_self; if ((_swig_self=GetI(self))==NULL) return NULL; - // @pyparm int|uiParam||Handle to the parent window for dialogs. - // @pyparm string|entryId||The entry ID of the message store to open. - // @pyparm |iid||The IID of the interface returned, or None - // @pyparm int|flags||Options for the call. - if(!PyArg_ParseTuple(args,"ls#Ol:OpenMsgStore",&ulParm,&entryString,&entryStrLen, &objIID,&flags)) - return NULL; + // @pyparm int|uiParam||Handle to the parent window for dialogs. + // @pyparm string|entryId||The entry ID of the message store to open. + // @pyparm |iid||The IID of the interface returned, or None + // @pyparm int|flags||Options for the call. + if(!PyArg_ParseTuple(args,"ls#Ol:OpenMsgStore",&ulParm,&entryString,&entryStrLen, &objIID,&flags)) + return NULL; if (objIID==Py_None) pIID = NULL; else { @@ -111,13 +111,13 @@ return NULL; } Py_BEGIN_ALLOW_THREADS - _result = (HRESULT )_swig_self->OpenMsgStore(ulParm, entryStrLen,(ENTRYID *)entryString,pIID,flags,&pMS); + _result = (HRESULT )_swig_self->OpenMsgStore(ulParm, entryStrLen,(ENTRYID *)entryString,pIID,flags,&pMS); Py_END_ALLOW_THREADS - if (FAILED(_result)) { - return OleSetOleError(_result); - } - // @comm The result is the interface specified by the IID, or IID_IMsgStore if None is used. - return PyCom_PyObjectFromIUnknown(pMS, pIID ? *pIID : IID_IMsgStore, FALSE /*bAddRef*/ ); + if (FAILED(_result)) { + return OleSetOleError(_result); + } + // @comm The result is the interface specified by the IID, or IID_IMsgStore if None is used. + return PyCom_PyObjectFromIUnknown(pMS, pIID ? *pIID : IID_IMsgStore, FALSE /*bAddRef*/ ); } %} @@ -131,8 +131,8 @@ LPENTRYID peid; IMAPISession *_swig_self; if ((_swig_self=GetI(self))==NULL) return NULL; - if(!PyArg_ParseTuple(args,":QueryIdentity")) - return NULL; + if(!PyArg_ParseTuple(args,":QueryIdentity")) + return NULL; HRESULT _result; Py_BEGIN_ALLOW_THREADS @@ -142,8 +142,8 @@ if (_result==S_OK) rc = PyBytes_FromStringAndSize((char *)peid, cb); else if (FAILED(_result)) { - rc = OleSetOleError(_result); - } else { + rc = OleSetOleError(_result); + } else { rc = Py_None; Py_INCREF(Py_None); } @@ -223,17 +223,17 @@ IMAPISession *_swig_self; PyObject *obE1, *obE2; if ((_swig_self=GetI(self))==NULL) return NULL; - if(!PyArg_ParseTuple(args,"OO|i:CompareEntryIDs", + if(!PyArg_ParseTuple(args,"OO|i:CompareEntryIDs", &obE1, // @pyparm string|entryId||The first entry ID to be compared &obE2, // @pyparm string|entryId||The second entry ID to be compared &flags)) // @pyparm int|flags|0|Reserved - must be zero. - goto done; + goto done; if (!PyWinObject_AsString(obE1, (char **)&peid1, FALSE, &cb1)) - goto done; + goto done; if (!PyWinObject_AsString(obE2, (char **)&peid2, FALSE, &cb2)) - goto done; + goto done; Py_BEGIN_ALLOW_THREADS hr=_swig_self->CompareEntryIDs(cb1, peid1, cb2, peid2, flags, &ulResult); @@ -263,10 +263,10 @@ IMAPISession *_swig_self; if ((_swig_self=GetI(self))==NULL) return NULL; - if(!PyArg_ParseTuple(args,"l|l:GetLastError", + if(!PyArg_ParseTuple(args,"l|l:GetLastError", &hr, // @pyparm int|hr||Contains the error code generated in the previous method call. &flags)) // @pyparm int|flags||Indicates for format for the output. - return NULL; + return NULL; Py_BEGIN_ALLOW_THREADS hRes = _swig_self->GetLastError(hr, flags, &me); diff -urN pywin32-b304-orig/com/win32comext/mapi/src/PyIMsgStore.i pywin32-b304/com/win32comext/mapi/src/PyIMsgStore.i --- pywin32-b304-orig/com/win32comext/mapi/src/PyIMsgStore.i 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32comext/mapi/src/PyIMsgStore.i 2022-11-06 01:29:04.433889300 +0800 @@ -33,14 +33,14 @@ // @pyswig |OpenEntry|Opens a folder or message and returns an interface object for further access. PyObject *PyIMsgStore::OpenEntry(PyObject *self, PyObject *args) { - HRESULT _result; - char * entryString; + HRESULT _result; + char * entryString; int entryStrLen; - IID iid; + IID iid; IID *pIID; - PyObject * objIID = 0; - unsigned long flags; - IUnknown * pUnk = NULL; + PyObject * objIID = 0; + unsigned long flags; + IUnknown * pUnk = NULL; ULONG resType; PyObject *obEntry; @@ -49,8 +49,8 @@ // @pyparm string|entryId||The entryID of the object // @pyparm |iid||The IID of the object to return, or None for the default IID // @pyparm int|flags||Bitmask of flags that controls how the object is opened. - if(!PyArg_ParseTuple(args,"OOl:OpenEntry",&obEntry, &objIID,&flags)) - return NULL; + if(!PyArg_ParseTuple(args,"OOl:OpenEntry",&obEntry, &objIID,&flags)) + return NULL; if (obEntry==Py_None) { entryString = NULL; entryStrLen = 0; @@ -69,12 +69,12 @@ return NULL; } Py_BEGIN_ALLOW_THREADS - _result = (HRESULT )_swig_self->OpenEntry(entryStrLen,(ENTRYID *)entryString,pIID,flags, &resType, &pUnk); + _result = (HRESULT )_swig_self->OpenEntry(entryStrLen,(ENTRYID *)entryString,pIID,flags, &resType, &pUnk); Py_END_ALLOW_THREADS - if (FAILED(_result)) { - return OleSetOleError(_result); - } - return PyMAPIObject_FromTypedUnknown( resType, pUnk, FALSE /*bAddRef*/); + if (FAILED(_result)) { + return OleSetOleError(_result); + } + return PyMAPIObject_FromTypedUnknown( resType, pUnk, FALSE /*bAddRef*/); } %} @@ -144,17 +144,17 @@ IMsgStore *_swig_self; PyObject *obE1, *obE2; if ((_swig_self=GetI(self))==NULL) return NULL; - if(!PyArg_ParseTuple(args,"OO|i:CompareEntryIDs", + if(!PyArg_ParseTuple(args,"OO|i:CompareEntryIDs", &obE1, // @pyparm string|entryId||The first entry ID to be compared &obE2, // @pyparm string|entryId||The second entry ID to be compared &flags)) // @pyparm int|flags|0|Reserved - must be zero. - goto done; + goto done; if (!PyWinObject_AsString(obE1, (char **)&peid1, FALSE, &cb1)) - goto done; + goto done; if (!PyWinObject_AsString(obE2, (char **)&peid2, FALSE, &cb2)) - goto done; + goto done; Py_BEGIN_ALLOW_THREADS hr=_swig_self->CompareEntryIDs(cb1, peid1, cb2, peid2, flags, &ulResult); @@ -182,10 +182,10 @@ IMsgStore *_swig_self; if ((_swig_self=GetI(self))==NULL) return NULL; - if(!PyArg_ParseTuple(args,"l|l:GetLastError", + if(!PyArg_ParseTuple(args,"l|l:GetLastError", &hr, // @pyparm int|hr||Contains the error code generated in the previous method call. &flags)) // @pyparm int|flags||Indicates for format for the output. - return NULL; + return NULL; Py_BEGIN_ALLOW_THREADS hRes = _swig_self->GetLastError(hr, flags, &me); @@ -255,11 +255,11 @@ IMsgStore *_swig_self; if ((_swig_self=GetI(self))==NULL) return NULL; - if(!PyArg_ParseTuple(args,"OkO:Advise", + if(!PyArg_ParseTuple(args,"OkO:Advise", &obEntryId, // @pyparm string|entryId||entry identifier of the folder or message about which notifications should be generated, or None &ulEventMask, // @pyparm int|eventMask||A mask of values that indicate the types of notification events. &obAdviseSink)) // @pyparm |adviseSink||An advise sink. - return NULL; + return NULL; if (obEntryId == Py_None) { eid = NULL; diff -urN pywin32-b304-orig/com/win32comext/mapi/src/mapi.i pywin32-b304/com/win32comext/mapi/src/mapi.i --- pywin32-b304-orig/com/win32comext/mapi/src/mapi.i 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32comext/mapi/src/mapi.i 2022-11-06 01:29:04.438889600 +0800 @@ -25,6 +25,10 @@ %include "mapilib.i" %{ +#ifndef _MSC_VER +#define USES_IID_IMsgServiceAdmin2 +#endif + #include "mapiaux.h" #include "PythonCOMServer.h" @@ -621,9 +625,9 @@ return NULL; if (!PyWinObject_AsMAPIStr(obProfileName, &lpszProfileName, ulFlags & MAPI_UNICODE, FALSE)) - goto done; + PyWinObject_FreeString(lpszProfileName); if (!PyWinObject_AsMAPIStr(obPassword, &lpszPassword, ulFlags & MAPI_UNICODE, TRUE)) - goto done; + PyWinObject_FreeString(lpszPassword); Py_BEGIN_ALLOW_THREADS hRes = ::MAPILogonEx(ulUIParam, lpszProfileName, lpszPassword, ulFlags, &lpSession); @@ -634,10 +638,6 @@ else MAKE_OUTPUT_INTERFACE(&lpSession, result, IID_IMAPISession); -done: - PyWinObject_FreeString(lpszProfileName); - PyWinObject_FreeString(lpszPassword); - return result; } %} @@ -779,7 +779,7 @@ PY_INTERFACE_POSTCALL; if (FAILED(hr)) return OleSetOleError(hr); - return PyLong_FromLong((long)pSession); + return PyLong_FromLong((LONG_PTR)pSession); } %} // @pyswig |CloseIMsgSession| @@ -787,7 +787,7 @@ %{ PyObject *PyCloseIMsgSession(PyObject *self, PyObject *args) { - long session = 0; + LONG_PTR session = 0; if (!PyArg_ParseTuple(args, "l:CloseIMsgSession", &session)) return NULL; PY_INTERFACE_PRECALL; @@ -811,7 +811,7 @@ long flags = 0; HRESULT hr = E_FAIL; PyObject *rc = NULL; - long lSession; + LONG_PTR lSession; if (!PyArg_ParseTuple(args, "lOO|Oll:OpenIMsgOnIStg", &lSession, // @pyparm object|session|| @@ -935,7 +935,7 @@ else if (strncmp(c,"\\pntext",7)==0) {c+=7; while (c|OpenStreamOnFileW|Allocates and initializes an OLE IStream object to access the contents of a file. %native(OpenStreamOnFileW) PyOpenStreamOnFileW; %{ @@ -1113,6 +1110,7 @@ return PyCom_PyObjectFromIUnknown(pStream, IID_IStream, FALSE); } %} +#endif // @pyswig item|HrGetOneProp|Retrieves the value of a single property from an IMAPIProp object. %native(HrGetOneProp) PyHrGetOneProp; @@ -1132,7 +1130,7 @@ return NULL; if (!PyCom_InterfaceFromPyObject(obProp, IID_IMAPIProp, (void **)&pProp, FALSE)) - goto done; + if (pProp) pProp->Release(); { PY_INTERFACE_PRECALL; @@ -1142,10 +1140,10 @@ if (FAILED(hRes)) { OleSetOleError(hRes); - goto done; + if (pProp) pProp->Release(); } if ((ret = PyMAPIObject_FromSPropValue(pPV)) == NULL) - goto done; + MAPIFreeBuffer(pPV); // PyMAPIObject_FromSPropValue does not raise an exception for types // it cannot handle so that GetProps doesn't blow up. Since we are processing @@ -1154,15 +1152,12 @@ PyLong_AsUnsignedLong(PyTuple_GET_ITEM(ret, 0)) != PT_NULL) { char buf[128]; - sprintf(buf, "Unsupported MAPI property type 0x%X", PROP_TYPE(pPV->ulPropTag)); + sprintf(buf, "Unsupported MAPI property type 0x%luX", PROP_TYPE(pPV->ulPropTag)); PyErr_SetString(PyExc_TypeError, buf); Py_DECREF(ret); ret = NULL; } -done: - if (pProp) pProp->Release(); - MAPIFreeBuffer(pPV); - + return ret; } %} @@ -1175,6 +1170,7 @@ HRESULT hRes; PyObject *obProp; PyObject *obPropValue; + ULONG propTag; IMAPIProp *pProp = NULL; PyObject *ret = NULL; SPropValue *pPV = NULL; @@ -1185,14 +1181,14 @@ return NULL; if (!PyCom_InterfaceFromPyObject(obProp, IID_IMAPIProp, (void **)&pProp, FALSE)) - goto done; + if (pProp) pProp->Release(); if (S_OK != (hRes=MAPIAllocateBuffer(sizeof(SPropValue), (void **)&pPV))) { OleSetOleError(hRes); - goto done; + MAPIFreeBuffer(pPV); } if (!PyMAPIObject_AsSPropValue(obPropValue, pPV, pPV)) - goto done; + MAPIFreeBuffer(pPV); { PY_INTERFACE_PRECALL; @@ -1202,13 +1198,10 @@ if (FAILED(hRes)) { OleSetOleError(hRes); - goto done; + if (pProp) pProp->Release(); } Py_INCREF(Py_None); ret = Py_None; -done: - if (pProp) pProp->Release(); - MAPIFreeBuffer(pPV); return ret; } diff -urN pywin32-b304-orig/com/win32comext/mapi/src/mapilib.i pywin32-b304/com/win32comext/mapi/src/mapilib.i --- pywin32-b304-orig/com/win32comext/mapi/src/mapilib.i 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32comext/mapi/src/mapilib.i 2022-11-06 01:29:04.442889800 +0800 @@ -1,12 +1,35 @@ /* MAPI Support */ %{ -#include "pymapiutil.h" +#include "PyMAPIUtil.h" %} typedef unsigned long BOOKMARK; %apply unsigned long {BOOKMARK}; +typedef IID IID; +typedef MAPIUID MAPIUID; +typedef MAPIINIT_0 MAPIINIT_0; +typedef IMAPISession IMAPISession; +typedef IMAPITable IMAPITable; +typedef IMAPIProp IMAPIProp; +typedef IMAPIFolder IMAPIFolder; +typedef IMAPIProgress IMAPIProgress; +typedef IMAPIAdviseSink IMAPIAdviseSink; +typedef IAddrBook IAddrBook; +typedef IAttach IAttach; +typedef IProfAdmin IProfAdmin; +typedef IProfSect IProfSect; +typedef IProviderAdmin IProviderAdmin; +typedef IMsgServiceAdmin IMsgServiceAdmin; +typedef IStream IStream; +typedef IMessage IMessage; +typedef IMsgStore IMsgStore; +typedef SRowSet SRowSet; +typedef SPropTagArray SPropTagArray; +typedef SRestriction SRestriction; +typedef SSortOrderSet SSortOrderSet; +typedef SBinaryArray SBinaryArray; // A MAPIUID is close enough to an IID for now! %typemap(python,in) MAPIUID *INPUT(MAPIUID temp) { diff -urN pywin32-b304-orig/com/win32comext/mapi/src/mapiutil.cpp pywin32-b304/com/win32comext/mapi/src/mapiutil.cpp --- pywin32-b304-orig/com/win32comext/mapi/src/mapiutil.cpp 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32comext/mapi/src/mapiutil.cpp 2022-11-06 01:29:04.446890100 +0800 @@ -1,5 +1,5 @@ // General utilities and conversion routines for MAPI support. -#include "pywintypes.h" +#include "PyWinTypes.h" #include "PythonCOM.h" #include "PyMAPIUtil.h" // @doc @@ -350,7 +350,7 @@ default: { char buf[128]; - sprintf(buf, "Unsupported MAPI property type 0x%X", PROP_TYPE(pv->ulPropTag)); + sprintf(buf, "Unsupported MAPI property type 0x%luX", PROP_TYPE(pv->ulPropTag)); PyErr_SetString(PyExc_TypeError, buf); ok = FALSE; } @@ -511,7 +511,7 @@ break; default: - printf("File %s: Unsupported MAPI property type 0x%X", __FILE__, PROP_TYPE(pv->ulPropTag)); + printf("File %s: Unsupported MAPI property type 0x%luX", __FILE__, PROP_TYPE(pv->ulPropTag)); /* Dont set exception, as this prevents otherwise valid props from being returned */ diff -urN pywin32-b304-orig/com/win32comext/taskscheduler/src/PyIScheduledWorkItem.cpp pywin32-b304/com/win32comext/taskscheduler/src/PyIScheduledWorkItem.cpp --- pywin32-b304-orig/com/win32comext/taskscheduler/src/PyIScheduledWorkItem.cpp 2022-05-02 15:48:48.000000000 +0800 +++ pywin32-b304/com/win32comext/taskscheduler/src/PyIScheduledWorkItem.cpp 2022-11-06 01:29:04.463891000 +0800 @@ -483,12 +483,14 @@ if (!PyArg_ParseTuple(args, "O:PyIScheduledWorkItem::SetWorkItemData", &obworkitem_data)) return NULL; if (obworkitem_data != Py_None) + { if (PyBytes_AsStringAndSize(obworkitem_data, (CHAR **)&workitem_data, &data_len) == -1) return NULL; else // Task Scheduler won't take an empty string for data anymore ?????? if (data_len == 0) - workitem_data = NULL; + workitem_data = NULL; + } HRESULT hr; PY_INTERFACE_PRECALL;