source:
docker/msys/pywin32.patch@
962:a0b8491a5a12
Last change on this file since 962:a0b8491a5a12 was 920:42b14124051b, checked in by , 6 years ago | |
---|---|
File size: 98.6 KB |
-
com/win32com/src/ErrorUtils.cpp
diff --git a/com/win32com/src/ErrorUtils.cpp b/com/win32com/src/ErrorUtils.cpp index 1186cd1..314aff8 100644
a b LPCTSTR GetScodeRangeString(HRESULT hr) 1118 1118 HRESULT hrLast; 1119 1119 LPCTSTR lpszName; 1120 1120 }; 1121 #if defined(__MINGW32__) 1122 #define MAKE_RANGE_ENTRY(hrRange) \ 1123 { static_cast<HRESULT>(hrRange##_FIRST), static_cast<HRESULT>(hrRange##_LAST), \ 1124 _T(#hrRange) _T("_FIRST...") _T(#hrRange) _T("_LAST") } 1125 #else 1121 1126 #define MAKE_RANGE_ENTRY(hrRange) \ 1122 1127 { hrRange##_FIRST, hrRange##_LAST, \ 1123 1128 _T(#hrRange) _T("_FIRST...") _T(#hrRange) _T("_LAST") } 1129 #endif 1124 1130 1125 1131 static const RANGE_ENTRY hrRangeTable[] = 1126 1132 { -
com/win32com/src/PyGatewayBase.cpp
diff --git a/com/win32com/src/PyGatewayBase.cpp b/com/win32com/src/PyGatewayBase.cpp index fc091cb..2ed9acc 100644
a b 7 7 8 8 #include "PythonCOMServer.h" 9 9 10 #if defined(__MINGW32__) 11 #include <algorithm> 12 #endif 13 10 14 // {25D29CD0-9B98-11d0-AE79-4CF1CF000000} 11 15 extern const GUID IID_IInternalUnwrapPythonObject = 12 16 { 0x25d29cd0, 0x9b98, 0x11d0, { 0xae, 0x79, 0x4c, 0xf1, 0xcf, 0x0, 0x0, 0x0 } }; … … static HRESULT invoke_setup( 437 441 // make sure its not a special DISPID we don't understand. 438 442 if (params->rgdispidNamedArgs[i] < 0) 439 443 return DISP_E_PARAMNOTFOUND; 444 #if defined(__MINGW32__) 445 numArgs = std::max(numArgs, (UINT)params->rgdispidNamedArgs[i]+1); 446 #else 440 447 numArgs = max(numArgs, (UINT)params->rgdispidNamedArgs[i]+1); 448 #endif 441 449 } 442 450 443 451 PyObject *argList = PyTuple_New(numArgs); … … static HRESULT invoke_finish( 658 666 ob = NULL; 659 667 firstByRef = 1; 660 668 } 669 #if defined(__MINGW32__) 670 UINT max_args = std::min(cUserResult-firstByRef, pDispParams->cArgs); 671 #else 661 672 UINT max_args = min(cUserResult-firstByRef, pDispParams->cArgs); 673 #endif 662 674 UINT *offsets = (UINT *)_malloca(sizeof(UINT) * max_args); 663 675 // Get the offsets into our params of all BYREF args, in order. 664 676 fill_byref_offsets(pDispParams, offsets, max_args); -
com/win32com/src/PythonCOM.cpp
diff --git a/com/win32com/src/PythonCOM.cpp b/com/win32com/src/PythonCOM.cpp index da00839..67983a4 100644
a b static PyObject *pythoncom_CoInitializeSecurity(PyObject *self, PyObject *args) 342 342 pSD = (PSECURITY_DESCRIPTOR)&appid; 343 343 } 344 344 } 345 #if !defined(__MINGW32__) 345 346 else if (dwCapabilities & EOAC_ACCESS_CONTROL){ 346 347 if (!PyCom_InterfaceFromPyObject(obSD, IID_IAccessControl, (void **)&pIAC, FALSE)) 347 348 return NULL; 348 349 pSD = (PSECURITY_DESCRIPTOR)pIAC; 349 350 } 351 #endif 350 352 else{ 351 353 if (!PyWinObject_AsSECURITY_DESCRIPTOR(obSD, &pSD, /*BOOL bNoneOK = */TRUE)) 352 354 return NULL; -
com/win32com/src/PythonCOM.def
diff --git a/com/win32com/src/PythonCOM.def b/com/win32com/src/PythonCOM.def index 58d030f..6d2a54b 100644
a b 1 1 EXPORTS 2 DllCanUnloadNow @1 PRIVATE3 DllGetClassObject @2 PRIVATE2 DllCanUnloadNow 3 DllGetClassObject 4 4 5 5 ; Some exports for clients who may "LoadLibrary"... 6 PyCom_VariantFromPyObject7 PyCom_PyObjectFromVariant8 PyCom_InterfaceFromPyObject9 PyCom_PyObjectFromIUnknown10 PyCom_MakeOlePythonCall6 _PyCom_VariantFromPyObject 7 _PyCom_PyObjectFromVariant 8 _PyCom_InterfaceFromPyObject 9 _PyCom_PyObjectFromIUnknown 10 _PyCom_MakeOlePythonCall 11 11 12 PyCom_CoInitializeEx13 PyCom_CoInitialize14 PyCom_CoUninitialize12 _PyCom_CoInitializeEx 13 _PyCom_CoInitialize 14 _PyCom_CoUninitialize 15 15 -
com/win32com/src/Register.cpp
diff --git a/com/win32com/src/Register.cpp b/com/win32com/src/Register.cpp index 0b24ee2..d259aff 100644
a b static const PyCom_InterfaceSupportInfo g_interfaceSupportData[] = 322 322 PYCOM_INTERFACE_FULL ( CancelMethodCalls), 323 323 // No wrapper for IAccessControl yet, but you can still get the system implementation 324 324 // by calling pythoncom.CoCreateInstance with IID_IUnknown as the returned interface 325 #if !defined(__MINGW32__) 325 326 PYCOM_INTERFACE_CLSID_ONLY (DCOMAccessControl), 327 #endif 326 328 327 329 // NULL, Unknown and dispatch special cases. 328 330 { &IID_NULL, "Null", "IID_NULL", NULL, NULL}, -
com/win32com/src/dllmain.cpp
diff --git a/com/win32com/src/dllmain.cpp b/com/win32com/src/dllmain.cpp index fb81ddb..abf074c 100644
a b typedef HRESULT (WINAPI *PFNCoInitializeEx)(LPVOID pvReserved, DWORD dwCoInit); 175 175 // the Init for Term function explicitely, and the framework will detect 176 176 // it no longer needs doing. 177 177 // XXX - Needs more thought about threading implications. 178 #if defined(__MINGW32__) 179 extern "C" 180 #endif 178 181 HRESULT PyCom_CoInitializeEx(LPVOID reserved, DWORD dwInit) 179 182 { 180 183 // Must be thread-safe, although doesnt need the Python lock. -
com/win32com/src/include/PythonCOM.h
diff --git a/com/win32com/src/include/PythonCOM.h b/com/win32com/src/include/PythonCOM.h index 9e422e4..f3b1063 100644
a b 111 111 #ifdef __MINGW32__ 112 112 // Special Mingw32 considerations. 113 113 #define NO_PYCOM_IDISPATCHEX 114 #define NO_PYCOM_IPROVIDECLASSINFO115 114 #define NO_PYCOM_ISERVICEPROVIDER 116 115 #define NO_PYCOM_ENUMSTATPROPSTG 117 #define NO_PYCOM_IPROPERTYSTORAGE118 116 #define __try try 119 117 #define __except catch 120 118 #include <olectl.h> … … PYCOM_EXPORT PyObject *PyObject_FromOLEMENUGROUPWIDTHS(const OLEMENUGROUPWIDTHS 305 303 306 304 /* Functions for Initializing COM, and also letting the core know about it! 307 305 */ 306 #if defined(__MINGW32__) 307 extern "C" 308 #endif 308 309 PYCOM_EXPORT HRESULT PyCom_CoInitializeEx(LPVOID reserved, DWORD dwInit); 309 310 PYCOM_EXPORT HRESULT PyCom_CoInitialize(LPVOID reserved); 310 311 PYCOM_EXPORT void PyCom_CoUninitialize(); -
new file com/win32com/src/initguid.cpp
diff --git a/com/win32com/src/initguid.cpp b/com/win32com/src/initguid.cpp new file mode 100644 index 0000000..33d5923
- + 1 #define INITGUID 2 #undef _OBJIDLBASE_ 3 #define CINTERFACE 4 #define USE_COM_CONTEXT_DEF 5 #include <objidl.h> 6 #include <ksguid.h> 7 #include <ks.h> -
com/win32comext/axcontrol/src/PyIOleCommandTarget.cpp
diff --git a/com/win32comext/axcontrol/src/PyIOleCommandTarget.cpp b/com/win32comext/axcontrol/src/PyIOleCommandTarget.cpp index 61bd706..e7908e9 100644
a b 4 4 #include "axcontrol_pch.h" 5 5 #include "PyIOleCommandTarget.h" 6 6 7 #if defined(__MINGW32__) 8 #include <algorithm> 9 #endif 10 7 11 static BOOL FillOLECMDsWithSequence(OLECMD *pCmds, UINT ncmds, PyObject *obCmds) 8 12 { 9 13 for (UINT i=0;i<ncmds;i++) { … … STDMETHODIMP PyGOleCommandTarget::QueryStatus( 211 215 ok = PyWinObject_AsAutoFreeBstr(obText, &tempString); 212 216 if (ok) { 213 217 UINT strLen = SysStringLen(tempString); 218 #if defined(__MINGW32__) 219 UINT nwrite = std::min((ULONG)strLen, pCmdText->cwBuf); 220 #else 214 221 UINT nwrite = min(strLen, pCmdText->cwBuf); 222 #endif 215 223 wcsncpy(pCmdText->rgwz, (WCHAR *)(BSTR)tempString, 216 224 nwrite); 217 225 pCmdText->cwActual = nwrite; -
new file com/win32comext/axcontrol/src/initguid.cpp
diff --git a/com/win32comext/axcontrol/src/initguid.cpp b/com/win32comext/axcontrol/src/initguid.cpp new file mode 100644 index 0000000..329e211
- + 1 #define INITGUID 2 #undef _OBJIDLBASE_ 3 #define CINTERFACE 4 #define USE_COM_CONTEXT_DEF 5 #include <objidl.h> 6 #include <ksguid.h> 7 #include <ks.h> 8 #include <docobj.h> -
new file com/win32comext/axscript/src/initguid.cpp
diff --git a/com/win32comext/axscript/src/initguid.cpp b/com/win32comext/axscript/src/initguid.cpp new file mode 100644 index 0000000..ba6baa3
- + 1 #define INITGUID 2 #undef _OBJIDLBASE_ 3 #define CINTERFACE 4 #define USE_COM_CONTEXT_DEF 5 #include <objidl.h> 6 #include <ksguid.h> 7 #include <ks.h> 8 #include <objsafe.h> -
com/win32comext/internet/src/PyIInternetProtocol.cpp
diff --git a/com/win32comext/internet/src/PyIInternetProtocol.cpp b/com/win32comext/internet/src/PyIInternetProtocol.cpp index 43c25a8..b910c85 100644
a b 5 5 #include "PyIInternetProtocolRoot.h" 6 6 #include "PyIInternetProtocol.h" 7 7 8 #if defined(__MINGW32__) 9 #include <algorithm> 10 #endif 11 8 12 // @doc - This file contains autoduck documentation 9 13 // --------------------------------------------------- 10 14 // … … STDMETHODIMP PyGInternetProtocol::Read( 181 185 hr = PyCom_HandlePythonFailureToCOM(); 182 186 } else { 183 187 char *buf = PyString_AsString(result); 188 #if defined(__MINGW32__) 189 *pcbRead = std::min(cb, (ULONG)PyString_Size(result)); 190 #else 184 191 *pcbRead = min(cb, (ULONG)PyString_Size(result)); 192 #endif 185 193 memcpy( pv, buf, *pcbRead); 186 194 } 187 195 return hr; -
com/win32comext/internet/src/PyIInternetProtocolInfo.cpp
diff --git a/com/win32comext/internet/src/PyIInternetProtocolInfo.cpp b/com/win32comext/internet/src/PyIInternetProtocolInfo.cpp index c00e43e..ef894ca 100644
a b 4 4 #include "internet_pch.h" 5 5 #include "PyIInternetProtocolInfo.h" 6 6 7 #if defined(__MINGW32__) 8 #include <algorithm> 9 #endif 10 7 11 // @doc - This file contains autoduck documentation 8 12 // --------------------------------------------------- 9 13 // … … STDMETHODIMP PyGInternetProtocolInfo::ParseUrl( 226 230 if (!PyWinObject_AsBstr(result, &bstrTemp, FALSE, pcchResult)) bPythonIsHappy = FALSE; 227 231 if (!bPythonIsHappy) return PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); 228 232 ++(*pcchResult); // Null terminator 233 #if defined(__MINGW32__) 234 *pcchResult = std::min(*pcchResult, cchResult); 235 #else 229 236 *pcchResult = min(*pcchResult, cchResult); 237 #endif 230 238 memcpy(pwzResult, bstrTemp, *pcchResult * sizeof(WCHAR)); 231 239 SysFreeString(bstrTemp); 232 240 Py_DECREF(result); … … STDMETHODIMP PyGInternetProtocolInfo::CombineUrl( 258 266 if (!PyWinObject_AsBstr(result, &bstrTemp, FALSE, pcchResult)) bPythonIsHappy = FALSE; 259 267 if (!bPythonIsHappy) hr = PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); 260 268 ++(*pcchResult); // Null terminator 269 #if defined(__MINGW32__) 270 *pcchResult = std::min(*pcchResult, cchResult); 271 #else 261 272 *pcchResult = min(*pcchResult, cchResult); 273 #endif 262 274 memcpy(pwzResult, bstrTemp, *pcchResult * sizeof(WCHAR)); 263 275 SysFreeString(bstrTemp); 264 276 Py_DECREF(result); … … STDMETHODIMP PyGInternetProtocolInfo::QueryInfo( 312 324 return PyCom_HandlePythonFailureToCOM(); 313 325 } 314 326 } else { 327 #if defined(__MINGW32__) 328 *pcbBuf = std::min(cbBuffer, (ULONG)PyString_Size(result)); 329 #else 315 330 *pcbBuf = min(cbBuffer, (ULONG)PyString_Size(result)); 331 #endif 316 332 memcpy(pBuffer, PyString_AsString(result), *pcbBuf); 317 333 } 318 334 Py_DECREF(result); -
com/win32comext/internet/src/PyIInternetSecurityManager.cpp
diff --git a/com/win32comext/internet/src/PyIInternetSecurityManager.cpp b/com/win32comext/internet/src/PyIInternetSecurityManager.cpp index 81439fc..a4cb106 100644
a b 4 4 #include "internet_pch.h" 5 5 #include "PyIInternetSecurityManager.h" 6 6 7 #if defined(__MINGW32__) 8 #include <algorithm> 9 #endif 10 7 11 // @doc - This file contains autoduck documentation 8 12 // --------------------------------------------------- 9 13 // … … STDMETHODIMP PyGInternetSecurityManager::GetSecurityId( 338 342 Py_DECREF(result); 339 343 return MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetSecurityId"); 340 344 } 345 #if defined(__MINGW32__) 346 *pcbSecurityId = std::min(buf_len, *pcbSecurityId); 347 #else 341 348 *pcbSecurityId = min(buf_len, *pcbSecurityId); 349 #endif 342 350 memcpy(pbSecurityId, buf, *pcbSecurityId); 343 351 Py_DECREF(result); 344 352 return hr; -
new file com/win32comext/internet/src/initguid.cpp
diff --git a/com/win32comext/internet/src/initguid.cpp b/com/win32comext/internet/src/initguid.cpp new file mode 100644 index 0000000..1003585
- + 1 #define INITGUID 2 #undef _OBJIDLBASE_ 3 #define CINTERFACE 4 #define USE_COM_CONTEXT_DEF 5 #include <objidl.h> 6 #include <ksguid.h> 7 #include <ks.h> 8 #include <urlmon.h> 9 #include <mshtmhst.h> -
com/win32comext/propsys/src/PyPROPVARIANT.cpp
diff --git a/com/win32comext/propsys/src/PyPROPVARIANT.cpp b/com/win32comext/propsys/src/PyPROPVARIANT.cpp index b330129..694703f 100644
a b 3 3 4 4 #include "PythonCOM.h" 5 5 #include "PyPROPVARIANT.h" 6 #if defined(__MINGW32__) 7 extern "C" { 8 #endif 6 9 #include "propvarutil.h" 10 #if defined(__MINGW32__) 11 } 12 #endif 7 13 #include "float.h" 8 14 9 15 // @doc - This file contains autoduck documentation -
com/win32comext/propsys/src/propsys.cpp
diff --git a/com/win32comext/propsys/src/propsys.cpp b/com/win32comext/propsys/src/propsys.cpp index ef0a2f4..69ff21f 100644
a b static PyObject *PyPSGetItemPropertyHandler(PyObject *self, PyObject *args) 279 279 return PyCom_PyObjectFromIUnknown((IUnknown *)propertystore, riid, FALSE); 280 280 } 281 281 282 #if !defined(__MINGW32__) 282 283 // @pymethod bytes|propsys|StgSerializePropVariant|Serializes a <o PyPROPVARIANT> 283 284 static PyObject *PyStgSerializePropVariant(PyObject *self, PyObject *args) 284 285 { … … static PyObject *PyStgDeserializePropVariant(PyObject *self, PyObject *args) 319 320 return PyCom_BuildPyException(hr); 320 321 return PyWinObject_FromPROPVARIANT(&pv); 321 322 }; 323 #endif 322 324 323 325 // @pymethod <o PyIPropertyStore>|propsys|PSCreateMemoryPropertyStore|Creates a temporary property store that is not connected to any backing storage 324 326 // @comm May also be used to create <o PyINamedPropertyStore>, <o PyIPropertyStoreCache>, <o PyIPersistStream>, or <o PyIPropertyBag> … … static struct PyMethodDef propsys_methods[]= 566 568 { "PSRegisterPropertySchema", PyPSRegisterPropertySchema, 1 }, // @pymeth PSRegisterPropertySchema|Registers a group of properties described in a schema file 567 569 { "PSUnregisterPropertySchema", PyPSUnregisterPropertySchema, 1 }, // @pymeth PSUnregisterPropertySchema|Removes a property schema definition 568 570 { "SHGetPropertyStoreFromParsingName", PySHGetPropertyStoreFromParsingName, 1 }, // @pymeth SHGetPropertyStoreFromParsingName|Retrieves the property store for an item by path 571 #if !defined(__MINGW32__) 569 572 { "StgSerializePropVariant", PyStgSerializePropVariant, 1 }, // @pymeth StgSerializePropVariant|Serializes a <o PyPROPVARIANT> 570 573 { "StgDeserializePropVariant", PyStgDeserializePropVariant, 1 }, // @pymeth StgDeserializePropVariant|Creates a <o PyPROPVARIANT> from a serialized buffer 574 #endif 571 575 { "PSCreateMemoryPropertyStore", PyPSCreateMemoryPropertyStore, 1 }, // @pymeth PSCreateMemoryPropertyStore|Creates a temporary property store that is not connected to any backing storage 572 576 { "PSCreatePropertyStoreFromPropertySetStorage", PyPSCreatePropertyStoreFromPropertySetStorage, 1 }, // @pymeth PSCreatePropertyStoreFromPropertySetStorage|Wraps a <o PyIPropertySetStorage> interface in a <o PyIPropertyStore> object 573 577 { "PSLookupPropertyHandlerCLSID", PyPSLookupPropertyHandlerCLSID, 1 }, // @pymeth PSLookupPropertyHandlerCLSID|Returns the GUID of the property handler for a file … … static struct PyMethodDef propsys_methods[]= 583 587 // MSDN says CLSID_PropertyChangeArray can be used to create IPropertyChangeArray, but 584 588 // I get "Class not registered". Plus, it doesn't appear in any headers, although 585 589 // it's contained in uuid.lib. 586 #if ndef CLSID_PropertyChangeArray590 #if !defined(CLSID_PropertyChangeArray) && !defined(__MINGW32__) 587 591 EXTERN_C const CLSID CLSID_PropertyChangeArray; 588 592 #endif 589 593 … … static const PyCom_InterfaceSupportInfo g_interfaceSupportData[] = 606 610 PYCOM_INTERFACE_CLIENT_ONLY (ObjectWithPropertyKey), 607 611 PYCOM_INTERFACE_CLIENT_ONLY (PropertyChange), 608 612 PYCOM_INTERFACE_CLIENT_ONLY (PropertyChangeArray), 613 #if !defined(__MINGW32__) 609 614 PYCOM_INTERFACE_CLSID_ONLY (PropertyChangeArray), 615 #endif 610 616 }; 611 617 612 618 /* Module initialisation */ -
com/win32comext/shell/src/PyICategoryProvider.cpp
diff --git a/com/win32comext/shell/src/PyICategoryProvider.cpp b/com/win32comext/shell/src/PyICategoryProvider.cpp index e2f2ea8..0ecf0cf 100644
a b 9 9 // 10 10 // Interface Implementation 11 11 12 #if defined(__MINGW32__) 13 __CRT_UUID_DECL(int, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); 14 #endif 15 12 16 PyICategoryProvider::PyICategoryProvider(IUnknown *pdisp): 13 17 PyIUnknown(pdisp) 14 18 { -
new file com/win32comext/shell/src/initguid.cpp
diff --git a/com/win32comext/shell/src/initguid.cpp b/com/win32comext/shell/src/initguid.cpp new file mode 100644 index 0000000..8da5c87
- + 1 #define INITGUID 2 #undef _OBJIDLBASE_ 3 #define CINTERFACE 4 #define USE_COM_CONTEXT_DEF 5 #include <objidl.h> 6 #include <ksguid.h> 7 #include <ks.h> 8 #include <shlguid.h> 9 #include <shobjidl.h> 10 #include <emptyvc.h> 11 #include <_mingw.h> -
com/win32comext/shell/src/shell.cpp
diff --git a/com/win32comext/shell/src/shell.cpp b/com/win32comext/shell/src/shell.cpp index 8b6e78c..f19a021 100644
a b generates Windows .hlp files. 29 29 #include "PyIShellExtInit.h" 30 30 #include "PyIShellFolder.h" 31 31 #include "PyIShellFolder2.h" 32 #if !defined(__MINGW32__) 32 33 #include "PyIEmptyVolumeCache.h" 33 34 #include "PyIEmptyVolumeCacheCallBack.h" 35 #endif 34 36 #include "PyIEnumExplorerCommand.h" 35 37 #include "PyIEnumIDList.h" 36 38 #include "PyICopyHook.h" … … static const PyCom_InterfaceSupportInfo g_interfaceSupportData[] = 3606 3608 PYCOM_INTERFACE_FULL(ColumnProvider), 3607 3609 PYCOM_INTERFACE_CLIENT_ONLY(DefaultExtractIconInit), 3608 3610 PYCOM_INTERFACE_FULL(DropTargetHelper), 3611 #if !defined(__MINGW32__) 3609 3612 PYCOM_INTERFACE_CLIENT_ONLY(EmptyVolumeCacheCallBack), 3613 #endif 3610 3614 PYCOM_INTERFACE_CLIENT_ONLY(QueryAssociations), 3611 3615 PYCOM_INTERFACE_SERVER_ONLY(DeskBand), 3612 3616 PYCOM_INTERFACE_SERVER_ONLY(DockingWindow), 3617 #if !defined(__MINGW32__) 3613 3618 PYCOM_INTERFACE_SERVER_ONLY(EmptyVolumeCache), 3614 3619 PYCOM_INTERFACE_SERVER_ONLY(EmptyVolumeCache2), 3620 #endif 3615 3621 PYCOM_INTERFACE_CLIENT_ONLY(ExplorerBrowser), 3616 3622 PYCOM_INTERFACE_FULL(ExplorerBrowserEvents), 3617 3623 PYCOM_INTERFACE_FULL(ExplorerCommand), … … PYWIN_MODULE_INIT_FUNC(shell) 3850 3856 ADD_IID(FMTID_Briefcase); 3851 3857 ADD_IID(FMTID_Misc); 3852 3858 ADD_IID(FMTID_WebView); 3859 #if !defined(__MINGW32__) 3853 3860 ADD_IID(FMTID_AudioSummaryInformation); 3861 #endif 3854 3862 ADD_IID(FMTID_Volume); 3855 3863 ADD_IID(FMTID_Query); 3864 #if !defined(__MINGW32__) 3856 3865 ADD_IID(FMTID_SummaryInformation); 3857 3866 ADD_IID(FMTID_MediaFileSummaryInformation); 3858 3867 ADD_IID(FMTID_ImageSummaryInformation); 3868 #endif 3859 3869 ADD_IID(IID_CDefView); 3860 3870 3861 3871 ADD_IID(EP_NavPane); -
new file com/win32comext/taskscheduler/src/initguid.cpp
diff --git a/com/win32comext/taskscheduler/src/initguid.cpp b/com/win32comext/taskscheduler/src/initguid.cpp new file mode 100644 index 0000000..d588502
- + 1 #define INITGUID 2 #undef _OBJIDLBASE_ 3 #define CINTERFACE 4 #define USE_COM_CONTEXT_DEF 5 #include <objidl.h> 6 #include <ksguid.h> 7 #include <ks.h> 8 #include <mstask.h> -
isapi/src/Utils.cpp
diff --git a/isapi/src/Utils.cpp b/isapi/src/Utils.cpp index 8f278f2..b8976ae 100644
a b static void CheckRegisterEventSourceFile() 127 127 return; 128 128 129 129 GetModuleFileNameW(g_hInstance, mod_name, 130 #if defined(__MINGW32__) 131 sizeof(mod_name)/sizeof(WCHAR)); 132 #else 130 133 sizeof mod_name/sizeof WCHAR); 134 #endif 131 135 if (!mod_name[0]) { 132 136 OutputDebugString(_T("GetModuleFileNameW failed!")); 133 137 return; … … static void CheckRegisterEventSourceFile() 160 164 } 161 165 162 166 // Write stuff to the event log. 167 #if defined(__MINGW32__) 168 extern "C" 169 #endif 163 170 BOOL WriteEventLogMessage(WORD eventType, DWORD eventID, WORD num_inserts, 164 171 const char **inserts) 165 172 { -
isapi/src/Utils.h
diff --git a/isapi/src/Utils.h b/isapi/src/Utils.h index 3779ca9..f076826 100644
a b char *HTMLErrorResp(const char *msg); 58 58 TCHAR *GetModulePath(void); 59 59 60 60 // Write entry to the event log 61 #if defined(__MINGW32__) 62 extern "C" 63 #endif 61 64 BOOL WriteEventLogMessage(WORD eventType, DWORD eventID, WORD num_inserts, 62 65 const char **inserts); 63 66 -
isapi/src/pyISAPI.cpp
diff --git a/isapi/src/pyISAPI.cpp b/isapi/src/pyISAPI.cpp index 439d3ca..2c94610 100644
a b char g_CallbackModuleName[_MAX_PATH + _MAX_FNAME] = ""; 52 52 #define TRACE(x) OutputDebugString(_T(x)) 53 53 54 54 // This is an entry point for py2exe. 55 #if defined(__MINGW32__) 56 extern "C" 57 #endif 55 58 void WINAPI PyISAPISetOptions(const char *modname, BOOL is_frozen) 56 59 { 57 60 strncpy(g_CallbackModuleName, modname, -
setup.py
diff --git a/setup.py b/setup.py index 7c35d90..5872968 100644
a b import shutil 72 72 73 73 is_py3k = sys.version_info > (3,) # get this out of the way early on... 74 74 75 build_mingw32=True 76 75 77 try: 76 78 import winreg # py3k 77 79 except ImportError: … … dll_base_address = 0x1e200000 140 142 def find_platform_sdk_dir(): 141 143 # The user might have their current environment setup for the 142 144 # SDK, in which case "MSSDK_INCLUDE" and "MSSDK_LIB" vars must be set. 145 if build_mingw32: 146 return { "include": ["c:/msys64/mingw32/include", "c:/msys64/mingw32/i686-w64-mingw32/include"], 147 "lib": ["c:/msys64/mingw32/lib", "c:/msys64//mingw32/i686-w64-mingw32/lib"] } 148 143 149 if "MSSDK_INCLUDE" in os.environ and "MSSDK_LIB" in os.environ: 144 150 print("Using SDK as specified in the environment") 145 151 return { … … def find_platform_sdk_dir(): 173 179 # to prevent the extension from loading. For more details, see 174 180 # http://bugs.python.org/issue7833 (which has landed for Python 2.7 and on 3.2 175 181 # and later, which are all we care about currently) 176 from distutils.msvc9compiler import MSVCCompiler 177 MSVCCompiler._orig_spawn = MSVCCompiler.spawn 178 MSVCCompiler._orig_link = MSVCCompiler.link 182 if not build_mingw32: 183 from distutils.msvc9compiler import MSVCCompiler 184 MSVCCompiler._orig_spawn = MSVCCompiler.spawn 185 MSVCCompiler._orig_link = MSVCCompiler.link 179 186 180 187 # We need to override this method for versions where issue7833 *has* landed 181 188 # (ie, 2.7 and 3.2+) … … def manifest_get_embed_info(self, target_desc, ld_args): 195 202 196 203 # always monkeypatch it in even though it will only be called in 2.7 197 204 # and 3.2+. 198 MSVCCompiler.manifest_get_embed_info = manifest_get_embed_info 205 if not build_mingw32: 206 MSVCCompiler.manifest_get_embed_info = manifest_get_embed_info 199 207 200 208 def monkeypatched_spawn(self, cmd): 201 209 is_link = cmd[0].endswith("link.exe") or cmd[0].endswith('"link.exe"') … … def monkeypatched_link(self, target_desc, objects, output_filename, *args, **kw) 239 247 return self._orig_link(target_desc, objects, output_filename, *args, **kw) 240 248 finally: 241 249 delattr(self, '_want_assembly_kept') 242 MSVCCompiler.spawn = monkeypatched_spawn 243 MSVCCompiler.link = monkeypatched_link 250 if not build_mingw32: 251 MSVCCompiler.spawn = monkeypatched_spawn 252 MSVCCompiler.link = monkeypatched_link 244 253 245 254 246 255 sdk_info = find_platform_sdk_dir() … … class WinExt (Extension): 449 458 # Unicode, Windows executables seem to need this magic: 450 459 if "/SUBSYSTEM:WINDOWS" in self.extra_link_args: 451 460 self.extra_link_args.append("/ENTRY:wWinMainCRTStartup") 461 else: 462 self.extra_compile_args.append("-fpermissive") 463 unicode_mode = self.unicode_mode 464 if unicode_mode is None: 465 unicode_mode = is_py3k 466 if unicode_mode: 467 self.extra_compile_args.append("-DUNICODE") 468 self.extra_compile_args.append("-D_UNICODE") 469 self.extra_compile_args.append("-DWINNT") 470 # Unicode, Windows executables seem to need this magic: 471 #if "/SUBSYSTEM:WINDOWS" in self.extra_link_args: 472 # self.extra_link_args.append("/ENTRY:wWinMainCRTStartup") 452 473 453 474 class WinExt_pythonwin(WinExt): 454 475 def __init__ (self, name, **kw): … … class my_build_ext(build_ext): 641 662 # The pywintypes library is created in the build_temp 642 663 # directory, so we need to add this to library_dirs 643 664 self.library_dirs.append(self.build_temp) 644 self.mingw32 = (self.compiler == "mingw32")665 self.mingw32 = build_mingw32 645 666 if self.mingw32: 646 667 self.libraries.append("stdc++") 647 668 … … class my_build_ext(build_ext): 698 719 self.compiler.add_include_dir(extra) 699 720 # and again for lib dirs. 700 721 for extra in sdk_info["lib"]: 701 extra = os.path.join(extra, 'x64' if is_64bit else 'x86') 722 if not build_mingw32: 723 extra = os.path.join(extra, 'x64' if is_64bit else 'x86') 702 724 assert os.path.isdir(extra), extra 703 725 assert extra not in self.library_dirs # see above 704 726 assert os.path.isdir(extra), "%s doesn't exist!" % (extra,) … … class my_build_ext(build_ext): 714 736 # includes interfaces for 64-bit builds. 715 737 if self.plat_name == 'win-amd64' and ext.name == 'exchdapi': 716 738 return "No 64-bit library for utility functions available." 717 if get_build_version() >=14:739 if not build_mingw32 and get_build_version() >=14: 718 740 if ext.name == 'exchange': 719 741 ext.libraries.append('legacy_stdio_definitions') 720 742 elif ext.name == 'exchdapi': … … class my_build_ext(build_ext): 758 780 759 781 # We update the .libraries list with the resolved library name. 760 782 # This is really only so "_d" works. 761 ext.libraries = patched_libs 783 if not build_mingw32: 784 ext.libraries = patched_libs 762 785 return None # no reason - it can be built! 763 786 764 787 def _build_scintilla(self): … … class my_build_ext(build_ext): 972 995 if sys.version_info > (2, 7) and sys.version_info < (3, 3): 973 996 # only stuff built with msvc9 needs this loader. 974 997 self._build_pycom_loader() 975 self._build_scintilla() 998 if not build_mingw32: 999 self._build_scintilla() 976 1000 # Copy cpp lib files needed to create Python COM extensions 977 clib_files = (['win32', 'pywintypes%s.lib'], 978 ['win32com', 'pythoncom%s.lib'], 979 ['win32com', 'axscript%s.lib']) 1001 if build_mingw32: 1002 clib_files = (['win32', 'libpywintypes%s.a'], 1003 ['win32com', 'libpythoncom%s.a']) 1004 else: 1005 clib_files = (['win32', 'pywintypes%s.lib'], 1006 ['win32com', 'pythoncom%s.lib'], 1007 ['win32com', 'axscript%s.lib']) 980 1008 for clib_file in clib_files: 981 1009 target_dir = os.path.join(self.build_lib, clib_file[0], "libs") 982 1010 if not os.path.exists(target_dir): … … class my_build_ext(build_ext): 988 1016 self.copy_file(os.path.join(self.build_temp, fname), 989 1017 target_dir 990 1018 ) 1019 if build_mingw32: 1020 return 991 1021 # The MFC DLLs. 992 1022 target_dir = os.path.join(self.build_lib, "pythonwin") 993 1023 … … class my_build_ext(build_ext): 1081 1111 # this, distutils gets confused, as they both try and use the same 1082 1112 # .obj. 1083 1113 output_dir = os.path.join(self.build_temp, ext.name) 1114 if build_mingw32: 1115 include_dirs = [output_dir, os.path.join(output_dir, "win32", "src")] + ext.include_dirs 1116 else: 1117 include_dirs = ext.include_dirs 1084 1118 kw = {'output_dir': output_dir, 1085 1119 'macros': macros, 1086 'include_dirs': ext.include_dirs,1120 'include_dirs': include_dirs, 1087 1121 'debug': self.debug, 1088 1122 'extra_postargs': extra_args, 1089 1123 'depends': ext.depends, … … class my_build_ext(build_ext): 1115 1149 'extra_postargs': extra_args, 1116 1150 'debug': self.debug, 1117 1151 'build_temp': self.build_temp, 1152 'extra_preargs': [] 1118 1153 } 1119 1154 1120 1155 # Detect target language, if not provided … … class my_build_ext(build_ext): 1162 1197 old_build_temp = self.build_temp 1163 1198 want_static_crt = sys.version_info > (2,6) and ext.name in static_crt_modules 1164 1199 if want_static_crt: 1165 self.compiler.compile_options.remove('/MD') 1166 self.compiler.compile_options.append('/MT') 1167 self.compiler.compile_options_debug.remove('/MDd') 1168 self.compiler.compile_options_debug.append('/MTd') 1200 if not build_mingw32: 1201 self.compiler.compile_options.remove('/MD') 1202 self.compiler.compile_options.append('/MT') 1203 self.compiler.compile_options_debug.remove('/MDd') 1204 self.compiler.compile_options_debug.append('/MTd') 1169 1205 1170 1206 try: 1207 if build_mingw32: 1208 incs = set() 1209 for source in ext.sources: 1210 output_dir = os.path.join(self.build_temp, os.path.dirname(source)) 1211 if output_dir not in incs: 1212 ext.include_dirs.append(output_dir) 1213 incs.add(output_dir) 1171 1214 build_ext.build_extension(self, ext) 1172 1215 # XXX This has to be changed for mingw32 1173 1216 # Get the .lib files we need. This is limited to pywintypes, 1174 1217 # pythoncom and win32ui - but the first 2 have special names 1175 extra = self.debug and "_d.lib" or ".lib" 1218 if build_mingw32: 1219 extra = self.debug and "_d.a" or ".a" 1220 else: 1221 extra = self.debug and "_d.lib" or ".lib" 1176 1222 if ext.name in ("pywintypes", "pythoncom"): 1177 1223 # The import libraries are created as PyWinTypes23.lib, but 1178 1224 # are expected to be pywintypes.lib. 1179 name1 = "%s%d%d%s" % (ext.name, sys.version_info[0], sys.version_info[1], extra) 1180 name2 = "%s%s" % (ext.name, extra) 1225 if build_mingw32: 1226 name1 = "lib%s%d%d%s" % (ext.name, sys.version_info[0], sys.version_info[1], extra) 1227 name2 = "lib%s%s" % (ext.name, extra) 1228 else: 1229 name1 = "%s%d%d%s" % (ext.name, sys.version_info[0], sys.version_info[1], extra) 1230 name2 = "%s%s" % (ext.name, extra) 1181 1231 elif ext.name in ("win32ui",): 1182 1232 name1 = name2 = ext.name + extra 1183 1233 else: … … class my_build_ext(build_ext): 1199 1249 finally: 1200 1250 self.build_temp = old_build_temp 1201 1251 if want_static_crt: 1202 self.compiler.compile_options.remove('/MT') 1203 self.compiler.compile_options.append('/MD') 1204 self.compiler.compile_options_debug.remove('/MTd') 1205 self.compiler.compile_options_debug.append('/MDd') 1252 if not build_mingw32: 1253 self.compiler.compile_options.remove('/MT') 1254 self.compiler.compile_options.append('/MD') 1255 self.compiler.compile_options_debug.remove('/MTd') 1256 self.compiler.compile_options_debug.append('/MDd') 1206 1257 1207 1258 def get_ext_filename(self, name): 1208 1259 # The pywintypes and pythoncom extensions have special names … … class my_build_ext(build_ext): 1298 1349 for source in swig_sources: 1299 1350 swig_cmd = [swig, "-python", "-c++"] 1300 1351 swig_cmd.append("-dnone",) # we never use the .doc files. 1352 if not build_mingw32: 1353 swig_cmd.append("-I" + os.path.abspath("swig/swig_lib/python")) 1301 1354 swig_cmd.extend(self.current_extension.extra_swig_commands) 1302 1355 if not is_py3k: 1303 1356 swig_cmd.append("-DSWIG_PY2K") … … class my_install(install): 1368 1421 if not self.dry_run and not self.root: 1369 1422 # We must run the script we just installed into Scripts, as it 1370 1423 # may have had 2to3 run over it. 1371 filename = os.path.join(self.prefix, "Scripts", "pywin32_postinstall.py") 1424 if build_mingw32: 1425 filename = os.path.join(self.prefix, "bin", "pywin32_postinstall.py") 1426 else: 1427 filename = os.path.join(self.prefix, "Scripts", "pywin32_postinstall.py") 1372 1428 if not os.path.isfile(filename): 1373 1429 raise RuntimeError("Can't find '%s'" % (filename,)) 1374 1430 print("Executing post install script...") … … def my_new_compiler(**kw): 1388 1444 return orig_new_compiler(**kw) 1389 1445 1390 1446 # No way to cleanly wedge our compiler sub-class in. 1391 from distutils import ccompiler , msvccompiler1447 from distutils import ccompiler 1392 1448 orig_new_compiler = ccompiler.new_compiler 1393 1449 ccompiler.new_compiler = my_new_compiler 1394 1450 1395 base_compiler = msvccompiler.MSVCCompiler 1451 if build_mingw32: 1452 from distutils import cygwinccompiler 1453 base_compiler = cygwinccompiler.Mingw32CCompiler 1454 else: 1455 from distutils import msvccompiler 1456 base_compiler = msvccompiler.MSVCCompiler 1457 1396 1458 1397 1459 class my_compiler(base_compiler): 1398 1460 # Just one GUIDS.CPP and it gives trouble on mainwin too. Maybe I 1399 1461 # should just rename the file, but a case-only rename is likely to be 1400 1462 # worse! This can probably go away once we kill the VS project files 1401 1463 # though, as we can just specify the lowercase name in the module def. 1402 _cpp_extensions = base_compiler._cpp_extensions + [".CPP"] 1464 if not build_mingw32: 1465 _cpp_extensions = base_compiler._cpp_extensions + [".CPP"] 1403 1466 src_extensions = base_compiler.src_extensions + [".CPP"] 1404 1467 1405 1468 def link(self, … … class my_compiler(base_compiler): 1411 1474 library_dirs=None, 1412 1475 runtime_library_dirs=None, 1413 1476 export_symbols=None, 1414 debug=0, *args, **kw): 1415 msvccompiler.MSVCCompiler.link( self, 1416 target_desc, 1417 objects, 1418 output_filename, 1419 output_dir, 1420 libraries, 1421 library_dirs, 1422 runtime_library_dirs, 1423 export_symbols, 1424 debug, *args, **kw) 1477 debug=0, extra_preargs = None, *args, **kw): 1478 if build_mingw32: 1479 temp_dir = os.path.dirname(objects[0]) 1480 dll_name = os.path.splitext(os.path.basename(output_filename))[0] 1481 lib_file = os.path.join(temp_dir, 'lib' + dll_name + ".a") 1482 implib_arg="-Wl,--out-implib,%s" % lib_file 1483 1484 if extra_preargs: 1485 extra_preargs.extend(implib_arg) 1486 else: 1487 extra_preargs = [implib_arg] 1488 1489 cygwinccompiler.Mingw32CCompiler.link( self, 1490 target_desc, 1491 objects, 1492 output_filename, 1493 output_dir, 1494 libraries, 1495 library_dirs, 1496 runtime_library_dirs, 1497 export_symbols, 1498 debug, extra_preargs, 1499 *args, **kw) 1500 else: 1501 msvccompiler.MSVCCompiler.link( self, 1502 target_desc, 1503 objects, 1504 output_filename, 1505 output_dir, 1506 libraries, 1507 library_dirs, 1508 runtime_library_dirs, 1509 export_symbols, 1510 debug, *args, **kw) 1511 1425 1512 # Here seems a good place to stamp the version of the built 1426 1513 # target. Do this externally to avoid suddenly dragging in the 1427 1514 # modules needed by this process, and which we will soon try and … … class my_compiler(base_compiler): 1457 1544 if not ok: 1458 1545 log.info('Unable to import verstamp, no version info will be added') 1459 1546 1547 if build_mingw32: 1548 def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): 1549 if ext == ".mc": 1550 try: 1551 basename=os.path.basename(src)[:-3] 1552 outdir=os.path.dirname(obj) 1553 self.spawn(["windmc", "-h", outdir, "-r", outdir, src]) 1554 self.spawn(["windres", "-i", 1555 os.path.join(outdir, basename + ".rc"), 1556 "-o", obj]) 1557 except DistutilsExecError as msg: 1558 raise CompileError(msg) 1559 else: 1560 cygwinccompiler.Mingw32CCompiler._compile(self, 1561 obj, src, ext, cc_args, 1562 extra_postargs, pp_opts) 1563 1564 def object_filenames(self, source_filenames, strip_dir=0, output_dir=''): 1565 unproc_src_names = [] 1566 obj_names = [] 1567 for src_name in source_filenames: 1568 base, ext = os.path.splitext(src_name) 1569 if ext==".mc": 1570 if unproc_src_names: 1571 obj_names.extend(cygwinccompiler.Mingw32CCompiler.\ 1572 object_filenames(self, unproc_src_names, 1573 strip_dir = strip_dir, 1574 output_dir = output_dir)) 1575 unproc_src_names = [] 1576 obj_names.append (os.path.join(output_dir, 1577 base + ext + self.obj_extension)) 1578 else: 1579 unproc_src_names.append(src_name) 1580 if unproc_src_names: 1581 obj_names.extend(cygwinccompiler.Mingw32CCompiler.\ 1582 object_filenames(self, unproc_src_names, strip_dir = strip_dir, 1583 output_dir = output_dir)) 1584 return obj_names 1585 1460 1586 1461 1587 ################################################################ 1462 1588 … … for info in ( 1550 1676 win32/src/win32crypt/PyCRYPTPROV.cpp 1551 1677 win32/src/win32crypt/PyCTL_CONTEXT.cpp 1552 1678 """), 1553 ("win32file", " ", None, 0x0500, """1679 ("win32file", "wsock32 ws2_32" if build_mingw32 else "", None, 0x0500, """ 1554 1680 win32/src/win32file.i 1555 1681 win32/src/win32file_comm.cpp 1556 1682 """), … … for info in ( 1607 1733 sources = info[4].split() 1608 1734 extra_compile_args = [] 1609 1735 ext = WinExt_win32(name, 1610 libraries=lib_names ,1736 libraries=lib_names + (" pywintypes" if build_mingw32 else ""), 1611 1737 extra_compile_args = extra_compile_args, 1612 1738 windows_h_version = windows_h_ver, 1613 1739 sources = sources, … … win32_extensions += [ 1620 1746 sources = """ 1621 1747 win32\\src\\win32evtlog_messages.mc win32\\src\\win32evtlog.i 1622 1748 """.split(), 1623 libraries="advapi32 oleaut32" ,1749 libraries="advapi32 oleaut32" + (" pywintypes" if build_mingw32 else ""), 1624 1750 delay_load_libraries="wevtapi", 1625 1751 windows_h_version=0x0600 1626 1752 ), … … win32_extensions += [ 1628 1754 sources = """ 1629 1755 win32/src/win32apimodule.cpp win32/src/win32api_display.cpp 1630 1756 """.split(), 1631 libraries="user32 advapi32 shell32 version",1757 libraries="user32 advapi32 shell32 version" + (" pywintypes" if build_mingw32 else ""), 1632 1758 delay_load_libraries="powrprof", 1633 1759 windows_h_version=0x0500, 1634 1760 ), … … win32_extensions += [ 1638 1764 win32/src/win32gui.i 1639 1765 """.split(), 1640 1766 windows_h_version=0x0500, 1641 libraries="gdi32 user32 comdlg32 comctl32 shell32" ,1767 libraries="gdi32 user32 comdlg32 comctl32 shell32" + (" pywintypes" if build_mingw32 else ""), 1642 1768 define_macros = [("WIN32GUI", None)], 1643 1769 ), 1644 1770 # winxpgui is built from win32gui.i, but sets up different #defines before … … win32_extensions += [ 1648 1774 win32/src/winxpgui.rc win32/src/win32dynamicdialog.cpp 1649 1775 win32/src/win32gui.i 1650 1776 """.split(), 1651 libraries="gdi32 user32 comdlg32 comctl32 shell32" ,1777 libraries="gdi32 user32 comdlg32 comctl32 shell32" + (" pywintypes" if build_mingw32 else ""), 1652 1778 windows_h_version=0x0500, 1653 1779 define_macros = [("WIN32GUI",None), ("WINXPGUI",None)], 1654 1780 extra_swig_commands=["-DWINXPGUI"], … … win32_extensions += [ 1656 1782 # winxptheme 1657 1783 WinExt_win32("_winxptheme", 1658 1784 sources = ["win32/src/_winxptheme.i"], 1659 libraries="gdi32 user32 comdlg32 comctl32 shell32 Uxtheme" ,1785 libraries="gdi32 user32 comdlg32 comctl32 shell32 Uxtheme" + (" pywintypes" if build_mingw32 else ""), 1660 1786 windows_h_version=0x0500, 1661 1787 ), 1662 1788 ] … … win32_extensions += [ 1664 1790 WinExt_win32('servicemanager', 1665 1791 sources = ["win32/src/PythonServiceMessages.mc", "win32/src/PythonService.cpp"], 1666 1792 extra_compile_args = ['-DPYSERVICE_BUILD_DLL'], 1667 libraries = "user32 ole32 advapi32 shell32" ,1793 libraries = "user32 ole32 advapi32 shell32" + (" pywintypes" if build_mingw32 else ""), 1668 1794 windows_h_version = 0x500, 1669 1795 unicode_mode=True,), 1670 1796 ] … … dirs = { 1695 1821 1696 1822 # The COM modules. 1697 1823 pythoncom = WinExt_system32('pythoncom', 1698 sources=(""" 1824 sources=((("%(win32com)s/initguid.cpp" if build_mingw32 else "") + 1825 """ 1699 1826 %(win32com)s/dllmain.cpp %(win32com)s/ErrorUtils.cpp 1700 1827 %(win32com)s/MiscTypes.cpp %(win32com)s/oleargs.cpp 1701 1828 %(win32com)s/PyComHelpers.cpp %(win32com)s/PyFactory.cpp … … pythoncom = WinExt_system32('pythoncom', 1737 1864 %(win32com)s/extensions/PyICancelMethodCalls.cpp %(win32com)s/extensions/PyIContext.cpp 1738 1865 %(win32com)s/extensions/PyIEnumContextProps.cpp %(win32com)s/extensions/PyIClientSecurity.cpp 1739 1866 %(win32com)s/extensions/PyIServerSecurity.cpp 1740 """ % dirs).split(),1867 """) % dirs).split(), 1741 1868 depends=(""" 1742 1869 %(win32com)s/include\\propbag.h %(win32com)s/include\\PyComTypeObjects.h 1743 1870 %(win32com)s/include\\PyFactory.h %(win32com)s/include\\PyGConnectionPoint.h … … pythoncom = WinExt_system32('pythoncom', 1763 1890 %(win32com)s/include\\PyIEnumContextProps.h %(win32com)s/include\\PyIClientSecurity.h 1764 1891 %(win32com)s/include\\PyIServerSecurity.h 1765 1892 """ % dirs).split(), 1766 libraries = "oleaut32 ole32 user32 urlmon ",1893 libraries = "oleaut32 ole32 user32 urlmon uuid" + (" pywintypes" if build_mingw32 else ""), 1767 1894 export_symbol_file = 'com/win32com/src/PythonCOM.def', 1768 1895 extra_compile_args = ['-DBUILD_PYTHONCOM'], 1769 1896 pch_header = "stdafx.h", … … com_extensions += [ 1788 1915 %(adsi)s/PyIADs.cpp 1789 1916 """ % dirs).split()), 1790 1917 WinExt_win32com('axcontrol', pch_header="axcontrol_pch.h", 1791 sources=( """1918 sources=((""" 1792 1919 %(axcontrol)s/AXControl.cpp 1793 1920 %(axcontrol)s/PyIOleControl.cpp %(axcontrol)s/PyIOleControlSite.cpp 1794 1921 %(axcontrol)s/PyIOleInPlaceActiveObject.cpp … … com_extensions += [ 1799 1926 %(axcontrol)s/PyIOleClientSite.cpp %(axcontrol)s/PyIOleInPlaceSite.cpp 1800 1927 %(axcontrol)s/PyIOleObject.cpp %(axcontrol)s/PyIViewObject2.cpp 1801 1928 %(axcontrol)s/PyIOleCommandTarget.cpp 1802 """ % dirs).split()), 1929 """ + ("%(axcontrol)s/initguid.cpp" if build_mingw32 else "")) % dirs).split(), 1930 libraries="pythoncom pywintypes"), 1803 1931 WinExt_win32com('axscript', 1804 sources=( """1805 %(axscript)s/AXScript.cpp 1932 sources=((""" 1933 %(axscript)s/AXScript.cpp %(axscript)s/initguid.cpp 1806 1934 %(axscript)s/GUIDS.CPP %(axscript)s/PyGActiveScript.cpp 1807 1935 %(axscript)s/PyGActiveScriptError.cpp %(axscript)s/PyGActiveScriptParse.cpp 1808 1936 %(axscript)s/PyGActiveScriptSite.cpp %(axscript)s/PyGObjectSafety.cpp … … com_extensions += [ 1810 1938 %(axscript)s/PyIActiveScriptParse.cpp %(axscript)s/PyIActiveScriptParseProcedure.cpp 1811 1939 %(axscript)s/PyIActiveScriptSite.cpp %(axscript)s/PyIMultiInfos.cpp 1812 1940 %(axscript)s/PyIObjectSafety.cpp %(axscript)s/stdafx.cpp 1813 """ % dirs).split(),1941 """ + ("%(axscript)s/initguid.cpp" if build_mingw32 else "")) % dirs).split(), 1814 1942 depends=(""" 1815 1943 %(axscript)s/AXScript.h 1816 1944 %(axscript)s/guids.h %(axscript)s/PyGActiveScriptError.h … … com_extensions += [ 1820 1948 """ % dirs).split(), 1821 1949 extra_compile_args = ['-DPY_BUILD_AXSCRIPT'], 1822 1950 implib_name="axscript", 1823 pch_header = "stdafx.h" 1951 pch_header = "stdafx.h", 1952 libraries="pythoncom pywintypes" if build_mingw32 else "" 1824 1953 ), 1825 1954 WinExt_win32com('axdebug', 1826 1955 libraries="axscript", … … com_extensions += [ 1870 1999 %(axdebug)s/PyIRemoteDebugApplicationEvents.cpp 1871 2000 %(axdebug)s/PyIRemoteDebugApplicationThread.cpp 1872 2001 %(axdebug)s/stdafx.cpp 1873 """ % dirs).split(), 1874 ), 2002 """ % dirs).split() ), 1875 2003 WinExt_win32com('internet', pch_header="internet_pch.h", 1876 sources=( """2004 sources=((""" 1877 2005 %(internet)s/internet.cpp %(internet)s/PyIDocHostUIHandler.cpp 1878 2006 %(internet)s/PyIHTMLOMWindowServices.cpp %(internet)s/PyIInternetBindInfo.cpp 1879 2007 %(internet)s/PyIInternetPriority.cpp %(internet)s/PyIInternetProtocol.cpp 1880 2008 %(internet)s/PyIInternetProtocolInfo.cpp %(internet)s/PyIInternetProtocolRoot.cpp 1881 2009 %(internet)s/PyIInternetProtocolSink.cpp %(internet)s/PyIInternetSecurityManager.cpp 1882 """ % dirs).split(), 1883 depends=["%(internet)s/internet_pch.h" % dirs]), 2010 """ + ("%(internet)s/initguid.cpp" if build_mingw32 else "")) % dirs).split(), 2011 depends=["%(internet)s/internet_pch.h" % dirs], 2012 libraries="pythoncom pywintypes" if build_mingw32 else ""), 1884 2013 WinExt_win32com('mapi', libraries="advapi32", pch_header="PythonCOM.h", 1885 2014 include_dirs=["%(mapi)s/mapi_headers" % dirs], 1886 2015 optional_headers=['edkmdb.h', 'edkguid.h'], … … com_extensions += [ 1929 2058 %(mapi)s/mapi_stub_library/MapiStubLibrary.cpp 1930 2059 %(mapi)s/mapi_stub_library/StubUtils.cpp 1931 2060 """ % dirs).split()), 1932 WinExt_win32com('shell', libraries='shell32', pch_header="shell_pch.h", 2061 2062 WinExt_win32com('shell', libraries=('pythoncom pywintypes ' if build_mingw32 else '') + 'shell32', pch_header="shell_pch.h", 1933 2063 windows_h_version = 0x600, 1934 sources=( """2064 sources=((""" 1935 2065 %(shell)s/PyIActiveDesktop.cpp 1936 2066 %(shell)s/PyIApplicationDestinations.cpp 1937 2067 %(shell)s/PyIApplicationDocumentLists.cpp … … com_extensions += [ 1956 2086 %(shell)s/PyIEnumObjects.cpp 1957 2087 %(shell)s/PyIEnumResources.cpp 1958 2088 %(shell)s/PyIEnumShellItems.cpp 1959 %(shell)s/PyIEmptyVolumeCache.cpp1960 %(shell)s/PyIEmptyVolumeCacheCallBack.cpp1961 2089 %(shell)s/PyIExplorerBrowser.cpp 1962 2090 %(shell)s/PyIExplorerBrowserEvents.cpp 1963 2091 %(shell)s/PyIExplorerCommand.cpp … … com_extensions += [ 2002 2130 %(shell)s/PyITransferSource.cpp 2003 2131 %(shell)s/PyIUniformResourceLocator.cpp 2004 2132 %(shell)s/shell.cpp 2005 2006 """ % dirs).split()), 2133 """ + ("%(shell)s/initguid.cpp" if build_mingw32 else 2134 "%(shell)s/PyIEmptyVolumeCache.cpp %(shell)s/PyIEmptyVolumeCacheCallBack.cpp")) 2135 % dirs).split()), 2007 2136 2008 2137 WinExt_win32com('propsys', libraries='propsys', delay_load_libraries='shell32', 2009 2138 unicode_mode=True, … … com_extensions += [ 2031 2160 implib_name="pypropsys", 2032 2161 ), 2033 2162 2034 2035 WinExt_win32com('taskscheduler', libraries='mstask', 2036 sources=(""" 2163 WinExt_win32com('taskscheduler', libraries='mstask' + (' pythoncom pywintypes' if build_mingw32 else ''), 2164 sources=((""" 2037 2165 %(taskscheduler)s/taskscheduler.cpp 2038 2166 %(taskscheduler)s/PyIProvideTaskPage.cpp 2039 2167 %(taskscheduler)s/PyIScheduledWorkItem.cpp … … com_extensions += [ 2041 2169 %(taskscheduler)s/PyITaskScheduler.cpp 2042 2170 %(taskscheduler)s/PyITaskTrigger.cpp 2043 2171 2044 """ % dirs).split()),2172 """ + ("%(taskscheduler)s/initguid.cpp" if build_mingw32 else ""))% dirs).split()), 2045 2173 WinExt_win32com('bits', libraries='Bits', pch_header="bits_pch.h", 2046 2174 sources=(""" 2047 2175 %(bits)s/bits.cpp … … com_extensions += [ 2077 2205 %(directsound)s/PyIDirectSoundCaptureBuffer.h %(directsound)s/PyIDirectSoundNotify.h 2078 2206 """ % dirs).split(), 2079 2207 optional_headers = ['dsound.h'], 2080 libraries= 'user32 dsound dxguid'),2081 WinExt_win32com('authorization', libraries= 'aclui advapi32',2208 libraries=('pythoncom pywintypes ' if build_mingw32 else '') + 'user32 dsound dxguid uuid'), 2209 WinExt_win32com('authorization', libraries=('pythoncom pywintypes ' if build_mingw32 else '') + 'aclui advapi32', 2082 2210 sources=(""" 2083 2211 %(authorization)s/authorization.cpp 2084 2212 %(authorization)s/PyGSecurityInformation.cpp 2085 """ % dirs).split()) ,2213 """ % dirs).split()) 2086 2214 ] 2087 2215 2088 2216 pythonwin_extensions = [ … … other_extensions.append( 2253 2381 W32_exe_files = [ 2254 2382 WinExt_win32("pythonservice", 2255 2383 sources=[os.path.join("win32", "src", s) for s in 2256 "PythonService.cpp PythonService.rc".split()],2384 (("PythonServiceMessages.mc " if build_mingw32 else "") + "PythonService.cpp PythonService.rc").split()], 2257 2385 unicode_mode = True, 2258 extra_link_args=["/SUBSYSTEM:CONSOLE"], 2259 libraries = "user32 advapi32 ole32 shell32"), 2260 WinExt_pythonwin("Pythonwin", 2261 sources = [ 2262 "Pythonwin/pythonwin.cpp", 2263 "Pythonwin/pythonwin.rc", 2264 "Pythonwin/stdafxpw.cpp", 2265 ], 2266 extra_link_args=["/SUBSYSTEM:WINDOWS"], 2267 optional_headers=['afxres.h']), 2386 extra_link_args=[] if build_mingw32 else ["/SUBSYSTEM:CONSOLE"], 2387 libraries = ("pywintypes " if build_mingw32 else "") + "user32 advapi32 ole32 shell32") 2268 2388 ] 2269 2389 2390 if not build_mingw32: 2391 W32_exe_files.append( 2392 WinExt_pythonwin("Pythonwin", 2393 sources = [ 2394 "Pythonwin/pythonwin.cpp", 2395 "Pythonwin/pythonwin.rc", 2396 "Pythonwin/stdafxpw.cpp", 2397 ], 2398 extra_link_args=["/SUBSYSTEM:WINDOWS"], 2399 optional_headers=['afxres.h']) 2400 ) 2401 2270 2402 # Special definitions for SWIG. 2271 2403 swig_interface_parents = { 2272 2404 # source file base, "base class" for generated COM support … … packages=['win32com', 2415 2547 ] 2416 2548 2417 2549 py_modules = expand_modules("win32\\lib") 2418 ext_modules = win32_extensions + com_extensions + pythonwin_extensions + \ 2550 if build_mingw32: 2551 ext_modules = win32_extensions + com_extensions + other_extensions 2552 else: 2553 ext_modules = win32_extensions + com_extensions + pythonwin_extensions + \ 2419 2554 other_extensions 2420 2555 2421 2556 # Build a map of DLL base addresses. According to Python's PC\dllbase_nt.txt, -
win32/src/PerfMon/perfmondata.cpp
diff --git a/win32/src/PerfMon/perfmondata.cpp b/win32/src/PerfMon/perfmondata.cpp index 23e7557..c456d89 100644
a b PPERF_COUNTER_BLOCK pCounterBlock; 89 89 // these are used to insure that the data collection functions 90 90 // accessed by Perflib will have the correct calling format. 91 91 // 92 93 #if defined(__MINGW32__) 94 extern "C" { 95 #endif 96 92 97 PM_OPEN_PROC OpenPerformanceData; 93 98 PM_COLLECT_PROC CollectPerformanceData; 94 99 PM_CLOSE_PROC ClosePerformanceData; 95 100 101 #if defined(__MINGW32__) 102 } 103 #endif 104 96 105 TCHAR szFullModulePath[MAX_PATH]; 97 106 TCHAR szModuleName[MAX_PATH]; // will point into the buffer above. 98 107 … … BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) 130 139 131 140 132 141 142 #if defined(__MINGW32__) 143 extern "C" 144 #endif 133 145 DWORD APIENTRY OpenPerformanceData( LPWSTR lpDeviceNames ) 134 146 /*++ 135 147 Routine Description: … … OpenExitPoint: 278 290 return status; 279 291 } 280 292 293 #if defined(__MINGW32__) 294 extern "C" 295 #endif 281 296 DWORD APIENTRY CollectPerformanceData( 282 297 IN LPWSTR lpValueName, 283 298 IN OUT LPVOID *lppData, … … Arguments: IN LPWSTR lpValueName 379 394 return ERROR_SUCCESS; 380 395 } 381 396 397 #if defined(__MINGW32__) 398 extern "C" 399 #endif 382 400 DWORD APIENTRY ClosePerformanceData() 383 401 /*++ 384 402 Routine Description: … … HANDLE MonOpenEventLog (const TCHAR *szSourceName) 445 463 --*/ 446 464 { 447 465 HKEY hAppKey; 466 #if defined(__MINGW32__) 467 TCHAR LogLevelKeyName[] = _T("SOFTWARE\\Microsoft\\Windows_NT\\CurrentVersion\\Perflib"); 468 #else 448 469 TCHAR LogLevelKeyName[] = _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib"); 470 #endif 449 471 450 472 TCHAR LogLevelValueName[] = _T("EventLogLevel"); 451 473 LONG lStatus; -
win32/src/PySECURITY_DESCRIPTOR.cpp
diff --git a/win32/src/PySECURITY_DESCRIPTOR.cpp b/win32/src/PySECURITY_DESCRIPTOR.cpp index 218daf9..2873603 100644
a b 6 6 #include "PySecurityObjects.h" 7 7 #include "structmember.h" 8 8 9 #if defined(__MINGW32__) 10 #include <algorithm> 11 #endif 12 9 13 #ifndef NO_PYWINTYPES_SECURITY 10 14 BOOL (WINAPI *setsecuritydescriptorcontrol)(PSECURITY_DESCRIPTOR, SECURITY_DESCRIPTOR_CONTROL, SECURITY_DESCRIPTOR_CONTROL)=NULL; 11 15 … … PySECURITY_DESCRIPTOR::PySECURITY_DESCRIPTOR(Py_ssize_t cb /*= 0*/) 786 790 { 787 791 ob_type = &PySECURITY_DESCRIPTORType; 788 792 _Py_NewReference(this); 793 #if defined(__MINGW32__) 794 cb = std::max(cb, static_cast<Py_ssize_t>(SECURITY_DESCRIPTOR_MIN_LENGTH)); 795 #else 789 796 cb = max(cb, SECURITY_DESCRIPTOR_MIN_LENGTH); 797 #endif 790 798 PSECURITY_DESCRIPTOR psd = malloc(cb); 791 799 this->m_psd=NULL; 792 800 if (::InitializeSecurityDescriptor(psd, SECURITY_DESCRIPTOR_REVISION)) -
win32/src/PyWinTypes.h
diff --git a/win32/src/PyWinTypes.h b/win32/src/PyWinTypes.h index 00ac8a1..a5fc23e 100644
a b PYWINTYPES_EXPORT PyObject *PyWinObject_FromULARGE_INTEGER(ULARGE_INTEGER &val); 393 393 // We also happen to know a LARGE_INTEGER is an __int64, so do it the easy way 394 394 #define PyWinObject_AsPY_LONG_LONG(ob, pResult) PyWinObject_AsLARGE_INTEGER((ob), (LARGE_INTEGER *)(pResult)) 395 395 #define PyWinObject_AsUPY_LONG_LONG(ob, pResult) PyWinObject_AsULARGE_INTEGER((ob), (ULARGE_INTEGER *)(pResult)) 396 #if defined(__MINGW32__) 397 #define PyWinObject_FromPY_LONG_LONG(val) PyWinObject_FromLARGE_INTEGER(val) 398 #define PyWinObject_FromUPY_LONG_LONG(val) PyWinObject_FromULARGE_INTEGER(val) 399 #else 396 400 #define PyWinObject_FromPY_LONG_LONG(val) PyWinObject_FromLARGE_INTEGER((LARGE_INTEGER)val) 397 401 #define PyWinObject_FromUPY_LONG_LONG(val) PyWinObject_FromULARGE_INTEGER((ULARGE_INTEGER)val) 402 #endif 398 403 399 404 // A DWORD_PTR and ULONG_PTR appear to mean "integer long enough to hold a pointer" 400 405 // It is *not* actually a pointer (but is the same size as a pointer) … … private: 797 802 798 803 // A helper for simple exception handling. 799 804 // try/__try 800 #if def MAINWIN805 #if defined(__MINGW32__) || defined(MAINWIN) 801 806 #define PYWINTYPES_TRY try 802 807 #else 803 808 #define PYWINTYPES_TRY __try -
win32/src/PyWinTypesmodule.cpp
diff --git a/win32/src/PyWinTypesmodule.cpp b/win32/src/PyWinTypesmodule.cpp index e136fff..77e10a4 100644
a b BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved) 1140 1140 } 1141 1141 1142 1142 // Function to format a python traceback into a character string. 1143 #if defined(__MINGW32__) 1144 #define GPEM_ERROR(what) {errorMsg = "<Error getting traceback - " what ">";goto done;} 1145 #else 1143 1146 #define GPEM_ERROR(what) {errorMsg = "<Error getting traceback - " ## what ## ">";goto done;} 1147 #endif 1144 1148 char *GetPythonTraceback(PyObject *exc_type, PyObject *exc_value, PyObject *exc_tb) 1145 1149 { 1146 1150 // Sleep (30000); // Time enough to attach the debugger (barely) -
win32/src/PythonService.cpp
diff --git a/win32/src/PythonService.cpp b/win32/src/PythonService.cpp index c7b7531..8a9121d 100644
a b static PyObject *PySetEventSourceName(PyObject *self, PyObject *args) 302 302 if (!PyWinObject_AsTCHAR(obName, &msg)) 303 303 return NULL; 304 304 _tcsncpy(g_szEventSourceName, msg, 305 #if defined(__MINGW32__) 306 sizeof(g_szEventSourceName)/sizeof(TCHAR)); 307 #else 305 308 sizeof g_szEventSourceName/sizeof TCHAR); 309 #endif 306 310 PyWinObject_FreeTCHAR(msg); 307 311 g_bRegisteredEventSource = FALSE; // so this name re-registered. 308 312 if (registerNow) … … BOOL PythonService_Initialize( const TCHAR *evtsrc_name, const TCHAR *evtsrc_fil 680 684 { 681 685 if (evtsrc_name && *evtsrc_name) 682 686 _tcsncpy(g_szEventSourceName, evtsrc_name, 687 #if defined(__MINGW32__) 688 sizeof(g_szEventSourceName)/sizeof(TCHAR)); 689 #else 683 690 sizeof g_szEventSourceName/sizeof TCHAR); 691 #endif 684 692 if (evtsrc_file && *evtsrc_file) 685 693 _tcsncpy(g_szEventSourceFileName, evtsrc_file, 694 #if defined(__MINGW32__) 695 sizeof(g_szEventSourceFileName)/sizeof(TCHAR)); 696 #else 686 697 sizeof g_szEventSourceFileName/sizeof TCHAR); 698 #endif 687 699 return TRUE; 688 700 } 689 701 … … static void CheckRegisterEventSourceFile() 1443 1455 1444 1456 if (!g_szEventSourceFileName[0]) 1445 1457 GetModuleFileName(g_hdll, g_szEventSourceFileName, 1458 #if defined(__MINGW32__) 1459 sizeof(g_szEventSourceFileName)/sizeof(TCHAR)); 1460 #else 1446 1461 sizeof g_szEventSourceFileName/sizeof TCHAR); 1462 #endif 1447 1463 1448 1464 HKEY hkey; 1449 1465 TCHAR keyName[MAX_PATH]; … … BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) 1549 1565 #else // PYSERVICE_BUILD_DLL 1550 1566 // Our EXE entry point. 1551 1567 1568 #if defined(__MINGW32__) 1569 extern "C" int main(int argc, TCHAR **argv) 1570 #else 1552 1571 int _tmain(int argc, TCHAR **argv) 1572 #endif 1553 1573 { 1554 1574 PyObject *module, *f; 1555 1575 PyThreadState *threadState; -
win32/src/PythonServiceMessages.mc
diff --git a/win32/src/PythonServiceMessages.mc b/win32/src/PythonServiceMessages.mc index ef26675..c8787a4 100644
a b MessageId=0x7 134 134 Severity=Error 135 135 SymbolicName=E_UNUSED2 136 136 Language=English 137 %1 137 138 . 138 139 139 140 MessageId=0x8 -
win32/src/odbc.cpp
diff --git a/win32/src/odbc.cpp b/win32/src/odbc.cpp index c58aef5..9d3dc35 100644
a b 18 18 #include "PyWinObjects.h" 19 19 #include "structmember.h" 20 20 21 #if defined(__MINGW32__) 22 #include <algorithm> 23 #endif 24 21 25 #include <sql.h> 22 26 #include <sqlext.h> 23 27 … … static cursorObject *cursor(PyObject *o) 105 109 } 106 110 107 111 static void cursorDealloc(PyObject *self); 108 PyMethodDef cursorMethods[];109 PyMemberDef cursorMembers[];110 112 111 static PyTypeObject Cursor_Type =112 {113 PYWIN_OBJECT_HEAD114 "odbccur", /*tp_name */115 sizeof(cursorObject), /*tp_basicsize */116 0, /*tp_itemsize */117 cursorDealloc, /*tp_dealloc */118 0, /*tp_print */119 0, /*tp_getattr */120 0, /*tp_setattr */121 0, /*tp_compare */122 0, /*tp_repr */123 0, /*tp_as_number */124 0, /* tp_as_sequence */125 0, /* tp_as_mapping */126 0, /* tp_hash */127 0, /* tp_call */128 0, /*tp_str */129 PyObject_GenericGetAttr, /* tp_getattro dbiGetAttr */130 PyObject_GenericSetAttr, /* tp_setattro */131 0, /*tp_as_buffer*/132 Py_TPFLAGS_DEFAULT, /* tp_flags */133 0, /* tp_doc */134 0, /* tp_traverse */135 0, /* tp_clear */136 0, /* tp_richcompare */137 0, /* tp_weaklistoffset */138 0, /* tp_iter */139 0, /* tp_iternext */140 cursorMethods, /* tp_methods */141 cursorMembers, /* tp_members */142 0, /* tp_getset */143 0, /* tp_base */144 0, /* tp_dict */145 0, /* tp_descr_get */146 0, /* tp_descr_set */147 0, /* tp_dictoffset */148 0, /* tp_init */149 0, /* tp_alloc */150 0, /* tp_new */151 };152 113 153 114 154 115 static void connectionDealloc(PyObject *self); 155 PyMethodDef connectionMethods[];156 PyMemberDef connectionMembers[];157 static PyTypeObject Connection_Type =158 {159 PYWIN_OBJECT_HEAD160 "odbcconn", /*tp_name */161 sizeof (connectionObject), /*tp_basicsize */162 0, /*tp_itemsize */163 connectionDealloc, /*tp_dealloc */164 0, /*tp_print */165 0, /*tp_getattr */166 0, /*tp_setattr */167 0, /*tp_compare */168 0, /*tp_repr */169 0, /*tp_as_number */170 0, /* tp_as_sequence */171 0, /* tp_as_mapping */172 0, /* tp_hash */173 0, /* tp_call */174 0, /*tp_str */175 PyObject_GenericGetAttr, /* tp_getattro dbiGetAttr */176 PyObject_GenericSetAttr, /* tp_setattro */177 0, /*tp_as_buffer*/178 Py_TPFLAGS_DEFAULT, /* tp_flags */179 0, /* tp_doc */180 0, /* tp_traverse */181 0, /* tp_clear */182 0, /* tp_richcompare */183 0, /* tp_weaklistoffset */184 0, /* tp_iter */185 0, /* tp_iternext */186 connectionMethods, /* tp_methods */187 connectionMembers, /* tp_members */188 0, /* tp_getset */189 0, /* tp_base */190 0, /* tp_dict */191 0, /* tp_descr_get */192 0, /* tp_descr_set */193 0, /* tp_dictoffset */194 0, /* tp_init */195 0, /* tp_alloc */196 0, /* tp_new */197 };198 116 199 117 static int unsuccessful(RETCODE rc) 200 118 { … … static int attemptReconnect(cursorObject *cur) 334 252 } 335 253 336 254 337 /* @pymethod |connection|setautocommit|Sets the autocommit mode. */338 static PyObject *odbcSetAutoCommit(PyObject *self, PyObject *args)339 {340 int c;341 connectionObject *conn;342 /* @pyparm int|c||The boolean autocommit mode. */343 if (!PyArg_ParseTuple(args, "i",&c))344 return NULL;345 conn=connection(self);346 if (c==0)347 {348 if (unsuccessful(SQLSetConnectOption(349 conn->hdbc,350 SQL_AUTOCOMMIT,351 SQL_AUTOCOMMIT_OFF)))352 {353 connectionError(conn, _T("SETAUTOCOMMIT"));354 return NULL;355 }356 }357 else358 {359 if (unsuccessful(SQLSetConnectOption(360 conn->hdbc,361 SQL_AUTOCOMMIT,362 SQL_AUTOCOMMIT_ON)))363 {364 connectionError(conn, _T("SETAUTOCOMMIT"));365 return NULL;366 };367 }368 369 Py_INCREF(Py_None);370 return Py_None;371 }372 373 374 /* @pymethod |connection|commit|Commits a transaction. */375 static PyObject *odbcCommit(PyObject *self, PyObject *args)376 {377 RETCODE rc;378 Py_BEGIN_ALLOW_THREADS379 rc = SQLTransact(380 Env,381 connection(self)->hdbc,382 SQL_COMMIT);383 Py_END_ALLOW_THREADS384 if (unsuccessful(rc))385 {386 connectionError(connection(self), _T("COMMIT"));387 return 0;388 }389 else390 {391 Py_INCREF(Py_None);392 return Py_None;393 }394 }395 396 /* @pymethod |connection|rollback|Rollsback a transaction. */397 static PyObject *odbcRollback(PyObject *self, PyObject *args)398 {399 RETCODE rc;400 Py_BEGIN_ALLOW_THREADS401 rc = SQLTransact(402 Env,403 connection(self)->hdbc,404 SQL_ROLLBACK);405 Py_END_ALLOW_THREADS406 if (unsuccessful(rc))407 {408 connectionError(connection(self), _T("ROLLBACK"));409 return 0;410 }411 else {412 Py_INCREF(Py_None);413 return Py_None;414 }415 }416 417 /* @pymethod |connection|cursor|Creates a <o cursor> object */418 static PyObject *odbcCursor(PyObject *self, PyObject *args)419 {420 connectionObject *conn = connection(self);421 if (conn->connected == 0)422 {423 if (doConnect(conn))424 {425 return 0;426 }427 }428 429 cursorObject *cur = PyObject_New(cursorObject, &Cursor_Type);430 if (cur == NULL)431 return NULL;432 433 cur->outputVars = 0;434 cur->inputVars = 0;435 cur->description = 0;436 cur->max_width = 65536L;437 cur->my_conx = 0;438 cur->hstmt=NULL;439 cur->cursorError=odbcError;440 Py_INCREF(odbcError);441 if (unsuccessful(SQLAllocStmt(conn->hdbc, &cur->hstmt)))442 {443 connectionError(cur->my_conx, _T("OPEN"));444 Py_DECREF(cur);445 return NULL;446 }447 cur->my_conx = conn;448 cur->connect_id = cur->my_conx->connect_id;449 Py_INCREF(self); /* the cursors owns a reference to the connection */450 return (PyObject*) cur;451 }452 453 /* @pymethod |connection|close|Closes the connection. */454 static PyObject *odbcClose(PyObject *self, PyObject *args)455 {456 Py_INCREF(Py_None);457 return Py_None;458 }459 460 /* @object connection|An object representing an ODBC connection */461 static struct PyMethodDef connectionMethods[] = {462 { "setautocommit", odbcSetAutoCommit, 1 }, /* @pymeth setautocommit|Sets the autocommit mode. */463 { "commit", odbcCommit, 1 } , /* @pymeth commit|Commits a transaction. */464 { "rollback", odbcRollback, 1 } , /* @pymeth rollback|Rollsback a transaction. */465 { "cursor", odbcCursor, 1 } , /* @pymeth cursor|Creates a <o cursor> object */466 { "close", odbcClose, 1 } , /* @pymeth close|Closes the connection. */467 {0, 0}468 };469 470 static PyMemberDef connectionMembers[] = {471 {"error", T_OBJECT, offsetof(connectionObject, connectionError), READONLY},472 {NULL}473 };474 475 255 static void connectionDealloc(PyObject *self) 476 256 { 477 257 Py_XDECREF(connection(self)->connectionError); … … static int display_size(short coltype, int collen, const TCHAR *colname) 1192 972 case SQL_DATE: 1193 973 case SQL_TIMESTAMP: 1194 974 case SQL_BIT: 975 #if defined(__MINGW32__) 976 return(std::max(collen, (int)_tcslen(colname))); 977 #else 1195 978 return(max(collen, (int)_tcslen(colname))); 979 #endif 1196 980 case SQL_SMALLINT: 1197 981 case SQL_INTEGER: 1198 982 case SQL_TINYINT: 983 #if defined(__MINGW32__) 984 return(std::max(collen+1, (int)_tcslen(colname))); 985 #else 1199 986 return(max(collen+1, (int)_tcslen(colname))); 987 #endif 1200 988 case SQL_DECIMAL: 1201 989 case SQL_NUMERIC: 990 #if defined(__MINGW32__) 991 return(std::max(collen+2, (int)_tcslen(colname))); 992 #else 1202 993 return(max(collen+2, (int)_tcslen(colname))); 994 #endif 1203 995 case SQL_REAL: 1204 996 case SQL_FLOAT: 1205 997 case SQL_DOUBLE: 998 #if defined(__MINGW32__) 999 return(std::max(20, (int)_tcslen(colname))); 1000 #else 1206 1001 return(max(20, (int)_tcslen(colname))); 1002 #endif 1207 1003 case SQL_BINARY: 1208 1004 case SQL_VARBINARY: 1005 #if defined(__MINGW32__) 1006 return(std::max(2*collen, (int)_tcslen(colname))); 1007 #else 1209 1008 return(max(2*collen, (int)_tcslen(colname))); 1009 #endif 1210 1010 case SQL_LONGVARBINARY: 1211 1011 case SQL_LONGVARCHAR: 1212 1012 default: … … static PyMemberDef cursorMembers[] = { 1814 1614 {NULL} 1815 1615 }; 1816 1616 1617 static PyTypeObject Cursor_Type = 1618 { 1619 PYWIN_OBJECT_HEAD 1620 "odbccur", /*tp_name */ 1621 sizeof(cursorObject), /*tp_basicsize */ 1622 0, /*tp_itemsize */ 1623 cursorDealloc, /*tp_dealloc */ 1624 0, /*tp_print */ 1625 0, /*tp_getattr */ 1626 0, /*tp_setattr */ 1627 0, /*tp_compare */ 1628 0, /*tp_repr */ 1629 0, /*tp_as_number */ 1630 0, /* tp_as_sequence */ 1631 0, /* tp_as_mapping */ 1632 0, /* tp_hash */ 1633 0, /* tp_call */ 1634 0, /*tp_str */ 1635 PyObject_GenericGetAttr, /* tp_getattro dbiGetAttr */ 1636 PyObject_GenericSetAttr, /* tp_setattro */ 1637 0, /*tp_as_buffer*/ 1638 Py_TPFLAGS_DEFAULT, /* tp_flags */ 1639 0, /* tp_doc */ 1640 0, /* tp_traverse */ 1641 0, /* tp_clear */ 1642 0, /* tp_richcompare */ 1643 0, /* tp_weaklistoffset */ 1644 0, /* tp_iter */ 1645 0, /* tp_iternext */ 1646 cursorMethods, /* tp_methods */ 1647 cursorMembers, /* tp_members */ 1648 0, /* tp_getset */ 1649 0, /* tp_base */ 1650 0, /* tp_dict */ 1651 0, /* tp_descr_get */ 1652 0, /* tp_descr_set */ 1653 0, /* tp_dictoffset */ 1654 0, /* tp_init */ 1655 0, /* tp_alloc */ 1656 0, /* tp_new */ 1657 }; 1658 /* @pymethod |connection|setautocommit|Sets the autocommit mode. */ 1659 static PyObject *odbcSetAutoCommit(PyObject *self, PyObject *args) 1660 { 1661 int c; 1662 connectionObject *conn; 1663 /* @pyparm int|c||The boolean autocommit mode. */ 1664 if (!PyArg_ParseTuple(args, "i",&c)) 1665 return NULL; 1666 conn=connection(self); 1667 if (c==0) 1668 { 1669 if (unsuccessful(SQLSetConnectOption( 1670 conn->hdbc, 1671 SQL_AUTOCOMMIT, 1672 SQL_AUTOCOMMIT_OFF))) 1673 { 1674 connectionError(conn, _T("SETAUTOCOMMIT")); 1675 return NULL; 1676 } 1677 } 1678 else 1679 { 1680 if (unsuccessful(SQLSetConnectOption( 1681 conn->hdbc, 1682 SQL_AUTOCOMMIT, 1683 SQL_AUTOCOMMIT_ON))) 1684 { 1685 connectionError(conn, _T("SETAUTOCOMMIT")); 1686 return NULL; 1687 }; 1688 } 1689 1690 Py_INCREF(Py_None); 1691 return Py_None; 1692 } 1693 1694 1695 /* @pymethod |connection|commit|Commits a transaction. */ 1696 static PyObject *odbcCommit(PyObject *self, PyObject *args) 1697 { 1698 RETCODE rc; 1699 Py_BEGIN_ALLOW_THREADS 1700 rc = SQLTransact( 1701 Env, 1702 connection(self)->hdbc, 1703 SQL_COMMIT); 1704 Py_END_ALLOW_THREADS 1705 if (unsuccessful(rc)) 1706 { 1707 connectionError(connection(self), _T("COMMIT")); 1708 return 0; 1709 } 1710 else 1711 { 1712 Py_INCREF(Py_None); 1713 return Py_None; 1714 } 1715 } 1716 1717 /* @pymethod |connection|rollback|Rollsback a transaction. */ 1718 static PyObject *odbcRollback(PyObject *self, PyObject *args) 1719 { 1720 RETCODE rc; 1721 Py_BEGIN_ALLOW_THREADS 1722 rc = SQLTransact( 1723 Env, 1724 connection(self)->hdbc, 1725 SQL_ROLLBACK); 1726 Py_END_ALLOW_THREADS 1727 if (unsuccessful(rc)) 1728 { 1729 connectionError(connection(self), _T("ROLLBACK")); 1730 return 0; 1731 } 1732 else { 1733 Py_INCREF(Py_None); 1734 return Py_None; 1735 } 1736 } 1737 1738 /* @pymethod |connection|cursor|Creates a <o cursor> object */ 1739 static PyObject *odbcCursor(PyObject *self, PyObject *args) 1740 { 1741 connectionObject *conn = connection(self); 1742 if (conn->connected == 0) 1743 { 1744 if (doConnect(conn)) 1745 { 1746 return 0; 1747 } 1748 } 1749 1750 cursorObject *cur = PyObject_New(cursorObject, &Cursor_Type); 1751 if (cur == NULL) 1752 return NULL; 1753 1754 cur->outputVars = 0; 1755 cur->inputVars = 0; 1756 cur->description = 0; 1757 cur->max_width = 65536L; 1758 cur->my_conx = 0; 1759 cur->hstmt=NULL; 1760 cur->cursorError=odbcError; 1761 Py_INCREF(odbcError); 1762 if (unsuccessful(SQLAllocStmt(conn->hdbc, &cur->hstmt))) 1763 { 1764 connectionError(cur->my_conx, _T("OPEN")); 1765 Py_DECREF(cur); 1766 return NULL; 1767 } 1768 cur->my_conx = conn; 1769 cur->connect_id = cur->my_conx->connect_id; 1770 Py_INCREF(self); /* the cursors owns a reference to the connection */ 1771 return (PyObject*) cur; 1772 } 1773 1774 /* @pymethod |connection|close|Closes the connection. */ 1775 static PyObject *odbcClose(PyObject *self, PyObject *args) 1776 { 1777 Py_INCREF(Py_None); 1778 return Py_None; 1779 } 1780 1781 /* @object connection|An object representing an ODBC connection */ 1782 static struct PyMethodDef connectionMethods[6] = { 1783 { "setautocommit", odbcSetAutoCommit, 1 }, /* @pymeth setautocommit|Sets the autocommit mode. */ 1784 { "commit", odbcCommit, 1 } , /* @pymeth commit|Commits a transaction. */ 1785 { "rollback", odbcRollback, 1 } , /* @pymeth rollback|Rollsback a transaction. */ 1786 { "cursor", odbcCursor, 1 } , /* @pymeth cursor|Creates a <o cursor> object */ 1787 { "close", odbcClose, 1 } , /* @pymeth close|Closes the connection. */ 1788 {0, 0} 1789 }; 1790 1791 static PyMemberDef connectionMembers[2] = { 1792 {"error", T_OBJECT, offsetof(connectionObject, connectionError), READONLY}, 1793 {NULL} 1794 }; 1795 1796 static PyTypeObject Connection_Type = 1797 { 1798 PYWIN_OBJECT_HEAD 1799 "odbcconn", /*tp_name */ 1800 sizeof (connectionObject), /*tp_basicsize */ 1801 0, /*tp_itemsize */ 1802 connectionDealloc, /*tp_dealloc */ 1803 0, /*tp_print */ 1804 0, /*tp_getattr */ 1805 0, /*tp_setattr */ 1806 0, /*tp_compare */ 1807 0, /*tp_repr */ 1808 0, /*tp_as_number */ 1809 0, /* tp_as_sequence */ 1810 0, /* tp_as_mapping */ 1811 0, /* tp_hash */ 1812 0, /* tp_call */ 1813 0, /*tp_str */ 1814 PyObject_GenericGetAttr, /* tp_getattro dbiGetAttr */ 1815 PyObject_GenericSetAttr, /* tp_setattro */ 1816 0, /*tp_as_buffer*/ 1817 Py_TPFLAGS_DEFAULT, /* tp_flags */ 1818 0, /* tp_doc */ 1819 0, /* tp_traverse */ 1820 0, /* tp_clear */ 1821 0, /* tp_richcompare */ 1822 0, /* tp_weaklistoffset */ 1823 0, /* tp_iter */ 1824 0, /* tp_iternext */ 1825 connectionMethods, /* tp_methods */ 1826 connectionMembers, /* tp_members */ 1827 0, /* tp_getset */ 1828 0, /* tp_base */ 1829 0, /* tp_dict */ 1830 0, /* tp_descr_get */ 1831 0, /* tp_descr_set */ 1832 0, /* tp_dictoffset */ 1833 0, /* tp_init */ 1834 0, /* tp_alloc */ 1835 0, /* tp_new */ 1836 }; 1817 1837 static void parseInfo(connectionObject *conn, const TCHAR *c) 1818 1838 { 1819 1839 TCHAR *p; -
win32/src/win32apimodule.cpp
diff --git a/win32/src/win32apimodule.cpp b/win32/src/win32apimodule.cpp index f7e36b1..dd5223f 100644
a b PyFormatMessageA(PyObject *self, PyObject *args) 817 817 818 818 { 819 819 PyW32_BEGIN_ALLOW_THREADS 820 #if !defined(__MINGW32__) 820 821 __try{ 822 #endif 821 823 lrc = ::FormatMessageA(flags, pSource, msgId, langId, (LPSTR)&resultBuf, 0, (va_list *)pInserts ); 824 #if !defined(__MINGW32__) 822 825 } 823 826 __except (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH){ 824 827 baccessviolation=TRUE; 825 828 } 829 #endif 826 830 PyW32_END_ALLOW_THREADS 827 831 } 828 832 … … PyFormatMessageW(PyObject *self, PyObject *args) 927 931 928 932 { 929 933 PyW32_BEGIN_ALLOW_THREADS 934 #if !defined(__MINGW32__) 930 935 __try{ 936 #endif 931 937 lrc = ::FormatMessageW(flags, pSource, msgId, langId, (LPWSTR)&resultBuf, 0, (va_list *)pInserts ); 938 #if !defined(__MINGW32__) 932 939 } 933 940 __except (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH){ 934 941 baccessviolation=TRUE; 935 942 } 943 #endif 936 944 PyW32_END_ALLOW_THREADS 937 945 } 938 946 … … static PyObject *PyApply(PyObject *self, PyObject *args) 5774 5782 } 5775 5783 PyThreadState *stateSave = PyThreadState_Swap(NULL); 5776 5784 PyThreadState_Swap(stateSave); 5785 #if !defined(__MINGW32__) 5777 5786 _try { 5787 #endif 5778 5788 ret = PyObject_CallObject(obFunc, obArgs); 5789 #if !defined(__MINGW32__) 5779 5790 } 5780 5791 _except( PyApplyExceptionFilter( GetExceptionCode(), 5781 5792 GetExceptionInformation(), … … static PyObject *PyApply(PyObject *self, PyObject *args) 5804 5815 Py_XDECREF(exc_value); 5805 5816 ret = NULL; 5806 5817 } 5818 #endif 5807 5819 return ret; 5808 5820 // @comm Calls the specified function in a manner similar to 5809 5821 // the built-in function apply(), but allows Win32 exceptions -
win32/src/win32crypt/PyCRYPTPROV.cpp
diff --git a/win32/src/win32crypt/PyCRYPTPROV.cpp b/win32/src/win32crypt/PyCRYPTPROV.cpp index 140ddd3..3de895c 100644
a b 1 1 // @doc 2 2 #include "win32crypt.h" 3 3 4 #if defined(__MINGW32__) 5 #include <algorithm> 6 #endif 7 4 8 // @object PyCRYPTPROV|Handle to a cryptographic provider, created using <om cryptoapi.CryptAcquireContext> 5 9 struct PyMethodDef PyCRYPTPROV::methods[] = { 6 10 // @pymeth CryptReleaseContext|Releases the CSP handle … … PyObject *PyCRYPTPROV::PyCryptGenRandom(PyObject *self, PyObject *args, PyObject 351 355 //initialize buffer with char string if passed if 352 356 ZeroMemory(pbBuffer, dwLen+1); 353 357 if (seeddata != NULL) 358 #if defined(__MINGW32__) 359 memcpy(pbBuffer, seeddata, std::min(dwLen,seedlen)); 360 #else 354 361 memcpy(pbBuffer, seeddata, min(dwLen,seedlen)); 362 #endif 355 363 if (CryptGenRandom(hcryptprov, dwLen, pbBuffer)) 356 364 ret=PyString_FromStringAndSize((char *)pbBuffer, dwLen); 357 365 else -
win32/src/win32crypt/win32cryptmodule.cpp
diff --git a/win32/src/win32crypt/win32cryptmodule.cpp b/win32/src/win32crypt/win32cryptmodule.cpp index 29b2c80..5875294 100644
a b static PyObject *PyCertOpenStore(PyObject *self, PyObject *args, PyObject *kwarg 597 597 } 598 598 else{ 599 599 switch((ULONG_PTR)StoreProvider){ 600 #if defined(__MINGW32__) 601 case (ULONG_PTR)14: 602 case (ULONG_PTR)8: 603 case (ULONG_PTR)10: 604 case (ULONG_PTR)13: 605 case (ULONG_PTR)16:{ 606 #else 600 607 case CERT_STORE_PROV_PHYSICAL: 601 608 case CERT_STORE_PROV_FILENAME: 602 609 case CERT_STORE_PROV_SYSTEM: 603 610 case CERT_STORE_PROV_SYSTEM_REGISTRY: 604 611 case CERT_STORE_PROV_LDAP:{ 612 #endif 605 613 if (!PyWinObject_AsWCHAR(obpvPara, (WCHAR **)&pvPara)) 606 614 return NULL; 607 615 free_wchar=TRUE; 608 616 break; 609 617 } 618 #if defined(__MINGW32__) 619 case (ULONG_PTR)4:{ 620 #else 610 621 case CERT_STORE_PROV_REG:{ 622 #endif 611 623 if (!PyWinObject_AsHKEY(obpvPara, (HKEY *)&pvPara)) 612 624 return NULL; 613 625 break; 614 626 } 627 #if defined(__MINGW32__) 628 case (ULONG_PTR)3:{ 629 #else 615 630 case CERT_STORE_PROV_FILE:{ 631 #endif 616 632 if (!PyWinObject_AsHANDLE(obpvPara, (HANDLE *)&pvPara)) 617 633 return NULL; 618 634 break; 619 635 } 636 #if defined(__MINGW32__) 637 case (ULONG_PTR)6: 638 case (ULONG_PTR)5:{ 639 #else 620 640 case CERT_STORE_PROV_SERIALIZED: 621 641 case CERT_STORE_PROV_PKCS7:{ 642 #endif 622 643 if (!PyWinObject_AsReadBuffer(obpvPara, (void **)&crypt_data_blob.pbData, &crypt_data_blob.cbData)) 623 644 return NULL; 624 645 pvPara=(void *)&crypt_data_blob; 625 646 break; 626 647 } 648 #if defined(__MINGW32__) 649 case (ULONG_PTR)2:{ 650 #else 627 651 case CERT_STORE_PROV_MEMORY:{ 652 #endif 628 653 // pvPara is not used, warn if something passed in 629 654 if (obpvPara != Py_None) 630 655 PyErr_Warn(PyExc_RuntimeWarning, "Para ignored for CERT_STORE_PROV_MEMORY"); -
win32/src/win32evtlog.i
diff --git a/win32/src/win32evtlog.i b/win32/src/win32evtlog.i index 847230c..142923b 100644
a b PyCFunction pfnPyEvtUpdateBookmark = (PyCFunction) PyEvtUpdateBookmark; 1012 1012 1013 1013 PyObject *PyWinObject_FromEVT_VARIANT(PEVT_VARIANT val) 1014 1014 { 1015 #if defined(__MINGW32__) 1016 DWORD val_type = val->Type; 1017 #else 1015 1018 if (val->Type & EVT_VARIANT_TYPE_ARRAY){ 1016 1019 PyErr_SetString(PyExc_NotImplementedError, "EVT_VARIANT arrays not supported yet"); 1017 1020 return NULL; 1018 1021 } 1019 1022 DWORD val_type = val->Type & EVT_VARIANT_TYPE_MASK; 1023 #endif 1020 1024 PyObject *obval = NULL; 1021 1025 switch (val_type){ 1022 1026 case EvtVarTypeNull: -
win32/src/win32file.i
diff --git a/win32/src/win32file.i b/win32/src/win32file.i index 2b82d37..39e7cd1 100644
a b static PyObject *PyObject_FromFILE_NOTIFY_INFORMATION(void *buffer, DWORD nbytes 1420 1420 // the filename is exactly 1 byte! Not clear the best way to 1421 1421 // check this, but this works for now - is it at least the size of 1422 1422 // the *head* of the struct. 1423 #if defined(__MINGW32__) 1424 if (nbytes < sizeof(DWORD)*3+2) 1425 #else 1423 1426 if (nbytes < sizeof DWORD*3+2) 1427 #endif 1424 1428 return ret; 1425 1429 DWORD nbytes_read = 0; 1426 1430 while (1) { 1431 #if defined(__MINGW32__) 1432 PyObject *fname = PyWinObject_FromOLECHAR(p->FileName, p->FileNameLength/sizeof(WCHAR)); 1433 #else 1427 1434 PyObject *fname = PyWinObject_FromOLECHAR(p->FileName, p->FileNameLength/sizeof WCHAR); 1435 #endif 1428 1436 if (!fname) { 1429 1437 Py_DECREF(ret); 1430 1438 return NULL; -
win32/src/win32file_comm.cpp
diff --git a/win32/src/win32file_comm.cpp b/win32/src/win32file_comm.cpp index 19f2eb7..d16fb76 100644
a b PyDCB::~PyDCB(void) 173 173 { 174 174 } 175 175 176 #if defined(__MINGW32__) 177 #define GET_BITFIELD_ENTRY(bitfield_name) \ 178 else if (strcmp(name, #bitfield_name)==0) { \ 179 return PyInt_FromLong(pydcb->m_DCB. bitfield_name); \ 180 } \ 181 182 #else 176 183 #define GET_BITFIELD_ENTRY(bitfield_name) \ 177 184 else if (strcmp(name, #bitfield_name)==0) { \ 178 185 return PyInt_FromLong(pydcb->m_DCB.##bitfield_name); \ 179 186 } \ 180 187 188 #endif 181 189 PyObject *PyDCB::getattro(PyObject *self, PyObject *obname) 182 190 { 183 191 PyDCB *pydcb = (PyDCB *)self; … … PyObject *PyDCB::getattro(PyObject *self, PyObject *obname) 204 212 return PyObject_GenericGetAttr(self, obname); 205 213 } 206 214 215 #if defined(__MINGW32__) 207 216 #define SET_BITFIELD_ENTRY(bitfield_name) \ 217 else if (strcmp(name, #bitfield_name)==0) { \ 218 if (!PyInt_Check(v)) { \ 219 PyErr_Format(PyExc_TypeError, szNeedIntAttr, #bitfield_name); \ 220 return -1; \ 221 } \ 222 pydcb->m_DCB. bitfield_name = PyInt_AsLong(v); \ 223 return 0; \ 224 } \ 225 226 #else 227 #define SET_BITFIELD_ENTRY(bitfield_name) \ 208 228 else if (strcmp(name, #bitfield_name)==0) { \ 209 229 if (!PyInt_Check(v)) { \ 210 230 PyErr_Format(PyExc_TypeError, szNeedIntAttr, #bitfield_name); \ … … PyObject *PyDCB::getattro(PyObject *self, PyObject *obname) 214 234 return 0; \ 215 235 } \ 216 236 237 #endif 217 238 int PyDCB::setattro(PyObject *self, PyObject *obname, PyObject *v) 218 239 { 219 240 PyDCB *pydcb = (PyDCB *)self; … … PyCOMSTAT::~PyCOMSTAT(void) 367 388 } 368 389 369 390 #undef GET_BITFIELD_ENTRY 391 #if defined(__MINGW32__) 392 #define GET_BITFIELD_ENTRY(bitfield_name) \ 393 else if (strcmp(name, #bitfield_name)==0) { \ 394 return PyInt_FromLong(pyCOMSTAT->m_COMSTAT. bitfield_name); \ 395 } \ 396 397 #else 370 398 #define GET_BITFIELD_ENTRY(bitfield_name) \ 371 399 else if (strcmp(name, #bitfield_name)==0) { \ 372 400 return PyInt_FromLong(pyCOMSTAT->m_COMSTAT.##bitfield_name); \ 373 401 } \ 374 402 403 #endif 375 404 PyObject *PyCOMSTAT::getattro(PyObject *self, PyObject *obname) 376 405 { 377 406 PyCOMSTAT *pyCOMSTAT = (PyCOMSTAT *)self; … … PyObject *PyCOMSTAT::getattro(PyObject *self, PyObject *obname) 392 421 } 393 422 394 423 #undef SET_BITFIELD_ENTRY 424 #if defined(__MINGW32__) 425 #define SET_BITFIELD_ENTRY(bitfield_name) \ 426 else if (strcmp(name, #bitfield_name)==0) { \ 427 if (!PyInt_Check(v)) { \ 428 PyErr_Format(PyExc_TypeError, szNeedIntAttr, #bitfield_name); \ 429 return -1; \ 430 } \ 431 pyCOMSTAT->m_COMSTAT. bitfield_name = PyInt_AsLong(v); \ 432 return 0; \ 433 } \ 434 435 #else 395 436 #define SET_BITFIELD_ENTRY(bitfield_name) \ 396 437 else if (strcmp(name, #bitfield_name)==0) { \ 397 438 if (!PyInt_Check(v)) { \ … … PyObject *PyCOMSTAT::getattro(PyObject *self, PyObject *obname) 402 443 return 0; \ 403 444 } \ 404 445 446 #endif 405 447 int PyCOMSTAT::setattro(PyObject *self, PyObject *obname, PyObject *v) 406 448 { 407 449 PyCOMSTAT *pyCOMSTAT = (PyCOMSTAT *)self; -
win32/src/win32gui.i
diff --git a/win32/src/win32gui.i b/win32/src/win32gui.i index 94b738f..bc5e494 100644
a b 34 34 #include "Dbt.h" // device notification 35 35 #include "malloc.h" 36 36 37 #if defined(__MINGW32__) 38 #include <algorithm> 39 #endif 37 40 #ifdef MS_WINCE 38 41 #include "winbase.h" 39 42 #define IS_INTRESOURCE(res) (((DWORD)(res) & 0xffff0000) == 0) … … typedef int UINT; 640 643 // @object TRACKMOUSEEVENT|A tuple of (dwFlags, hwndTrack, dwHoverTime) 641 644 %typemap(python,in) TRACKMOUSEEVENT *INPUT(TRACKMOUSEEVENT e){ 642 645 PyObject *obhwnd; 646 #if defined(__MINGW32__) 647 e.cbSize = sizeof(e); 648 #else 643 649 e.cbSize = sizeof e; 650 #endif 644 651 if (PyTuple_Check($source)) { 645 652 if (PyArg_ParseTuple($source, "lOl", &e.dwFlags, &obhwnd, &e.dwHoverTime) == 0) { 646 653 return PyErr_Format(PyExc_TypeError, "%s: a TRACKMOUSEEVENT must be a tuple of 3 integers", "$name"); … … PyObject *PyFlashWindowEx(PyObject *self, PyObject *args) 1822 1829 PyObject *ret, *obhwnd; 1823 1830 BOOL rc; 1824 1831 FLASHWINFO f; 1832 #if defined(__MINGW32__) 1833 f.cbSize = sizeof(f); 1834 #else 1825 1835 f.cbSize = sizeof f; 1836 #endif 1826 1837 // @pyparm <o PyHANDLE>|hwnd||Handle to a window 1827 1838 // @pyparm int|dwFlags||Combination of win32con.FLASHW_* flags 1828 1839 // @pyparm int|uCount||Nbr of times to flash … … static PyObject *PyExtractIconEx(PyObject *self, PyObject *args) 3802 3813 nicons_got = 1; 3803 3814 #endif 3804 3815 // Asking for 1 always says it got 2!? 3816 #if defined(__MINGW32__) 3817 nicons = std::min(nicons, nicons_got); 3818 #else 3805 3819 nicons = min(nicons, nicons_got); 3820 #endif 3806 3821 objects_large = PyList_New(nicons); 3807 3822 if (!objects_large) goto done; 3808 3823 objects_small = PyList_New(nicons); … … BOOL GetOpenFileName(OPENFILENAME *INPUT); 4596 4611 %typemap (python, in) MENUITEMINFO *INPUT (Py_ssize_t target_size){ 4597 4612 if (0 != PyObject_AsReadBuffer($source, (const void **)&$target, &target_size)) 4598 4613 return NULL; 4614 #if defined(__MINGW32__) 4615 if (sizeof(MENUITEMINFO) != target_size) 4616 return PyErr_Format(PyExc_TypeError, "Argument must be a %d-byte string/buffer (got %d bytes)", sizeof(MENUITEMINFO), target_size); 4617 #else 4599 4618 if (sizeof MENUITEMINFO != target_size) 4600 4619 return PyErr_Format(PyExc_TypeError, "Argument must be a %d-byte string/buffer (got %d bytes)", sizeof MENUITEMINFO, target_size); 4620 #endif 4601 4621 } 4602 4622 4603 4623 %typemap (python,in) MENUITEMINFO *BOTH(Py_ssize_t target_size) { 4604 4624 if (0 != PyObject_AsWriteBuffer($source, (void **)&$target, &target_size)) 4605 4625 return NULL; 4626 #if defined(__MINGW32__) 4627 if (sizeof(MENUITEMINFO) != target_size) 4628 return PyErr_Format(PyExc_TypeError, "Argument must be a %d-byte buffer (got %d bytes)", sizeof(MENUITEMINFO), target_size); 4629 #else 4606 4630 if (sizeof MENUITEMINFO != target_size) 4607 4631 return PyErr_Format(PyExc_TypeError, "Argument must be a %d-byte buffer (got %d bytes)", sizeof MENUITEMINFO, target_size); 4632 #endif 4608 4633 } 4609 4634 4610 4635 %typemap (python, in) MENUINFO *INPUT (Py_ssize_t target_size){ 4611 4636 if (0 != PyObject_AsReadBuffer($source, (const void **)&$target, &target_size)) 4612 4637 return NULL; 4638 #if defined(__MINGW32__) 4639 if (sizeof(MENUINFO) != target_size) 4640 return PyErr_Format(PyExc_TypeError, "Argument must be a %d-byte string/buffer (got %d bytes)", sizeof(MENUINFO), target_size); 4641 #else 4613 4642 if (sizeof MENUINFO != target_size) 4614 4643 return PyErr_Format(PyExc_TypeError, "Argument must be a %d-byte string/buffer (got %d bytes)", sizeof MENUINFO, target_size); 4644 #endif 4615 4645 } 4616 4646 4617 4647 %typemap (python,in) MENUINFO *BOTH(Py_ssize_t target_size) { 4618 4648 if (0 != PyObject_AsWriteBuffer($source, (void **)&$target, &target_size)) 4619 4649 return NULL; 4650 #if defined(__MINGW32__) 4651 if (sizeof(MENUINFO) != target_size) 4652 return PyErr_Format(PyExc_TypeError, "Argument must be a %d-byte buffer (got %d bytes)", sizeof(MENUINFO), target_size); 4653 #else 4620 4654 if (sizeof MENUINFO != target_size) 4621 4655 return PyErr_Format(PyExc_TypeError, "Argument must be a %d-byte buffer (got %d bytes)", sizeof MENUINFO, target_size); 4656 #endif 4622 4657 } 4623 4658 4624 4659 // @pyswig |InsertMenuItem|Inserts a menu item … … PyObject *PySetMenuInfo(PyObject *self, PyObject *args) 4750 4785 4751 4786 if (0 != PyObject_AsReadBuffer(obInfo, (const void **)&pInfo, &cbInfo)) 4752 4787 return NULL; 4788 #if defined(__MINGW32__) 4789 if (sizeof(MENUINFO) != cbInfo) 4790 return PyErr_Format(PyExc_TypeError, "Argument must be a %d byte string/buffer (got %d bytes)", sizeof(MENUINFO), cbInfo); 4791 #else 4753 4792 if (sizeof MENUINFO != cbInfo) 4754 4793 return PyErr_Format(PyExc_TypeError, "Argument must be a %d byte string/buffer (got %d bytes)", sizeof MENUINFO, cbInfo); 4794 #endif 4755 4795 4756 4796 Py_BEGIN_ALLOW_THREADS 4757 4797 result = (*pfnSetMenuInfo)(hmenu, pInfo); … … PyObject *PyGetMenuInfo(PyObject *self, PyObject *args) 4787 4827 4788 4828 if (0 != PyObject_AsWriteBuffer(obInfo, (void **)&pInfo, &cbInfo)) 4789 4829 return NULL; 4830 #if defined(__MINGW32__) 4831 if (sizeof(MENUINFO) != cbInfo) 4832 return PyErr_Format(PyExc_TypeError, "Argument must be a %d byte buffer (got %d bytes)", sizeof(MENUINFO), cbInfo); 4833 #else 4790 4834 if (sizeof MENUINFO != cbInfo) 4791 4835 return PyErr_Format(PyExc_TypeError, "Argument must be a %d byte buffer (got %d bytes)", sizeof MENUINFO, cbInfo); 4836 #endif 4792 4837 4793 4838 Py_BEGIN_ALLOW_THREADS 4794 4839 result = (*pfnGetMenuInfo)(hmenu, pInfo); … … PyGetClassName(PyObject *self, PyObject *args) 6005 6050 if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&hwnd)) 6006 6051 return NULL; 6007 6052 // dont bother with lock - no callback possible. 6053 #if defined(__MINGW32__) 6054 int nchars = GetClassName(hwnd, buf, sizeof(buf)/sizeof(buf[0])); 6055 #else 6008 6056 int nchars = GetClassName(hwnd, buf, sizeof buf/sizeof buf[0]); 6057 #endif 6009 6058 if (nchars==0) 6010 6059 return PyWin_SetAPIError("GetClassName"); 6011 6060 return PyWinObject_FromTCHAR(buf, nchars); … … BOOL PyParse_OPENFILENAMEW_Args(PyObject *args, PyObject *kwargs, OPENFILENAMEW 6370 6419 // lpstrFile buffer receives full path and possibly multiple file names, allocate extra space 6371 6420 if (!PyWinObject_AsWCHAR(obFile, &initfile, TRUE, &initfilechars)) 6372 6421 goto done; 6422 #if defined(__MINGW32__) 6423 pofn->nMaxFile=std::max(pofn->nMaxFile, initfilechars+1); 6424 #else 6373 6425 pofn->nMaxFile=max(pofn->nMaxFile, initfilechars+1); 6426 #endif 6374 6427 bufsize=pofn->nMaxFile*sizeof(WCHAR); 6375 6428 pofn->lpstrFile=(LPWSTR)malloc(bufsize); 6376 6429 if (pofn->lpstrFile==NULL){ … … PyObject *PyRegisterDeviceNotification(PyObject *self, PyObject *args) 7506 7559 "structure says it has %d bytes, but %d was provided", 7507 7560 (int)struct_bytes, (int)nbytes); 7508 7561 // @pyseeapi RegisterDeviceNotification 7509 HDEVNOTIFY not ;7562 HDEVNOTIFY notify; 7510 7563 Py_BEGIN_ALLOW_THREADS 7511 not = RegisterDeviceNotification(handle, (void *)filter, flags);7564 notify = RegisterDeviceNotification(handle, (void *)filter, flags); 7512 7565 Py_END_ALLOW_THREADS 7513 if (not == NULL)7566 if (notify == NULL) 7514 7567 return PyWin_SetAPIError("RegisterDeviceNotification"); 7515 return PyWinObject_FromHDEVNOTIFY(not );7568 return PyWinObject_FromHDEVNOTIFY(notify); 7516 7569 } 7517 7570 %} 7518 7571 %native(RegisterDeviceNotification) PyRegisterDeviceNotification; -
win32/src/win32inet.i
diff --git a/win32/src/win32inet.i b/win32/src/win32inet.i index 92d7462..16a8912 100644
a b 15 15 %{ 16 16 #undef PyHANDLE // undef earlier define, so we are back to the class. 17 17 #include "pywinobjects.h" 18 #if defined(__MINGW32__) 19 #include <algorithm> 20 #endif 18 21 19 22 void CALLBACK PyHINTERNET_StatusChange( 20 23 HINTERNET hInternet, … … PyObject *PyInternetQueryOption(PyObject *self, PyObject *args) 953 956 case INTERNET_OPTION_RECEIVE_TIMEOUT: // @flag INTERNET_OPTION_RECEIVE_TIMEOUT|Int - timeout in millseconds 954 957 // @flag INTERNET_OPTION_CONTROL_RECEIVE_TIMEOUT|Int - timeout in millseconds 955 958 case INTERNET_OPTION_CODEPAGE: // @flag INTERNET_OPTION_CODEPAGE|Int - Codepage of host part of URL 959 #if !defined(__MINGW32__) 956 960 case INTERNET_OPTION_CODEPAGE_PATH: // @flag INTERNET_OPTION_CODEPAGE_PATH|Int - Codepage for URL 957 961 case INTERNET_OPTION_CODEPAGE_EXTRA: // @flag INTERNET_OPTION_CODEPAGE_EXTRA|Int - Codepage for path part of URL 962 #endif 958 963 case INTERNET_OPTION_CONNECT_RETRIES: // @flag INTERNET_OPTION_CONNECT_RETRIES|Int - Number of time to try to reconnect to host 959 964 case INTERNET_OPTION_CONNECT_TIMEOUT: // @flag INTERNET_OPTION_CONNECT_TIMEOUT|Int - Connection timeout in milliseconds 960 965 case INTERNET_OPTION_CONNECTED_STATE: // @flag INTERNET_OPTION_CONNECTED_STATE|Int - Connection state, INTERNET_STATE_* … … PyObject *PyInternetQueryOption(PyObject *self, PyObject *args) 962 967 case INTERNET_OPTION_ERROR_MASK: // @flag INTERNET_OPTION_ERROR_MASK|Int, combination of INTERNET_ERROR_MASK_* 963 968 case INTERNET_OPTION_EXTENDED_ERROR: // @flag INTERNET_OPTION_EXTENDED_ERROR|Int, ERROR_INTERNET_* 964 969 case INTERNET_OPTION_FROM_CACHE_TIMEOUT: // @flag INTERNET_OPTION_FROM_CACHE_TIMEOUT|Int - Timeout in ms before cached copy is used 970 #if !defined(__MINGW32__) 965 971 case INTERNET_OPTION_IDN: // @flag INTERNET_OPTION_IDN|Int, INTERNET_FLAG_IDN_* 972 #endif 966 973 case INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER: // @flag INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER|Int 967 974 case INTERNET_OPTION_MAX_CONNS_PER_SERVER: // @flag INTERNET_OPTION_MAX_CONNS_PER_SERVER|Int 968 975 case INTERNET_OPTION_READ_BUFFER_SIZE: // @flag INTERNET_OPTION_READ_BUFFER_SIZE|Int … … PyObject *PyInternetQueryOption(PyObject *self, PyObject *args) 974 981 ret=PyLong_FromUnsignedLong(*(unsigned long *)buf); 975 982 break; 976 983 case INTERNET_OPTION_BYPASS_EDITED_ENTRY: // @flag INTERNET_OPTION_BYPASS_EDITED_ENTRY|Boolean 984 #if !defined(__MINGW32__) 977 985 case INTERNET_OPTION_HTTP_DECODING: // @flag INTERNET_OPTION_HTTP_DECODING|Boolean 986 #endif 978 987 case INTERNET_OPTION_IGNORE_OFFLINE: // @flag INTERNET_OPTION_IGNORE_OFFLINE|Boolean 979 988 ret=PyBool_FromLong(*(BOOL *)buf); 980 989 break; … … PyObject *PyInternetSetOption(PyObject *self, PyObject *args) 1157 1166 case INTERNET_OPTION_RECEIVE_TIMEOUT: // @flag INTERNET_OPTION_RECEIVE_TIMEOUT|Int - timeout in millseconds 1158 1167 // @flag INTERNET_OPTION_CONTROL_RECEIVE_TIMEOUT|Int - timeout in millseconds 1159 1168 case INTERNET_OPTION_CODEPAGE: // @flag INTERNET_OPTION_CODEPAGE|Int - Codepage of host part of URL 1169 #if !defined(__MINGW32__) 1160 1170 case INTERNET_OPTION_CODEPAGE_PATH: // @flag INTERNET_OPTION_CODEPAGE_PATH|Codepage for URL 1161 1171 case INTERNET_OPTION_CODEPAGE_EXTRA: // @flag INTERNET_OPTION_CODEPAGE_EXTRA|Int - Codepage for path part of URL 1172 #endif 1162 1173 case INTERNET_OPTION_CONNECT_RETRIES: // @flag INTERNET_OPTION_CONNECT_RETRIES|Int - Number of time to try to reconnect to host 1163 1174 case INTERNET_OPTION_CONNECT_TIMEOUT: // @flag INTERNET_OPTION_CONNECT_TIMEOUT|Int - Connection timeout in milliseconds 1164 1175 case INTERNET_OPTION_CONNECTED_STATE: // @flag INTERNET_OPTION_CONNECTED_STATE|Int - Connection state, INTERNET_STATE_* 1165 1176 case INTERNET_OPTION_ERROR_MASK: // @flag INTERNET_OPTION_ERROR_MASK|Int, combination of INTERNET_ERROR_MASK_* 1166 1177 case INTERNET_OPTION_FROM_CACHE_TIMEOUT: // @flag INTERNET_OPTION_FROM_CACHE_TIMEOUT|Int - Timeout in ms before cached copy is used 1178 #if !defined(__MINGW32__) 1167 1179 case INTERNET_OPTION_IDN: // @flag INTERNET_OPTION_IDN|Int, INTERNET_FLAG_IDN_* 1180 #endif 1168 1181 case INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER: // @flag INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER|Int 1169 1182 case INTERNET_OPTION_MAX_CONNS_PER_SERVER: // @flag INTERNET_OPTION_MAX_CONNS_PER_SERVER|Int 1170 1183 case INTERNET_OPTION_READ_BUFFER_SIZE: // @flag INTERNET_OPTION_READ_BUFFER_SIZE|Int … … PyObject *PyInternetSetOption(PyObject *self, PyObject *args) 1189 1202 } 1190 1203 break; 1191 1204 case INTERNET_OPTION_BYPASS_EDITED_ENTRY: // @flag INTERNET_OPTION_BYPASS_EDITED_ENTRY|Boolean 1205 #if !defined(__MINGW32__) 1192 1206 case INTERNET_OPTION_HTTP_DECODING: // @flag INTERNET_OPTION_HTTP_DECODING|Boolean 1207 #endif 1193 1208 case INTERNET_OPTION_IGNORE_OFFLINE: // @flag INTERNET_OPTION_IGNORE_OFFLINE|Boolean 1194 1209 bufsize=sizeof(BOOL); 1195 1210 buf=malloc(bufsize); … … BOOL PyWinObject_AsINTERNET_CACHE_GROUP_INFO(PyObject *ob, INTERNET_CACHE_GROUP_ 1835 1850 } 1836 1851 } 1837 1852 if (bsuccess && GroupName) 1853 #if defined(__MINGW32__) 1854 _tcsncpy(GroupInfo->szGroupName, GroupName, std::min(namelen, (DWORD)GROUPNAME_MAX_LENGTH)); 1855 #else 1838 1856 _tcsncpy(GroupInfo->szGroupName, GroupName, min(namelen, GROUPNAME_MAX_LENGTH)); 1857 #endif 1839 1858 Py_DECREF(dummy_tuple); 1840 1859 PyWinObject_FreeTCHAR(GroupName); 1841 1860 if (OwnerStorage) -
win32/src/win32net/win32net.h
diff --git a/win32/src/win32net/win32net.h b/win32/src/win32net/win32net.h index ae7c690..c961c18 100644
a b PyObject *PyDoGroupDelMembers(PyObject *self, PyObject *args); 62 62 63 63 #if WINVER >= 0x0500 64 64 typedef NET_API_STATUS (NET_API_FUNCTION *NetValidateNamefunc)(LPCWSTR, LPCWSTR, LPCWSTR, LPCWSTR, NETSETUP_NAME_TYPE); 65 extern NetValidateNamefunc pfnNetValidateName; 65 extern 66 #if defined(__MINGW32__) 67 "C" 68 #endif 69 NetValidateNamefunc pfnNetValidateName; 66 70 67 71 typedef NET_API_STATUS (NET_API_FUNCTION *NetGetJoinInformationfunc)(LPCWSTR, LPWSTR *, PNETSETUP_JOIN_STATUS); 68 72 extern NetGetJoinInformationfunc pfnNetGetJoinInformation; 69 73 70 74 typedef NET_API_STATUS (NET_API_FUNCTION *NetValidatePasswordPolicyfunc)(LPCWSTR, LPVOID, NET_VALIDATE_PASSWORD_TYPE, LPVOID, LPVOID *); 71 extern NetValidatePasswordPolicyfunc pfnNetValidatePasswordPolicy; 75 extern 76 #if defined(__MINGW32__) 77 "C" 78 #endif 79 NetValidatePasswordPolicyfunc pfnNetValidatePasswordPolicy; 72 80 73 81 typedef NET_API_STATUS (NET_API_FUNCTION *NetValidatePasswordPolicyFreefunc)(LPVOID *); 74 extern NetValidatePasswordPolicyFreefunc pfnNetValidatePasswordPolicyFree; 82 extern 83 #if defined(__MINGW32__) 84 "C" 85 #endif 86 NetValidatePasswordPolicyFreefunc pfnNetValidatePasswordPolicyFree; 75 87 76 88 #endif // WINVER -
win32/src/win32pdhmodule.cpp
diff --git a/win32/src/win32pdhmodule.cpp b/win32/src/win32pdhmodule.cpp index 94c4ed1..533dad7 100644
a b generates Windows .hlp files. 15 15 #include "pdh.h" 16 16 #include "pdhmsg.h" 17 17 18 #if defined(__MINGW32__) 19 #include <algorithm> 20 #endif 21 18 22 /* 19 23 According to MSDN, Pdh calls are thread safe, although there was a bug 20 24 in Win2k that might make it appear to not be. Plus, the PyW32* macros … … PDH_STATUS __stdcall PyCounterPathCallback(DWORD_PTR dwArg) 1013 1017 return rc; 1014 1018 } 1015 1019 1020 #if defined(__MINGW32__) 1021 #define SET_BOOL(r, i) { \ 1022 if (i<seqLen){ \ 1023 PyObject *subItem = PyTuple_GET_ITEM(flags_tuple, i); \ 1024 myCfg.cfg. r = PyObject_IsTrue(subItem); \ 1025 } \ 1026 } 1027 #else 1016 1028 #define SET_BOOL(r, i) { \ 1017 1029 if (i<seqLen){ \ 1018 1030 PyObject *subItem = PyTuple_GET_ITEM(flags_tuple, i); \ 1019 1031 myCfg.cfg.##r = PyObject_IsTrue(subItem); \ 1020 1032 } \ 1021 1033 } 1034 #endif 1022 1035 1023 1036 // @pymethod string|win32pdh|BrowseCounters|Displays the counter browsing dialog box so that the user can select the counters to be returned to the caller. 1024 1037 static PyObject *PyBrowseCounters(PyObject *self, PyObject *args, PyObject *kwargs) … … static PyObject *PyBrowseCounters(PyObject *self, PyObject *args, PyObject *kwar 1082 1095 // Initialize the return buffer if starting path is passed in. (bInitializePath will also be set) 1083 1096 if (!PyWinObject_AsTCHAR(obInitialPath, &InitialPath, TRUE, &cchInitialPath)) 1084 1097 return NULL; // Last exit without cleanup 1098 #if defined(__MINGW32__) 1099 myCfg.cfg.cchReturnPathLength = std::max(cchInitialPath+1, 1024UL); 1100 #else 1085 1101 myCfg.cfg.cchReturnPathLength = max(cchInitialPath+1, 1024); 1102 #endif 1086 1103 myCfg.cfg.szReturnPathBuffer = (TCHAR *)malloc(myCfg.cfg.cchReturnPathLength * sizeof(TCHAR)); 1087 1104 if (myCfg.cfg.szReturnPathBuffer == NULL){ 1088 1105 PyErr_NoMemory(); -
win32/src/win32service.i
diff --git a/win32/src/win32service.i b/win32/src/win32service.i index 11a4a23..fab8092 100644
a b PyObject *PyQueryServiceConfig2(PyObject *self, PyObject *args) 1818 1818 #define SERVICE_CONTROL_HARDWAREPROFILECHANGE SERVICE_CONTROL_HARDWAREPROFILECHANGE 1819 1819 #define SERVICE_CONTROL_POWEREVENT SERVICE_CONTROL_POWEREVENT 1820 1820 #define SERVICE_CONTROL_SESSIONCHANGE SERVICE_CONTROL_SESSIONCHANGE 1821 #define SERVICE_CONTROL_PRESHUTDOWN SERVICE_CONTROL_PRESHUTDOWN1822 1821 1823 1822 1824 1823 #define SC_MANAGER_ALL_ACCESS SC_MANAGER_ALL_ACCESS … … PyObject *PyQueryServiceConfig2(PyObject *self, PyObject *args) 1875 1874 #define SERVICE_ACCEPT_HARDWAREPROFILECHANGE SERVICE_ACCEPT_HARDWAREPROFILECHANGE 1876 1875 #define SERVICE_ACCEPT_POWEREVENT SERVICE_ACCEPT_POWEREVENT 1877 1876 #define SERVICE_ACCEPT_SESSIONCHANGE SERVICE_ACCEPT_SESSIONCHANGE 1878 #define SERVICE_ACCEPT_PRESHUTDOWN SERVICE_ACCEPT_PRESHUTDOWN1879 1877 1880 1878 //#define SERVICE_ERROR_IGNORER_IGNORE SERVICE_ERROR_IGNORER_IGNORE 1881 1879 #define SERVICE_BOOT_START SERVICE_BOOT_START -
win32/src/win32trace.cpp
diff --git a/win32/src/win32trace.cpp b/win32/src/win32trace.cpp index 2237094..60e7c83 100644
a b See - I told you the implementation was simple :-) 35 35 36 36 37 37 38 #if defined(__MINGW32__) 39 #include <algorithm> 40 #endif 38 41 39 42 const unsigned long BUFFER_SIZE = 0x20000; // Includes size integer. 40 43 const TCHAR *MAP_OBJECT_NAME = _T("Global\\PythonTraceOutputMapping"); … … BOOL PyTraceObject::WriteData(const char *data, unsigned len) 341 344 Py_BEGIN_ALLOW_THREADS 342 345 const char *data_this = data; 343 346 while (len) { 347 #if defined(__MINGW32__) 348 unsigned len_this = std::min(static_cast<unsigned long>(len), BUFFER_SIZE/2); 349 #else 344 350 unsigned len_this = min(len, BUFFER_SIZE/2); 351 #endif 345 352 BOOL ok = GetMyMutex(); 346 353 if (ok) { 347 354 // must use types with identical size on win32 and win64
Note:
See TracBrowser
for help on using the repository browser.