Files
MINGW-packages/mingw-w64-python-pywin32/002-com-extensions-fix.patch
Jeremy Drake 78f5f66f78 pywin32: fix problematic patch
Remove infinite recursion from ThisAsIID method.  Disable a workaround
for broken header in Vista SDK that is not broken in MINGW-w64.
2021-11-05 17:34:17 -07:00

1373 lines
52 KiB
Diff

diff -Naur pywin32-b302-orig/com/win32com/src/ErrorUtils.cpp pywin32-b302/com/win32com/src/ErrorUtils.cpp
--- pywin32-b302-orig/com/win32com/src/ErrorUtils.cpp 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32com/src/ErrorUtils.cpp 2021-10-12 21:07:04 +0800
@@ -1108,18 +1108,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 -Naur pywin32-b302-orig/com/win32com/src/MiscTypes.cpp pywin32-b302/com/win32com/src/MiscTypes.cpp
--- pywin32-b302-orig/com/win32com/src/MiscTypes.cpp 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32com/src/MiscTypes.cpp 2021-10-12 20:09:46 +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 -Naur pywin32-b302-orig/com/win32com/src/PyFactory.cpp pywin32-b302/com/win32com/src/PyFactory.cpp
--- pywin32-b302-orig/com/win32com/src/PyFactory.cpp 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32com/src/PyFactory.cpp 2021-10-12 20:46:25 +0800
@@ -38,7 +38,7 @@
{
LONG cRef = InterlockedDecrement(&m_cRef);
if (cRef == 0)
- delete this;
+ operator delete(this);
return cRef;
}
diff -Naur pywin32-b302-orig/com/win32com/src/PyIUnknown.cpp pywin32-b302/com/win32com/src/PyIUnknown.cpp
--- pywin32-b302-orig/com/win32com/src/PyIUnknown.cpp 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32com/src/PyIUnknown.cpp 2021-10-12 00:31:05 +0800
@@ -31,7 +31,11 @@
{
// @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%0lp with obj at 0x%0lp>", 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
@@ -87,7 +91,7 @@
}
}
- /* successful QI; need to release it
+ // successful QI; need to release it
pdisp->Release();
}
}
diff -Naur pywin32-b302-orig/com/win32com/src/dllmain.cpp pywin32-b302/com/win32com/src/dllmain.cpp
--- pywin32-b302-orig/com/win32com/src/dllmain.cpp 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32com/src/dllmain.cpp 2021-10-12 00:29:41 +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 -Naur pywin32-b302-orig/com/win32com/src/extensions/PyIPropertySetStorage.cpp pywin32-b302/com/win32com/src/extensions/PyIPropertySetStorage.cpp
--- pywin32-b302-orig/com/win32com/src/extensions/PyIPropertySetStorage.cpp 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32com/src/extensions/PyIPropertySetStorage.cpp 2021-10-12 00:33:40 +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 -Naur pywin32-b302-orig/com/win32com/src/extensions/PyIPropertyStorage.cpp pywin32-b302/com/win32com/src/extensions/PyIPropertyStorage.cpp
--- pywin32-b302-orig/com/win32com/src/extensions/PyIPropertyStorage.cpp 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32com/src/extensions/PyIPropertyStorage.cpp 2021-10-12 00:34:46 +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 -Naur pywin32-b302-orig/com/win32com/src/include/PythonCOM.h pywin32-b302/com/win32com/src/include/PythonCOM.h
--- pywin32-b302-orig/com/win32com/src/include/PythonCOM.h 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32com/src/include/PythonCOM.h 2021-10-13 18:13:18 +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 <olectl.h>
+#include <oleidl.h>
+#include <oaidl.h>
+#include <objidl.h>
+#include <mapiguid.h>
+#include <shlguid.h>
+#include <initguid.h>
+
#endif // __MINGW32__
@@ -426,9 +437,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 -Naur pywin32-b302-orig/com/win32com/src/include/PythonCOMServer.h pywin32-b302/com/win32com/src/include/PythonCOMServer.h
--- pywin32-b302-orig/com/win32com/src/include/PythonCOMServer.h 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32com/src/include/PythonCOMServer.h 2021-10-12 00:36:22 +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 -Naur pywin32-b302-orig/com/win32com/src/univgw.cpp pywin32-b302/com/win32com/src/univgw.cpp
--- pywin32-b302-orig/com/win32com/src/univgw.cpp 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32com/src/univgw.cpp 2021-10-12 00:32:21 +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 -Naur pywin32-b302-orig/com/win32comext/adsi/src/PyADSIUtil.cpp pywin32-b302/com/win32comext/adsi/src/PyADSIUtil.cpp
--- pywin32-b302-orig/com/win32comext/adsi/src/PyADSIUtil.cpp 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32comext/adsi/src/PyADSIUtil.cpp 2021-10-12 00:38:00 +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 -Naur pywin32-b302-orig/com/win32comext/adsi/src/PyIADs.cpp pywin32-b302/com/win32comext/adsi/src/PyIADs.cpp
--- pywin32-b302-orig/com/win32comext/adsi/src/PyIADs.cpp 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32comext/adsi/src/PyIADs.cpp 2021-10-12 00:39:02 +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 -Naur pywin32-b302-orig/com/win32comext/adsi/src/PyIDirectoryObject.i pywin32-b302/com/win32comext/adsi/src/PyIDirectoryObject.i
--- pywin32-b302-orig/com/win32comext/adsi/src/PyIDirectoryObject.i 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32comext/adsi/src/PyIDirectoryObject.i 2021-10-12 00:39:26 +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 -Naur pywin32-b302-orig/com/win32comext/adsi/src/PyIDirectorySearch.i pywin32-b302/com/win32comext/adsi/src/PyIDirectorySearch.i
--- pywin32-b302-orig/com/win32comext/adsi/src/PyIDirectorySearch.i 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32comext/adsi/src/PyIDirectorySearch.i 2021-10-12 00:39:41 +0800
@@ -81,9 +81,9 @@
// @pyparm [<o PyUnicode>, ...]|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 -Naur pywin32-b302-orig/com/win32comext/adsi/src/adsilib.i pywin32-b302/com/win32comext/adsi/src/adsilib.i
--- pywin32-b302-orig/com/win32comext/adsi/src/adsilib.i 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32comext/adsi/src/adsilib.i 2021-10-12 01:47:00 +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 -Naur pywin32-b302-orig/com/win32comext/authorization/src/PyGSecurityInformation.h pywin32-b302/com/win32comext/authorization/src/PyGSecurityInformation.h
--- pywin32-b302-orig/com/win32comext/authorization/src/PyGSecurityInformation.h 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32comext/authorization/src/PyGSecurityInformation.h 2021-10-12 00:40:28 +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 -Naur pywin32-b302-orig/com/win32comext/axcontrol/src/PyIOleInPlaceSiteWindowless.cpp pywin32-b302/com/win32comext/axcontrol/src/PyIOleInPlaceSiteWindowless.cpp
--- pywin32-b302-orig/com/win32comext/axcontrol/src/PyIOleInPlaceSiteWindowless.cpp 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32comext/axcontrol/src/PyIOleInPlaceSiteWindowless.cpp 2021-10-12 22:10:32 +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 -Naur pywin32-b302-orig/com/win32comext/axcontrol/src/PyIViewObject.cpp pywin32-b302/com/win32comext/axcontrol/src/PyIViewObject.cpp
--- pywin32-b302-orig/com/win32comext/axcontrol/src/PyIViewObject.cpp 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32comext/axcontrol/src/PyIViewObject.cpp 2021-10-12 20:11:19 +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 -Naur pywin32-b302-orig/com/win32comext/mapi/src/PyIAddrBook.i pywin32-b302/com/win32comext/mapi/src/PyIAddrBook.i
--- pywin32-b302-orig/com/win32comext/mapi/src/PyIAddrBook.i 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32comext/mapi/src/PyIAddrBook.i 2021-10-12 00:54:44 +0800
@@ -39,14 +39,14 @@
// @pyswig <o PyIInterface>|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 <o PyIID>|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 -Naur pywin32-b302-orig/com/win32comext/mapi/src/PyIConverterSession.i pywin32-b302/com/win32comext/mapi/src/PyIConverterSession.i
--- pywin32-b302-orig/com/win32comext/mapi/src/PyIConverterSession.i 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32comext/mapi/src/PyIConverterSession.i 2021-10-12 00:55:13 +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 -Naur pywin32-b302-orig/com/win32comext/mapi/src/PyIMAPIContainer.i pywin32-b302/com/win32comext/mapi/src/PyIMAPIContainer.i
--- pywin32-b302-orig/com/win32comext/mapi/src/PyIMAPIContainer.i 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32comext/mapi/src/PyIMAPIContainer.i 2021-10-12 00:56:53 +0800
@@ -30,24 +30,24 @@
// @pyswig <o PyIInterface>|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 <o PyIID>|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 <o PyIID>|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 -Naur pywin32-b302-orig/com/win32comext/mapi/src/PyIMAPIFolder.i pywin32-b302/com/win32comext/mapi/src/PyIMAPIFolder.i
--- pywin32-b302-orig/com/win32comext/mapi/src/PyIMAPIFolder.i 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32comext/mapi/src/PyIMAPIFolder.i 2021-10-12 00:56:27 +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 <o PyIMAPIProgress>|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 -Naur pywin32-b302-orig/com/win32comext/mapi/src/PyIMAPIProp.i pywin32-b302/com/win32comext/mapi/src/PyIMAPIProp.i
--- pywin32-b302-orig/com/win32comext/mapi/src/PyIMAPIProp.i 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32comext/mapi/src/PyIMAPIProp.i 2021-10-12 00:57:35 +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 <o PySPropTagArray>|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 <o PySPropTagArray>|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 [<o PySPropValue>, ]|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 <o PyIMAPIProp>|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 <o PyIMAPIProp>|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 <o PyIID>|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 -Naur pywin32-b302-orig/com/win32comext/mapi/src/PyIMAPISession.i pywin32-b302/com/win32comext/mapi/src/PyIMAPISession.i
--- pywin32-b302-orig/com/win32comext/mapi/src/PyIMAPISession.i 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32comext/mapi/src/PyIMAPISession.i 2021-10-12 00:58:42 +0800
@@ -32,14 +32,14 @@
// @pyswig <o PyIInterface>|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;
@@ -48,8 +48,8 @@
// @pyparm string|entryId||The EntryID to open.
// @pyparm <o PyIID>|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;
@@ -68,11 +68,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*/);
}
%}
@@ -82,24 +82,24 @@
// @pyswig <o PyIUnknown>|OpenMsgStore|Opens a message store.
PyObject *PyIMAPISession::OpenMsgStore(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 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 <o PyIID>|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 <o PyIID>|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 {
@@ -108,13 +108,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*/ );
}
%}
@@ -128,8 +128,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
@@ -139,8 +139,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);
}
@@ -220,17 +220,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);
@@ -260,10 +260,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 -Naur pywin32-b302-orig/com/win32comext/mapi/src/PyIMsgStore.i pywin32-b302/com/win32comext/mapi/src/PyIMsgStore.i
--- pywin32-b302-orig/com/win32comext/mapi/src/PyIMsgStore.i 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32comext/mapi/src/PyIMsgStore.i 2021-10-12 00:59:20 +0800
@@ -33,14 +33,14 @@
// @pyswig <o PyIInterface>|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 <o PyIID>|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 <o PyIMAPIAdviseSink>|adviseSink||An advise sink.
- return NULL;
+ return NULL;
if (obEntryId == Py_None)
{
eid = NULL;
diff -Naur pywin32-b302-orig/com/win32comext/mapi/src/mapi.i pywin32-b302/com/win32comext/mapi/src/mapi.i
--- pywin32-b302-orig/com/win32comext/mapi/src/mapi.i 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32comext/mapi/src/mapi.i 2021-10-12 02:42:13 +0800
@@ -24,6 +24,10 @@
%include "mapilib.i"
%{
+#ifndef _MSC_VER
+#define USES_IID_IMsgServiceAdmin2
+#endif
+
#include "mapiaux.h"
#include "PythonCOMServer.h"
@@ -620,9 +624,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);
@@ -633,10 +637,6 @@
else
MAKE_OUTPUT_INTERFACE(&lpSession, result, IID_IMAPISession);
-done:
- PyWinObject_FreeString(lpszProfileName);
- PyWinObject_FreeString(lpszPassword);
-
return result;
}
%}
@@ -778,7 +778,7 @@
PY_INTERFACE_POSTCALL;
if (FAILED(hr))
return OleSetOleError(hr);
- return PyLong_FromLong((long)pSession);
+ return PyLong_FromLong((LONG_PTR)pSession);
}
%}
// @pyswig |CloseIMsgSession|
@@ -786,7 +786,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;
@@ -810,7 +810,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||
@@ -934,7 +934,7 @@
else if (strncmp(c,"\\pntext",7)==0) {c+=7; while (c<max && *c!='}') c++;}
else if (strncmp(c,"\\htmlrtf",8)==0)
{ c++; while (c<max && strncmp(c,"\\htmlrtf0",9)!=0) c++;
- if (c<max) c+=9; if (*c==' ') c++;
+ if (c<max) {c+=9;} if (*c==' ') {c++;}
}
else if (*c=='\r' || *c=='\n') c++;
else if (strncmp(c,"\\{",2)==0) {*d='{'; d++; c+=2;}
@@ -1032,10 +1032,10 @@
return NULL;
if (!PyWinObject_AsString(obFileName, &filename, TRUE))
- goto done;
+ PyWinObject_FreeString(filename);
if (!PyWinObject_AsString(obPrefix, &prefix, TRUE))
- goto done;
+ PyWinObject_FreeString(prefix);
{
PY_INTERFACE_PRECALL;
@@ -1044,10 +1044,6 @@
PY_INTERFACE_POSTCALL;
}
- done:
- PyWinObject_FreeString(filename);
- PyWinObject_FreeString(prefix);
-
if (PyErr_Occurred())
return NULL;
@@ -1058,6 +1054,7 @@
}
%}
+#ifdef _MSC_VER
// @pyswig <o PyIStream>|OpenStreamOnFileW|Allocates and initializes an OLE IStream object to access the contents of a file.
%native(OpenStreamOnFileW) PyOpenStreamOnFileW;
%{
@@ -1112,6 +1109,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;
@@ -1131,7 +1129,7 @@
return NULL;
if (!PyCom_InterfaceFromPyObject(obProp, IID_IMAPIProp, (void **)&pProp, FALSE))
- goto done;
+ if (pProp) pProp->Release();
{
PY_INTERFACE_PRECALL;
@@ -1141,10 +1139,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
@@ -1153,15 +1151,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;
}
%}
@@ -1174,6 +1169,7 @@
HRESULT hRes;
PyObject *obProp;
PyObject *obPropValue;
+ ULONG propTag;
IMAPIProp *pProp = NULL;
PyObject *ret = NULL;
SPropValue *pPV = NULL;
@@ -1184,14 +1180,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;
@@ -1201,13 +1197,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 -Naur pywin32-b302-orig/com/win32comext/mapi/src/mapilib.i pywin32-b302/com/win32comext/mapi/src/mapilib.i
--- pywin32-b302-orig/com/win32comext/mapi/src/mapilib.i 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32comext/mapi/src/mapilib.i 2021-10-12 00:53:06 +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 -Naur pywin32-b302-orig/com/win32comext/mapi/src/mapiutil.cpp pywin32-b302/com/win32comext/mapi/src/mapiutil.cpp
--- pywin32-b302-orig/com/win32comext/mapi/src/mapiutil.cpp 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32comext/mapi/src/mapiutil.cpp 2021-10-12 02:46:40 +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 -Naur pywin32-b302-orig/com/win32comext/propsys/src/PyPROPVARIANT.cpp pywin32-b302/com/win32comext/propsys/src/PyPROPVARIANT.cpp
--- pywin32-b302-orig/com/win32comext/propsys/src/PyPROPVARIANT.cpp 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32comext/propsys/src/PyPROPVARIANT.cpp 2021-10-12 01:00:21 +0800
@@ -3,9 +3,37 @@
#include "PythonCOM.h"
#include "PyPROPVARIANT.h"
+#ifdef _MSC_VER
#include "propvarutil.h"
+#endif
#include "float.h"
+#ifndef _MSC_VER
+enum tagPROPVAR_CHANGE_FLAGS
+{
+ PVCHF_DEFAULT = 0x00000000,
+ PVCHF_NOVALUEPROP = 0x00000001,
+ PVCHF_ALPHABOOL = 0x00000002,
+ PVCHF_NOUSEROVERRIDE = 0x00000004,
+ PVCHF_LOCALBOOL = 0x00000008,
+ PVCHF_NOHEXSTRING = 0x00000010,
+};
+
+typedef int PROPVAR_CHANGE_FLAGS;
+
+PSSTDAPI PropVariantChangeType(
+ PROPVARIANT *ppropvarDest,
+ REFPROPVARIANT propvarSrc,
+ PROPVAR_CHANGE_FLAGS flags,
+ VARTYPE vt
+);
+
+PSSTDAPI PropVariantToStringAlloc(
+ REFPROPVARIANT propvar,
+ PWSTR *ppszOut
+);
+#endif
+
// @doc - This file contains autoduck documentation
// ---------------------------------------------------
diff -Naur pywin32-b302-orig/com/win32comext/propsys/src/propsys.cpp pywin32-b302/com/win32comext/propsys/src/propsys.cpp
--- pywin32-b302-orig/com/win32comext/propsys/src/propsys.cpp 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32comext/propsys/src/propsys.cpp 2021-10-12 01:00:02 +0800
@@ -38,6 +38,22 @@
#include "propvarutil.h"
#include "Shobjidl.h"
+#ifndef _MSC_VER
+DEFINE_GUID(CLSID_PropertyChangeArray, 0x380f5cad, 0x1b5e, 0x42f2, 0x80,0x5d, 0x63,0x7f,0xd3,0x92,0xd3,0x1e);
+
+PSSTDAPI StgSerializePropVariant(
+ const PROPVARIANT *ppropvar,
+ SERIALIZEDPROPERTYVALUE **ppProp,
+ ULONG *pcb
+);
+
+PSSTDAPI StgDeserializePropVariant(
+ const SERIALIZEDPROPERTYVALUE *pprop,
+ ULONG cbMax,
+ PROPVARIANT *ppropvar
+);
+#endif
+
#define CHECK_PFN(fname) \
if (pfn##fname == NULL) \
return PyErr_Format(PyExc_NotImplementedError, "%s is not available on this platform", #fname);
diff -Naur pywin32-b302-orig/com/win32comext/shell/src/shell_pch.h pywin32-b302/com/win32comext/shell/src/shell_pch.h
--- pywin32-b302-orig/com/win32comext/shell/src/shell_pch.h 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32comext/shell/src/shell_pch.h 2021-10-12 01:01:14 +0800
@@ -8,6 +8,30 @@
#include <wininet.h>
#include <shlobj.h>
+#ifndef _MSC_VER
+DEFINE_GUID(IID_IAsyncOperation, 0x3d8b0590, 0xf691, 0x11d2, 0x8e,0xa9, 0x00,0x60,0x97,0xdf,0x5b,0xd4);
+class IAsyncOperation : public IUnknown
+{
+public:
+ virtual HRESULT STDMETHODCALLTYPE SetAsyncMode(
+ BOOL fDoOpAsync) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetAsyncMode(
+ BOOL *pfIsOpAsync) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE StartOperation(
+ IBindCtx *pbcReserved) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE InOperation(
+ BOOL *pfInAsyncOp) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE EndOperation(
+ HRESULT hResult,
+ IBindCtx *pbcReserved,
+ DWORD dwEffects) = 0;
+};
+#endif /* !_MSC_VER */
+
BOOL PyObject_AsPIDL(PyObject *ob, LPITEMIDLIST *ppidl, BOOL bNoneOK = FALSE, UINT *pcb = NULL);
PyObject *PyObject_FromPIDL(LPCITEMIDLIST pidl, BOOL bFreeSystemPIDL);
void PyObject_FreePIDL(LPCITEMIDLIST pidl);
diff -Naur pywin32-b302-orig/com/win32comext/taskscheduler/src/PyIScheduledWorkItem.cpp pywin32-b302/com/win32comext/taskscheduler/src/PyIScheduledWorkItem.cpp
--- pywin32-b302-orig/com/win32comext/taskscheduler/src/PyIScheduledWorkItem.cpp 2021-10-11 08:09:18 +0800
+++ pywin32-b302/com/win32comext/taskscheduler/src/PyIScheduledWorkItem.cpp 2021-10-12 02:35:45 +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;
--- pywin32-b302/com/win32comext/ifilter/src/stdafx.h.orig 2021-10-22 17:41
:56.227210500 -0700
+++ pywin32-b302/com/win32comext/ifilter/src/stdafx.h 2021-10-22 17:44:57.1090
84600 -0700
@@ -13,7 +13,9 @@
#include <Filter.h>
#include <Filterr.h>
+#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