MINGW-packages/mingw-w64-python-pywin32/002-com-extensions-fix.patch
2023-04-08 05:16:27 +08:00

1157 lines
44 KiB
Diff

diff -urN pywin32-b306-orig/com/win32com/src/ErrorUtils.cpp pywin32-b306/com/win32com/src/ErrorUtils.cpp
--- pywin32-b306-orig/com/win32com/src/ErrorUtils.cpp 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32com/src/ErrorUtils.cpp 2023-04-07 08:42:45.201381100 +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-b306-orig/com/win32com/src/MiscTypes.cpp pywin32-b306/com/win32com/src/MiscTypes.cpp
--- pywin32-b306-orig/com/win32com/src/MiscTypes.cpp 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32com/src/MiscTypes.cpp 2023-04-07 08:42:45.257401900 +0800
@@ -288,7 +288,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-b306-orig/com/win32com/src/PyIUnknown.cpp pywin32-b306/com/win32com/src/PyIUnknown.cpp
--- pywin32-b306-orig/com/win32com/src/PyIUnknown.cpp 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32com/src/PyIUnknown.cpp 2023-04-07 08:45:29.481350500 +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-b306-orig/com/win32com/src/PyRecord.cpp pywin32-b306/com/win32com/src/PyRecord.cpp
--- pywin32-b306-orig/com/win32com/src/PyRecord.cpp 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32com/src/PyRecord.cpp 2023-04-08 02:34:17.144054500 +0800
@@ -348,7 +348,7 @@
delete[] strings;
}
-void PyWinCoreString_Concat(register PyObject **pv, register PyObject *w)
+void PyWinCoreString_Concat(PyObject **pv, PyObject *w)
{
if (!w) { // hrm - string version doesn't do this, but I saw PyObject_Repr() return NULL...
Py_XDECREF(*pv);
@@ -360,7 +360,7 @@
*pv = tmp;
}
-void PyWinCoreString_ConcatAndDel(register PyObject **pv, register PyObject *w)
+void PyWinCoreString_ConcatAndDel(PyObject **pv, PyObject *w)
{
PyWinCoreString_Concat(pv, w);
Py_XDECREF(w);
diff -urN pywin32-b306-orig/com/win32com/src/dllmain.cpp pywin32-b306/com/win32com/src/dllmain.cpp
--- pywin32-b306-orig/com/win32com/src/dllmain.cpp 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32com/src/dllmain.cpp 2023-04-07 08:45:29.767019800 +0800
@@ -134,7 +134,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
diff -urN pywin32-b306-orig/com/win32com/src/extensions/PyIPropertySetStorage.cpp pywin32-b306/com/win32com/src/extensions/PyIPropertySetStorage.cpp
--- pywin32-b306-orig/com/win32com/src/extensions/PyIPropertySetStorage.cpp 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32com/src/extensions/PyIPropertySetStorage.cpp 2023-04-07 08:45:29.842007700 +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-b306-orig/com/win32com/src/extensions/PyIPropertyStorage.cpp pywin32-b306/com/win32com/src/extensions/PyIPropertyStorage.cpp
--- pywin32-b306-orig/com/win32com/src/extensions/PyIPropertyStorage.cpp 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32com/src/extensions/PyIPropertyStorage.cpp 2023-04-07 08:45:29.855013200 +0800
@@ -951,7 +951,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;
}
@@ -1045,7 +1045,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);
}
}
@@ -1130,7 +1130,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-b306-orig/com/win32com/src/include/PythonCOM.h pywin32-b306/com/win32com/src/include/PythonCOM.h
--- pywin32-b306-orig/com/win32com/src/include/PythonCOM.h 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32com/src/include/PythonCOM.h 2023-04-07 08:45:29.875009000 +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__
diff -urN pywin32-b306-orig/com/win32com/src/univgw.cpp pywin32-b306/com/win32com/src/univgw.cpp
--- pywin32-b306-orig/com/win32com/src/univgw.cpp 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32com/src/univgw.cpp 2023-04-07 08:58:31.718696400 +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-b306-orig/com/win32comext/adsi/src/PyIADs.cpp pywin32-b306/com/win32comext/adsi/src/PyIADs.cpp
--- pywin32-b306-orig/com/win32comext/adsi/src/PyIADs.cpp 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32comext/adsi/src/PyIADs.cpp 2023-04-07 08:58:39.006455600 +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-b306-orig/com/win32comext/adsi/src/PyIDirectoryObject.i pywin32-b306/com/win32comext/adsi/src/PyIDirectoryObject.i
--- pywin32-b306-orig/com/win32comext/adsi/src/PyIDirectoryObject.i 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32comext/adsi/src/PyIDirectoryObject.i 2023-04-07 08:58:39.017474900 +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-b306-orig/com/win32comext/adsi/src/PyIDirectorySearch.i pywin32-b306/com/win32comext/adsi/src/PyIDirectorySearch.i
--- pywin32-b306-orig/com/win32comext/adsi/src/PyIDirectorySearch.i 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32comext/adsi/src/PyIDirectorySearch.i 2023-04-07 08:58:39.027474800 +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 -urN pywin32-b306-orig/com/win32comext/adsi/src/adsilib.i pywin32-b306/com/win32comext/adsi/src/adsilib.i
--- pywin32-b306-orig/com/win32comext/adsi/src/adsilib.i 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32comext/adsi/src/adsilib.i 2023-04-07 08:58:39.038456000 +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-b306-orig/com/win32comext/axcontrol/src/PyIOleInPlaceSiteWindowless.cpp pywin32-b306/com/win32comext/axcontrol/src/PyIOleInPlaceSiteWindowless.cpp
--- pywin32-b306-orig/com/win32comext/axcontrol/src/PyIOleInPlaceSiteWindowless.cpp 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32comext/axcontrol/src/PyIOleInPlaceSiteWindowless.cpp 2023-04-07 09:00:42.610136400 +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-b306-orig/com/win32comext/axcontrol/src/PyIViewObject.cpp pywin32-b306/com/win32comext/axcontrol/src/PyIViewObject.cpp
--- pywin32-b306-orig/com/win32comext/axcontrol/src/PyIViewObject.cpp 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32comext/axcontrol/src/PyIViewObject.cpp 2023-04-07 09:00:42.624137500 +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-b306-orig/com/win32comext/ifilter/src/stdafx.h pywin32-b306/com/win32comext/ifilter/src/stdafx.h
--- pywin32-b306-orig/com/win32comext/ifilter/src/stdafx.h 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32comext/ifilter/src/stdafx.h 2023-04-07 09:00:42.637160600 +0800
@@ -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
diff -urN pywin32-b306-orig/com/win32comext/mapi/src/PyIAddrBook.i pywin32-b306/com/win32comext/mapi/src/PyIAddrBook.i
--- pywin32-b306-orig/com/win32comext/mapi/src/PyIAddrBook.i 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32comext/mapi/src/PyIAddrBook.i 2023-04-07 09:07:53.795904000 +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,7 +101,7 @@
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.
diff -urN pywin32-b306-orig/com/win32comext/mapi/src/PyIConverterSession.i pywin32-b306/com/win32comext/mapi/src/PyIConverterSession.i
--- pywin32-b306-orig/com/win32comext/mapi/src/PyIConverterSession.i 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32comext/mapi/src/PyIConverterSession.i 2023-04-07 09:00:42.677143800 +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-b306-orig/com/win32comext/mapi/src/PyIMAPIContainer.i pywin32-b306/com/win32comext/mapi/src/PyIMAPIContainer.i
--- pywin32-b306-orig/com/win32comext/mapi/src/PyIMAPIContainer.i 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32comext/mapi/src/PyIMAPIContainer.i 2023-04-07 09:00:42.688174400 +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 -urN pywin32-b306-orig/com/win32comext/mapi/src/PyIMAPIFolder.i pywin32-b306/com/win32comext/mapi/src/PyIMAPIFolder.i
--- pywin32-b306-orig/com/win32comext/mapi/src/PyIMAPIFolder.i 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32comext/mapi/src/PyIMAPIFolder.i 2023-04-07 09:00:42.696140200 +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 -urN pywin32-b306-orig/com/win32comext/mapi/src/PyIMAPIProp.i pywin32-b306/com/win32comext/mapi/src/PyIMAPIProp.i
--- pywin32-b306-orig/com/win32comext/mapi/src/PyIMAPIProp.i 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32comext/mapi/src/PyIMAPIProp.i 2023-04-07 09:00:42.707140400 +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 -urN pywin32-b306-orig/com/win32comext/mapi/src/PyIMAPISession.i pywin32-b306/com/win32comext/mapi/src/PyIMAPISession.i
--- pywin32-b306-orig/com/win32comext/mapi/src/PyIMAPISession.i 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32comext/mapi/src/PyIMAPISession.i 2023-04-07 09:07:25.427721900 +0800
@@ -35,14 +35,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;
@@ -51,8 +51,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;
@@ -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 <o PyIUnknown>|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 <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 {
@@ -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,7 +223,7 @@
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.
@@ -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-b306-orig/com/win32comext/mapi/src/PyIMsgStore.i pywin32-b306/com/win32comext/mapi/src/PyIMsgStore.i
--- pywin32-b306-orig/com/win32comext/mapi/src/PyIMsgStore.i 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32comext/mapi/src/PyIMsgStore.i 2023-04-07 09:08:57.171587200 +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,7 +144,7 @@
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.
@@ -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 -urN pywin32-b306-orig/com/win32comext/mapi/src/mapi.i pywin32-b306/com/win32comext/mapi/src/mapi.i
--- pywin32-b306-orig/com/win32comext/mapi/src/mapi.i 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32comext/mapi/src/mapi.i 2023-04-07 09:21:45.436662600 +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_FreeMAPIStr(lpszProfileName, ulFlags & MAPI_UNICODE);
if (!PyWinObject_AsMAPIStr(obPassword, &lpszPassword, ulFlags & MAPI_UNICODE, TRUE))
- goto done;
+ PyWinObject_FreeMAPIStr(lpszPassword, ulFlags & MAPI_UNICODE);
Py_BEGIN_ALLOW_THREADS
hRes = ::MAPILogonEx(ulUIParam, lpszProfileName, lpszPassword, ulFlags, &lpSession);
@@ -633,11 +637,7 @@
result = OleSetOleError(hRes);
else
MAKE_OUTPUT_INTERFACE(&lpSession, result, IID_IMAPISession);
-
-done:
- PyWinObject_FreeMAPIStr(lpszProfileName, ulFlags & MAPI_UNICODE);
- PyWinObject_FreeMAPIStr(lpszPassword, ulFlags & MAPI_UNICODE);
-
+
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<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;}
@@ -1033,10 +1033,10 @@
return NULL;
if (!PyWinObject_AsChars(obFileName, &filename, TRUE))
- goto done;
+ PyWinObject_FreeChars(filename);
if (!PyWinObject_AsChars(obPrefix, &prefix, TRUE))
- goto done;
+ PyWinObject_FreeChars(prefix);
{
PY_INTERFACE_PRECALL;
@@ -1045,10 +1045,6 @@
PY_INTERFACE_POSTCALL;
}
- done:
- PyWinObject_FreeChars(filename);
- PyWinObject_FreeChars(prefix);
-
if (PyErr_Occurred())
return NULL;
@@ -1059,6 +1055,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;
%{
@@ -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-b306-orig/com/win32comext/mapi/src/mapilib.i pywin32-b306/com/win32comext/mapi/src/mapilib.i
--- pywin32-b306-orig/com/win32comext/mapi/src/mapilib.i 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32comext/mapi/src/mapilib.i 2023-04-07 09:00:42.796145000 +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-b306-orig/com/win32comext/mapi/src/mapiutil.cpp pywin32-b306/com/win32comext/mapi/src/mapiutil.cpp
--- pywin32-b306-orig/com/win32comext/mapi/src/mapiutil.cpp 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32comext/mapi/src/mapiutil.cpp 2023-04-07 09:00:42.805152700 +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-b306-orig/com/win32comext/taskscheduler/src/PyIScheduledWorkItem.cpp pywin32-b306/com/win32comext/taskscheduler/src/PyIScheduledWorkItem.cpp
--- pywin32-b306-orig/com/win32comext/taskscheduler/src/PyIScheduledWorkItem.cpp 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/com/win32comext/taskscheduler/src/PyIScheduledWorkItem.cpp 2023-04-07 09:15:42.099591800 +0800
@@ -488,7 +488,7 @@
else
// Task Scheduler won't take an empty string for data anymore ??????
if (data_len == 0)
- workitem_data = NULL;
+ workitem_data = NULL;
}
HRESULT hr;