diff --git a/mingw-w64-python-pywin32/001-compile-and-setup-fixes.patch b/mingw-w64-python-pywin32/001-compile-and-setup-fixes.patch index e2a6103f9d..f6747fd146 100644 --- a/mingw-w64-python-pywin32/001-compile-and-setup-fixes.patch +++ b/mingw-w64-python-pywin32/001-compile-and-setup-fixes.patch @@ -1,8 +1,40 @@ diff --git a/setup.py b/setup.py -index 37d536a..3e9d270 100644 +index bfc2a38..09da73e 100644 --- a/setup.py +++ b/setup.py -@@ -124,7 +124,8 @@ class WinExt(Extension): +@@ -36,8 +36,8 @@ import winreg + from collections.abc import MutableSequence + from pathlib import Path + from setuptools import Extension, setup ++from setuptools._distutils import ccompiler + from setuptools.command.build import build +-from setuptools.command.build_ext import build_ext + from setuptools.modified import newer_group + from tempfile import gettempdir + from typing import TYPE_CHECKING, Iterable +@@ -53,6 +53,21 @@ else: + from distutils._msvccompiler import MSVCCompiler + from distutils.command.install_data import install_data + ++ ++def my_new_compiler(**kw): ++ if "compiler" in kw and kw["compiler"] in (None, "msvc"): ++ return my_compiler() ++ return orig_new_compiler(**kw) ++ ++ ++# No way to cleanly wedge our compiler sub-class in. ++orig_new_compiler = ccompiler.new_compiler ++ccompiler.new_compiler = my_new_compiler # type: ignore[assignment] # Assuming the caller will always use only kwargs ++ ++ ++# This import has to be delayed to AFTER the compiler hack ++from setuptools.command.build_ext import build_ext # noqa: E402 ++ + build_id_patch = build_id + if not "." in build_id_patch: + build_id_patch += ".0" +@@ -118,7 +133,8 @@ class WinExt(Extension): extra_link_args = extra_link_args or [] if export_symbol_file: @@ -12,7 +44,7 @@ index 37d536a..3e9d270 100644 # Some of our swigged files behave differently in distutils vs # MSVC based builds. Always define DISTUTILS_BUILD so they can tell. -@@ -162,7 +163,7 @@ class WinExt(Extension): +@@ -163,7 +179,7 @@ class WinExt(Extension): def finalize_options(self, build_ext): # distutils doesn't define this function for an Extension - it is # our own invention, and called just before the extension is built. @@ -21,7 +53,7 @@ index 37d536a..3e9d270 100644 if self.pch_header: self.extra_compile_args = self.extra_compile_args or [] -@@ -218,6 +219,61 @@ class WinExt(Extension): +@@ -219,6 +235,61 @@ class WinExt(Extension): break if found_mfc: break @@ -83,7 +115,7 @@ index 37d536a..3e9d270 100644 self.extra_compile_args.append("-DUNICODE") self.extra_compile_args.append("-D_UNICODE") -@@ -228,6 +284,19 @@ class WinExt_pythonwin(WinExt): +@@ -229,6 +300,19 @@ class WinExt_pythonwin(WinExt): def __init__(self, name, **kw): kw.setdefault("extra_compile_args", []).extend(["-D_AFXDLL", "-D_AFXEXT"]) @@ -103,7 +135,7 @@ index 37d536a..3e9d270 100644 WinExt.__init__(self, name, **kw) def get_pywin32_dir(self): -@@ -238,7 +307,7 @@ class WinExt_pythonwin_subsys_win(WinExt_pythonwin): +@@ -239,7 +323,7 @@ class WinExt_pythonwin_subsys_win(WinExt_pythonwin): def finalize_options(self, build_ext): WinExt_pythonwin.finalize_options(self, build_ext) @@ -112,7 +144,7 @@ index 37d536a..3e9d270 100644 self.extra_link_args.append("-mwindows") else: self.extra_link_args.append("/SUBSYSTEM:WINDOWS") -@@ -249,6 +318,9 @@ class WinExt_pythonwin_subsys_win(WinExt_pythonwin): +@@ -250,6 +334,9 @@ class WinExt_pythonwin_subsys_win(WinExt_pythonwin): class WinExt_win32(WinExt): def __init__(self, name, **kw): @@ -122,16 +154,16 @@ index 37d536a..3e9d270 100644 WinExt.__init__(self, name, **kw) def get_pywin32_dir(self): -@@ -265,6 +337,8 @@ class WinExt_ISAPI(WinExt): +@@ -266,6 +353,8 @@ class WinExt_ISAPI(WinExt): class WinExt_win32com(WinExt): def __init__(self, name, **kw): kw["libraries"] = kw.get("libraries", "") + " oleaut32 ole32" + if "GCC" in sys.version: + kw["libraries"] = kw.get("libraries", "") + " uuid pythoncom pywintypes" + WinExt.__init__(self, name, **kw) - # COM extensions require later windows headers. - if not kw.get("windows_h_version"): -@@ -331,11 +405,16 @@ class WinExt_system32(WinExt): + def get_pywin32_dir(self): +@@ -328,11 +417,16 @@ class WinExt_system32(WinExt): class WinExt_pythonservice(WinExt): @@ -149,18 +181,25 @@ index 37d536a..3e9d270 100644 self.extra_link_args.append("-mconsole") self.extra_link_args.append("-municode") else: -@@ -880,6 +959,395 @@ class my_build_ext(build_ext): +@@ -856,18 +950,368 @@ class my_build_ext(build_ext): return new_sources +-def my_new_compiler(**kw): +- if "compiler" in kw and kw["compiler"] in (None, "msvc"): +- return my_compiler() +- return orig_new_compiler(**kw) +class mingw_build_ext(build_ext): + def finalize_options(self): + build_ext.finalize_options(self) -+ self.windows_h_version = None -+ # The pywintypes library is created in the build_temp directory, -+ # so we need to add this to library_dirs + ++ # The pywintypes library is created in the build_temp ++ # directory, so we need to add this to library_dirs + self.library_dirs.append(self.build_temp) -+ + +-# No way to cleanly wedge our compiler sub-class in. +-orig_new_compiler = ccompiler.new_compiler +-ccompiler.new_compiler = my_new_compiler # type: ignore[assignment] # Assuming the caller will always use only kwargs + # Add extra VC++ SDK library dir + if "64 bit" in sys.version: + x64_dir = "/x64" @@ -179,7 +218,13 @@ index 37d536a..3e9d270 100644 + self.swig_cpp = True + + def _why_cant_build_extension(self, ext): -+ # Return None, or a reason it can't be built. ++ """Return None, or a reason it can't be built.""" ++ # axdebug fails to build on 3.11 due to Python "frame" objects changing. ++ # This could be fixed, but is almost certainly not in use any more, so ++ # just skip it. ++ if ext.name == "axdebug" and sys.version_info >= (3, 11): ++ return "AXDebug no longer builds on 3.11 and up" ++ + if ext.name in ["exchange", "exchdapi"]: + return "No library for utility functions available." + @@ -187,12 +232,6 @@ index 37d536a..3e9d270 100644 + if ext.name in ["win32ui", "win32uiole", "dde", "Pythonwin"]: + return "Unsupported due to ATL/MFC usage." + -+ # axdebug fails to build on 3.11 due to Python "frame" objects changing. -+ # This could be fixed, but is almost certainly not in use any more, so -+ # just skip it. -+ if ext.name == "axdebug" and sys.version_info > (3, 10): -+ return "AXDebug no longer builds on 3.11 and up" -+ + def _build_scintilla(self): + path = "Pythonwin/Scintilla/win32" + makefile = "scintilla_mingw.mak" @@ -215,11 +254,12 @@ index 37d536a..3e9d270 100644 + os.chdir(path) + try: + import subprocess -+ + + cmd = subprocess.call(["make", "-f", makefile] + makeargs) + finally: + os.chdir(cwd) -+ + +-class my_compiler(MSVCCompiler): + # The DLL goes into the Pythonwin directory. + if self.debug: + base_name = "scintilla_d.dll" @@ -236,15 +276,15 @@ index 37d536a..3e9d270 100644 + + self.found_libraries = {} + -+ if not hasattr(self.compiler, "initialized"): -+ # 2.3 and earlier initialized at construction -+ self.compiler.initialized = True -+ else: -+ if not self.compiler.initialized: -+ self.compiler.initialize() ++ if hasattr(self.compiler, "initialize") and not self.compiler.initialized: ++ self.compiler.initialize() + -+ # Here we hack a "pywin32" directory, -+ # as distutils doesn't seem to like the concept ++ # Always use cxx as the linker ++ cxx = os.environ.get('CXX') ++ self.compiler.set_executables(linker_exe=cxx) ++ ++ # Here we hack a "pywin32" directory (one of 'win32', 'win32com', ++ # 'pythonwin' etc), as distutils doesn't seem to like the concept + # of multiple top-level directories. + assert self.package is None + for ext in self.extensions: @@ -255,6 +295,7 @@ index 37d536a..3e9d270 100644 + self.build_extension(ext) + + for ext in W32_exe_files: ++ self.package = ext.get_pywin32_dir() + ext.finalize_options(self) + why = self._why_cant_build_extension(ext) + if why is not None: @@ -262,17 +303,31 @@ index 37d536a..3e9d270 100644 + assert why, "please give a reason, or None" + print(f"Skipping {ext.name}: {why}") + continue -+ -+ try: -+ self.package = ext.get_pywin32_dir() -+ except AttributeError: -+ raise RuntimeError("Not a win32 package!") + self.build_exefile(ext) + ++ for ext in [*self.extensions, *W32_exe_files]: ++ # Stamp the version of the built target. ++ # Do this externally to avoid suddenly dragging in the ++ # modules needed by this process, and which we will soon try and update. ++ ext_path = self.get_ext_fullpath(ext.name) ++ self.spawn( ++ [ ++ sys.executable, ++ Path(__file__).parent / "win32" / "Lib" / "win32verstamp.py", ++ f"--version={pywin32_version}", ++ "--comments=https://github.com/mhammond/pywin32", ++ f"--original-filename={os.path.basename(ext_path)}", ++ "--product=PyWin32", ++ "--quiet" if "-v" not in sys.argv else "", ++ ext_path, ++ ] ++ ) ++ + # Only build scintilla if Pythonwin extensions are enabled + pythonwin_dir = os.path.join(self.build_temp, "pythonwin") + if os.path.exists(pythonwin_dir): + self._build_scintilla() ++ + # Copy cpp lib files needed to create Python COM extensions + clib_files = ( + ["win32", "pywintypes%s.dll.a"], @@ -311,83 +366,40 @@ index 37d536a..3e9d270 100644 + pass + + def build_exefile(self, ext): ++ suffix = "_d" if self.debug else "" ++ logging.info("building exe '%s'", ext.name) ++ leaf_name = f"{ext.get_pywin32_dir()}/{ext.name}{suffix}.exe" ++ full_name = os.path.join(self.build_lib, leaf_name) ++ + sources = list(ext.sources) -+ -+ fullname = self.get_ext_fullname(ext.name) -+ if self.inplace: -+ # ignore build-lib -- put the compiled extension into -+ # the source tree along with pure Python modules -+ modpath = string.split(fullname, ".") -+ package = string.join(modpath[0:-1], ".") -+ base = modpath[-1] -+ -+ build_py = self.get_finalized_command("build_py") -+ package_dir = build_py.get_package_dir(package) -+ ext_filename = os.path.join(package_dir, self.get_ext_filename(base)) -+ else: -+ ext_filename = os.path.join(self.build_lib, self.get_ext_filename(fullname)) + depends = sources + ext.depends -+ if not (self.force or newer_group(depends, ext_filename, "newer")): -+ logging.debug("skipping '%s' executable (up-to-date)", ext.name) -+ return -+ else: -+ logging.info("building '%s' executable", ext.name) ++ objects = self.compiler.compile( ++ sources, ++ output_dir=os.path.join(self.build_temp, ext.name), ++ include_dirs=ext.include_dirs, ++ debug=self.debug, ++ extra_postargs=ext.extra_compile_args, ++ depends=ext.depends, ++ ) + -+ # First, scan the sources for SWIG definition files (.i), run -+ # SWIG on 'em to create .c files, and modify the sources list -+ # accordingly. -+ sources = self.swig_sources(sources, ext) -+ extra_args = ext.extra_compile_args or [] -+ -+ macros = ext.define_macros[:] -+ for undef in ext.undef_macros: -+ macros.append((undef,)) -+ # Note: custom 'output_dir' needed due to servicemanager.pyd and -+ # pythonservice.exe being built from the same .cpp file - without -+ # this, distutils gets confused, as they both try and use the same -+ # .obj. -+ output_dir = os.path.join(self.build_temp, ext.name) -+ kw = { -+ "output_dir": output_dir, -+ "macros": macros, -+ "include_dirs": ext.include_dirs, -+ "debug": self.debug, -+ "extra_postargs": extra_args, -+ "depends": ext.depends, -+ } -+ objects = self.compiler.compile(sources, **kw) -+ -+ self._built_objects = objects[:] -+ -+ # Now link the object files together into a "shared object" -- -+ # of course, first we have to figure out all the other things -+ # that go into the mix. -+ if ext.extra_objects: -+ objects.extend(ext.extra_objects) -+ extra_args = ext.extra_link_args or [] -+ -+ # 2.2 has no 'language' support -+ kw = { -+ "libraries": self.get_libraries(ext), -+ "library_dirs": ext.library_dirs, -+ "runtime_library_dirs": ext.runtime_library_dirs, -+ "extra_postargs": extra_args, -+ "debug": self.debug, -+ "build_temp": self.build_temp, -+ } -+ -+ # Detect target language, if not provided -+ language = ext.language or self.compiler.detect_language(sources) -+ kw["target_lang"] = language -+ -+ self.compiler.link("executable", objects, ext_filename, **kw) ++ self.compiler.link( ++ "executable", ++ objects, ++ full_name, ++ libraries=self.get_libraries(ext), ++ library_dirs=ext.library_dirs, ++ runtime_library_dirs=ext.runtime_library_dirs, ++ extra_postargs=ext.extra_link_args, ++ debug=self.debug, ++ build_temp=self.build_temp, ++ ) + + def build_extension(self, ext): -+ # It is well known that some of these extensions are difficult to -+ # build, requiring various hard-to-track libraries etc. So we ++ # Some of these extensions are difficult to build, requiring various ++ # hard-to-track libraries et (eg, exchange sdk, etc). So we + # check the extension list for the extra libraries explicitly + # listed. We then search for this library the same way the C -+ # compiler would - if we can't find a library, we exclude the ++ # compiler would - if we can't find a library, we exclude the + # extension from the build. + # Note we can't do this in advance, as some of the .lib files + # we depend on may be built as part of the process - thus we can @@ -424,25 +436,17 @@ index 37d536a..3e9d270 100644 + return + + def get_ext_filename(self, name): -+ # The pywintypes and pythoncom extensions have special names -+ extra_dll = self.debug and "_d.dll" or ".dll" -+ extra_exe = self.debug and "_d.exe" or ".exe" -+ # *sob* - python fixed this bug in python 3.1 (bug 6403) -+ # So in the fixed versions we only get the base name, and if the -+ # output name is simply 'dir\name' we need to nothing. -+ ++ # We need to fixup some target filenames. ++ suffix = "_d" if self.debug else "" + if name in ["pywintypes", "pythoncom"]: -+ return name + "%d%d%s" % ( -+ sys.version_info[0], -+ sys.version_info[1], -+ extra_dll, -+ ) -+ elif name in ["perfmondata", "PyISAPI_loader"]: -+ return name + extra_dll -+ elif name.endswith("win32.pythonservice"): -+ return "win32/pythonservice" + extra_exe ++ ver = f"{sys.version_info.major}{sys.version_info.minor}" ++ return f"{name}{ver}{suffix}.dll" ++ if name in ["perfmondata", "PyISAPI_loader"]: ++ return f"{name}{suffix}.dll" ++ if name.endswith("win32.pythonservice"): ++ return f"win32/pythonservice{suffix}.exe" + elif name.endswith("pythonwin.Pythonwin"): -+ return "pythonwin/Pythonwin" + extra_exe ++ return f"pythonwin/Pythonwin{suffix}.exe" + return build_ext.get_ext_filename(self, name) + + def get_export_symbols(self, ext): @@ -464,11 +468,16 @@ index 37d536a..3e9d270 100644 + new_sources = [] + swig_sources = [] + swig_targets = {} -+ ++ # XXX this drops generated C/C++ files into the source tree, which ++ # is fine for developers who want to distribute the generated ++ # source -- but there should be an option to put SWIG output in ++ # the temp dir. ++ # Adding py3k to the mix means we *really* need to move to generating ++ # to the temp dir... + target_ext = ".cpp" + for source in sources: + (base, sext) = os.path.splitext(source) -+ if sext == ".i": ++ if sext == ".i": # SWIG interface file + if os.path.split(base)[1] in swig_include_files: + continue + swig_sources.append(source) @@ -476,7 +485,7 @@ index 37d536a..3e9d270 100644 + if os.path.basename(base) in swig_interface_parents: + swig_targets[source] = base + target_ext + else: -+ new_target = "%s_swig%s" % (base, target_ext) ++ new_target = f"{base}_swig{target_ext}" + new_sources.append(new_target) + swig_targets[source] = new_target + else: @@ -495,21 +504,17 @@ index 37d536a..3e9d270 100644 + else: + swig_cmd.append("-DSWIG_PY32BIT") + target = swig_targets[source] -+ try: -+ interface_parent = swig_interface_parents[ -+ os.path.basename(os.path.splitext(source)[0]) -+ ] -+ except KeyError: -+ # "normal" swig file - no special win32 issues. -+ pass -+ else: -+ # Using win32 extensions to SWIG for generating COM classes. -+ if interface_parent is not None: -+ # generating a class, not a module. -+ swig_cmd.append("-pythoncom") -+ if interface_parent: -+ # A class deriving from other than the default -+ swig_cmd.extend(["-com_interface_parent", interface_parent]) ++ interface_parent = swig_interface_parents.get( ++ os.path.basename(os.path.splitext(source)[0]), ++ None, # "normal" swig file - no special win32 issues. ++ ) ++ # Using win32 extensions to SWIG for generating COM classes. ++ if interface_parent is not None: ++ # generating a class, not a module. ++ swig_cmd.append("-pythoncom") ++ if interface_parent: ++ # A class deriving from other than the default ++ swig_cmd.extend(["-com_interface_parent", interface_parent]) + + # This 'newer' check helps python 2.2 builds, which otherwise + # *always* regenerate the .cpp files, meaning every future @@ -542,53 +547,50 @@ index 37d536a..3e9d270 100644 + return new_sources + + - class my_install(install): - def run(self): - install.run(self) -@@ -895,7 +1363,7 @@ class my_install(install): - # some other directory than Python itself (eg, into a temp directory - # for bdist_wininst to use) - in which case we must *not* run our - # installer -- if not self.dry_run and not self.root: -+ if "MSC" in sys.version and not self.dry_run and not self.root: - # We must run the script we just installed into Scripts, as it - # may have had 2to3 run over it. - filename = os.path.join(self.install_scripts, "pywin32_postinstall.py") -@@ -945,14 +1413,21 @@ def my_new_compiler(**kw): - orig_new_compiler = ccompiler.new_compiler - ccompiler.new_compiler = my_new_compiler # type: ignore[assignment] # Assuming the caller will always use only kwargs - +if "MSC" in sys.version: + base_compiler = MSVCCompiler +else: -+ from distutils.cygwinccompiler import Mingw32CCompiler ++ from setuptools._distutils.cygwinccompiler import Mingw32CCompiler + base_compiler = Mingw32CCompiler + - --class my_compiler(MSVCCompiler): ++ +class my_compiler(base_compiler): - # Just one GUIDS.CPP and it gives trouble on mainwin too. Maybe I - # should just rename the file, but a case-only rename is likely to be - # worse! This can probably go away once we kill the VS project files - # though, as we can just specify the lowercase name in the module def. -- _cpp_extensions = MSVCCompiler._cpp_extensions + [".CPP"] -- src_extensions = MSVCCompiler.src_extensions + [".CPP"] -+ if "MSC" in sys.version: -+ _cpp_extensions = base_compiler._cpp_extensions + [".CPP"] -+ src_extensions = base_compiler.src_extensions + [".CPP"] - def link( self, -@@ -1025,7 +1500,7 @@ class my_compiler(MSVCCompiler): + target_desc, +@@ -895,22 +1339,6 @@ class my_compiler(MSVCCompiler): + *args, + **kw, + ) +- # Here seems a good place to stamp the version of the built +- # target. Do this externally to avoid suddenly dragging in the +- # modules needed by this process, and which we will soon try and +- # update. +- args = [ +- sys.executable, +- # NOTE: On Python 3.7, all args must be str +- str(Path(__file__).parent / "win32" / "Lib" / "win32verstamp.py"), +- f"--version={pywin32_version}", +- "--comments=https://github.com/mhammond/pywin32", +- f"--original-filename={os.path.basename(output_filename)}", +- "--product=PyWin32", +- "--quiet" if "-v" not in sys.argv else "", +- output_filename, +- ] +- self.spawn(args) + + # Work around bpo-36302/bpo-42009 - it sorts sources but this breaks + # support for building .mc files etc :( +@@ -922,7 +1350,7 @@ class my_compiler(MSVCCompiler): return (e, b) sources = sorted(sources, key=key_reverse_mc) - return MSVCCompiler.compile(self, sources, **kwargs) + return base_compiler.compile(self, sources, **kwargs) - def spawn(self, cmd): + def spawn(self, cmd: MutableSequence[str]) -> None: # type: ignore[override] # More restrictive than supertype is_link = cmd[0].endswith("link.exe") or cmd[0].endswith('"link.exe"') -@@ -1085,6 +1560,10 @@ class my_install_data(install_data): +@@ -982,6 +1410,10 @@ class my_install_data(install_data): ################################################################ @@ -599,7 +601,7 @@ index 37d536a..3e9d270 100644 pywintypes = WinExt_system32( "pywintypes", sources=[ -@@ -1110,6 +1589,7 @@ pywintypes = WinExt_system32( +@@ -1007,6 +1439,7 @@ pywintypes = WinExt_system32( ], extra_compile_args=["-DBUILD_PYWINTYPES"], libraries="advapi32 user32 ole32 oleaut32", @@ -607,16 +609,38 @@ index 37d536a..3e9d270 100644 pch_header="PyWinTypes.h", ) -@@ -1151,7 +1631,7 @@ for info in ( - ("win32cred", "AdvAPI32 credui", 0x0501, "win32/src/win32credmodule.cpp"), +@@ -1043,10 +1476,10 @@ for name, libraries, sources in ( + """, + ), + ("timer", "user32", "win32/src/timermodule.cpp"), +- ("win32cred", "AdvAPI32 credui", "win32/src/win32credmodule.cpp"), ++ ("win32cred", "advapi32 credui", "win32/src/win32credmodule.cpp"), ( "win32crypt", - "Crypt32 Advapi32", + "advapi32 crypt32", - 0x0500, """ - win32/src/win32crypt/win32cryptmodule.cpp -@@ -1269,7 +1749,7 @@ win32_extensions += [ + win32/src/win32crypt/win32cryptmodule.cpp + win32/src/win32crypt/win32crypt_structs.cpp +@@ -1097,7 +1530,7 @@ for name, libraries, sources in ( + "win32/src/win32print/win32print.cpp", + ), + ("win32process", "advapi32 user32", "win32/src/win32process.i"), +- ("win32profile", "Userenv", "win32/src/win32profilemodule.cpp"), ++ ("win32profile", "userenv", "win32/src/win32profilemodule.cpp"), + ("win32ras", "rasapi32 user32", "win32/src/win32rasmodule.cpp"), + ( + "win32security", +@@ -1135,7 +1568,7 @@ for name, libraries, sources in ( + """, + ), + ("win32console", "kernel32", "win32/src/win32consolemodule.cpp"), +- ("win32ts", "WtsApi32", "win32/src/win32tsmodule.cpp"), ++ ("win32ts", "wtsapi32", "win32/src/win32tsmodule.cpp"), + ("_win32sysloader", "", "win32/src/_win32sysloader.cpp"), + ("win32transaction", "kernel32", "win32/src/win32transactionmodule.cpp"), + ): +@@ -1152,7 +1585,7 @@ win32_extensions += [ WinExt_win32( "win32evtlog", sources=""" @@ -625,7 +649,16 @@ index 37d536a..3e9d270 100644 """.split(), libraries="advapi32 oleaut32", delay_load_libraries="wevtapi", -@@ -1338,6 +1818,13 @@ dirs = { +@@ -1178,7 +1611,7 @@ win32_extensions += [ + WinExt_win32( + "_winxptheme", + sources=["win32/src/_winxptheme.i"], +- libraries="gdi32 user32 comdlg32 comctl32 shell32 Uxtheme", ++ libraries="gdi32 user32 comdlg32 comctl32 shell32 uxtheme", + ), + ] + win32_extensions += [ +@@ -1215,6 +1648,13 @@ dirs = { "win32com": "com/win32com/src", } @@ -639,9 +672,9 @@ index 37d536a..3e9d270 100644 # The COM modules. pythoncom = WinExt_system32( "pythoncom", -@@ -1417,9 +1904,10 @@ pythoncom = WinExt_system32( - **dirs - ) +@@ -1290,9 +1730,10 @@ pythoncom = WinExt_system32( + {win32com}/include\\PyIServerSecurity.h + """.format(**dirs) ).split(), - libraries="oleaut32 ole32 user32 urlmon", + libraries="oleaut32 ole32 user32 urlmon" + pythoncom_dep, @@ -649,9 +682,9 @@ index 37d536a..3e9d270 100644 extra_compile_args=["-DBUILD_PYTHONCOM"], + implib_name=pythoncom_lib, pch_header="stdafx.h", - windows_h_version=0x500, base_address=dll_base_address, -@@ -1429,7 +1917,7 @@ com_extensions = [ + ) +@@ -1301,7 +1742,7 @@ com_extensions = [ pythoncom, WinExt_win32com( "adsi", @@ -660,7 +693,7 @@ index 37d536a..3e9d270 100644 sources=( """ {adsi}/adsi.i {adsi}/adsi.cpp -@@ -1948,6 +2436,7 @@ pythonwin_extensions = [ +@@ -1775,6 +2216,7 @@ pythonwin_extensions = [ "Pythonwin/Win32uiHostGlue.h", "Pythonwin/win32win.h", ], @@ -668,29 +701,47 @@ index 37d536a..3e9d270 100644 optional_headers=["afxres.h"], ), WinExt_pythonwin( -@@ -2188,6 +2677,12 @@ ext_modules = ( +@@ -2012,6 +2454,19 @@ ext_modules = ( win32_extensions + com_extensions + pythonwin_extensions + other_extensions ) +if "GCC" in sys.version: + my_build_ext = mingw_build_ext + install_scripts = [] ++ binary_scripts = {} +else: -+ install_scripts = ["pywin32_postinstall.py", "pywin32_testall.py"] ++ install_scripts = ["pywin32_postinstall.py", "pywin32_testall.py",] ++ binary_scripts = { ++ "console_scripts": [ ++ "pywin32_postinstall = win32.scripts.pywin32_postinstall:main", ++ "pywin32_testall = win32.scripts.pywin32_testall:main", ++ ] ++ } + cmdclass = { - "install": my_install, "build": my_build, -@@ -2272,7 +2767,7 @@ dist = setup( - "user_access_control": "auto", - }, - }, -- scripts=["pywin32_postinstall.py", "pywin32_testall.py"], + "build_ext": my_build_ext, +@@ -2046,17 +2501,9 @@ dist = setup( + classifiers=classifiers, + cmdclass=cmdclass, + # This adds the scripts under Python3XX/Scripts, but doesn't actually do much +- scripts=[ +- "win32/scripts/pywin32_postinstall.py", +- "win32/scripts/pywin32_testall.py", +- ], + scripts=install_scripts, + # This shortcuts `python -m win32.scripts.some_script` to just `some_script` +- entry_points={ +- "console_scripts": [ +- "pywin32_postinstall = win32.scripts.pywin32_postinstall:main", +- "pywin32_testall = win32.scripts.pywin32_testall:main", +- ] +- }, ++ entry_points=binary_scripts, ext_modules=ext_modules, package_dir={ "win32com": "com/win32com", -@@ -2381,7 +2876,7 @@ if "build_ext" in dist.command_obj: +@@ -2165,7 +2612,7 @@ if "build_ext" in dist.command_obj: print("*** NOTE: The following extensions were NOT %s:" % what_string) for ext, why in excluded_extensions: print(f" {ext.name}: {why}") diff --git a/mingw-w64-python-pywin32/002-com-extensions-fix.patch b/mingw-w64-python-pywin32/002-com-extensions-fix.patch index a8b08f4c45..4f99dfffd6 100644 --- a/mingw-w64-python-pywin32/002-com-extensions-fix.patch +++ b/mingw-w64-python-pywin32/002-com-extensions-fix.patch @@ -1,5 +1,5 @@ diff --git a/com/win32com/src/ErrorUtils.cpp b/com/win32com/src/ErrorUtils.cpp -index ff16d99..a67bf64 100644 +index c774e9f..a1d561a 100644 --- a/com/win32com/src/ErrorUtils.cpp +++ b/com/win32com/src/ErrorUtils.cpp @@ -1070,18 +1070,18 @@ LPCTSTR GetScodeRangeString(HRESULT hr) @@ -47,10 +47,10 @@ index 64808d6..82bb805 100644 PyObject *PyObject_FromOLEMENUGROUPWIDTHS(const OLEMENUGROUPWIDTHS *pWidths) diff --git a/com/win32com/src/PyIUnknown.cpp b/com/win32com/src/PyIUnknown.cpp -index 1473cb8..96c5959 100644 +index 1473cb8..6221fb3 100644 --- a/com/win32com/src/PyIUnknown.cpp +++ b/com/win32com/src/PyIUnknown.cpp -@@ -31,8 +31,16 @@ PyObject *PyIUnknown::repr() +@@ -31,7 +31,11 @@ PyObject *PyIUnknown::repr() { // @comm The repr of this object displays both the object's address, and its attached IUnknown's address char buf[256]; @@ -59,19 +59,14 @@ index 1473cb8..96c5959 100644 +#else + _snprintf(buf, 256, "<%s at 0x%p with obj at 0x%p>", ob_type->tp_name, this, m_obj); +#endif -+#if (PY_VERSION_HEX < 0x03000000) -+ return PyBytes_FromString(buf); -+#else return PyUnicode_FromString(buf); -+#endif } - /*static*/ IUnknown *PyIUnknown::GetI(PyObject *self) diff --git a/com/win32com/src/PyRecord.cpp b/com/win32com/src/PyRecord.cpp -index df389bf..abf746d 100644 +index 394d15b..7811731 100644 --- a/com/win32com/src/PyRecord.cpp +++ b/com/win32com/src/PyRecord.cpp -@@ -348,7 +348,7 @@ static void _FreeFieldNames(BSTR *strings, ULONG num_names) +@@ -504,7 +504,7 @@ static void _FreeFieldNames(BSTR *strings, ULONG num_names) delete[] strings; } @@ -80,7 +75,7 @@ index df389bf..abf746d 100644 { if (!w) { // hrm - string version doesn't do this, but I saw PyObject_Repr() return NULL... Py_XDECREF(*pv); -@@ -360,7 +360,7 @@ void PyWinCoreString_Concat(register PyObject **pv, register PyObject *w) +@@ -516,7 +516,7 @@ void PyWinCoreString_Concat(register PyObject **pv, register PyObject *w) *pv = tmp; } @@ -90,7 +85,7 @@ index df389bf..abf746d 100644 PyWinCoreString_Concat(pv, w); Py_XDECREF(w); diff --git a/com/win32com/src/dllmain.cpp b/com/win32com/src/dllmain.cpp -index bac646e..03e13db 100644 +index de857ed..d9a7ed3 100644 --- a/com/win32com/src/dllmain.cpp +++ b/com/win32com/src/dllmain.cpp @@ -125,7 +125,7 @@ extern "C" __declspec(dllexport) BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD @@ -156,19 +151,14 @@ index bbc2c07..7f7b482 100644 return hr; } diff --git a/com/win32com/src/include/PythonCOM.h b/com/win32com/src/include/PythonCOM.h -index 446500a..3e47c9e 100644 +index 2bb531f..538d28d 100644 --- a/com/win32com/src/include/PythonCOM.h +++ b/com/win32com/src/include/PythonCOM.h -@@ -92,10 +92,21 @@ +@@ -92,10 +92,15 @@ #ifdef __MINGW32__ // Special Mingw32 considerations. -#define NO_PYCOM_ENUMSTATPROPSTG -+#undef _WIN32_WINNT -+#define _WIN32_WINNT 0x0601 -+#undef _WIN32_IE -+#define _WIN32_IE 0x0700 -+ #define __try try -#define __except catch +#define __except(filter) catch(...) @@ -179,7 +169,6 @@ index 446500a..3e47c9e 100644 +#include +#include +#include -+ #endif // __MINGW32__ @@ -319,7 +308,7 @@ index 5d66cbb..5d7db00 100644 return PyCom_HandlePythonFailureToCOM(); PyObject *obContinue = PyWinObject_FromULONG_PTR(dwContinue); diff --git a/com/win32comext/ifilter/src/stdafx.h b/com/win32comext/ifilter/src/stdafx.h -index 8a9b1c2..973248f 100644 +index 0982841..dd35abd 100644 --- a/com/win32comext/ifilter/src/stdafx.h +++ b/com/win32comext/ifilter/src/stdafx.h @@ -13,7 +13,9 @@ @@ -442,25 +431,22 @@ index a80c4f0..dd1eb5f 100644 Py_BEGIN_ALLOW_THREADS hRes = _swig_self->GetLastError(hr, flags, &me); diff --git a/com/win32comext/mapi/src/PyIConverterSession.i b/com/win32comext/mapi/src/PyIConverterSession.i -index 9496b4d..4fac2dd 100644 +index 9496b4d..28f1984 100644 --- a/com/win32comext/mapi/src/PyIConverterSession.i +++ b/com/win32comext/mapi/src/PyIConverterSession.i -@@ -72,9 +72,12 @@ PyObject *PyIConverterSession::MIMEToMAPI(PyObject *self, PyObject *args) +@@ -72,9 +72,9 @@ PyObject *PyIConverterSession::MIMEToMAPI(PyObject *self, PyObject *args) IMessage *pMsg = NULL; if (!PyCom_InterfaceFromPyObject(obStream, IID_IStream, (void **)&pStream, FALSE)) - goto done; -+ if (pStream) -+ pStream->Release(); -+ ++ if (pStream) pStream->Release(); if (!PyCom_InterfaceFromPyObject(obMsg, IID_IMessage, (void **)&pMsg, FALSE)) - goto done; -+ if (pMsg) -+ pMsg->Release(); ++ if (pMsg) pMsg->Release(); { PY_INTERFACE_PRECALL; -@@ -90,12 +93,6 @@ PyObject *PyIConverterSession::MIMEToMAPI(PyObject *self, PyObject *args) +@@ -90,12 +90,6 @@ PyObject *PyIConverterSession::MIMEToMAPI(PyObject *self, PyObject *args) result = Py_None; } @@ -473,21 +459,19 @@ index 9496b4d..4fac2dd 100644 return result; } -@@ -117,9 +114,11 @@ PyObject *PyIConverterSession::MAPIToMIMEStm(PyObject *self, PyObject *args) +@@ -117,9 +111,9 @@ PyObject *PyIConverterSession::MAPIToMIMEStm(PyObject *self, PyObject *args) IMessage *pMsg = NULL; if (!PyCom_InterfaceFromPyObject(obMsg, IID_IMessage, (void **)&pMsg, FALSE)) - goto done; -+ if (pMsg) -+ pMsg->Release(); ++ if (pMsg) pMsg->Release(); if (!PyCom_InterfaceFromPyObject(obStream, IID_IStream, (void **)&pStream, FALSE)) - goto done; -+ if (pStream) -+ pStream->Release(); ++ if (pStream) pStream->Release(); { PY_INTERFACE_PRECALL; -@@ -135,12 +134,6 @@ PyObject *PyIConverterSession::MAPIToMIMEStm(PyObject *self, PyObject *args) +@@ -135,12 +129,6 @@ PyObject *PyIConverterSession::MAPIToMIMEStm(PyObject *self, PyObject *args) result = Py_None; } @@ -924,7 +908,7 @@ index 64fe62c..394faf8 100644 { eid = NULL; diff --git a/com/win32comext/mapi/src/mapi.i b/com/win32comext/mapi/src/mapi.i -index b661334..6602767 100644 +index 1c2d82b..0afe794 100644 --- a/com/win32comext/mapi/src/mapi.i +++ b/com/win32comext/mapi/src/mapi.i @@ -25,6 +25,10 @@ @@ -938,7 +922,7 @@ index b661334..6602767 100644 #include "mapiaux.h" #include "PythonCOMServer.h" -@@ -631,9 +635,9 @@ PyObject *PyMAPILogonEx(PyObject *self, PyObject *args) +@@ -633,9 +637,9 @@ PyObject *PyMAPILogonEx(PyObject *self, PyObject *args) return NULL; if (!PyWinObject_AsMAPIStr(obProfileName, &lpszProfileName, ulFlags & MAPI_UNICODE, FALSE)) @@ -950,7 +934,7 @@ index b661334..6602767 100644 Py_BEGIN_ALLOW_THREADS hRes = ::MAPILogonEx(ulUIParam, lpszProfileName, lpszPassword, ulFlags, &lpSession); -@@ -644,10 +648,6 @@ PyObject *PyMAPILogonEx(PyObject *self, PyObject *args) +@@ -646,10 +650,6 @@ PyObject *PyMAPILogonEx(PyObject *self, PyObject *args) else MAKE_OUTPUT_INTERFACE(&lpSession, result, IID_IMAPISession); @@ -961,7 +945,7 @@ index b661334..6602767 100644 return result; } %} -@@ -789,7 +789,7 @@ PyObject *PyOpenIMsgSession(PyObject *self, PyObject *args) +@@ -791,7 +791,7 @@ PyObject *PyOpenIMsgSession(PyObject *self, PyObject *args) PY_INTERFACE_POSTCALL; if (FAILED(hr)) return OleSetOleError(hr); @@ -970,7 +954,7 @@ index b661334..6602767 100644 } %} // @pyswig |CloseIMsgSession| -@@ -797,7 +797,7 @@ PyObject *PyOpenIMsgSession(PyObject *self, PyObject *args) +@@ -799,7 +799,7 @@ PyObject *PyOpenIMsgSession(PyObject *self, PyObject *args) %{ PyObject *PyCloseIMsgSession(PyObject *self, PyObject *args) { @@ -979,7 +963,7 @@ index b661334..6602767 100644 if (!PyArg_ParseTuple(args, "l:CloseIMsgSession", &session)) return NULL; PY_INTERFACE_PRECALL; -@@ -821,7 +821,7 @@ PyObject *PyOpenIMsgOnIStg(PyObject *self, PyObject *args) +@@ -823,7 +823,7 @@ PyObject *PyOpenIMsgOnIStg(PyObject *self, PyObject *args) long flags = 0; HRESULT hr = E_FAIL; PyObject *rc = NULL; @@ -988,7 +972,7 @@ index b661334..6602767 100644 if (!PyArg_ParseTuple(args, "lOO|Oll:OpenIMsgOnIStg", &lSession, // @pyparm object|session|| -@@ -841,7 +841,7 @@ PyObject *PyOpenIMsgOnIStg(PyObject *self, PyObject *args) +@@ -843,7 +843,7 @@ PyObject *PyOpenIMsgOnIStg(PyObject *self, PyObject *args) IMessage *pRet = NULL; if (!PyCom_InterfaceFromPyObject(obStorage, IID_IStorage, (void **)&pStorage, FALSE)) @@ -997,7 +981,7 @@ index b661334..6602767 100644 { PY_INTERFACE_PRECALL; -@@ -859,12 +859,9 @@ PyObject *PyOpenIMsgOnIStg(PyObject *self, PyObject *args) +@@ -861,12 +861,9 @@ PyObject *PyOpenIMsgOnIStg(PyObject *self, PyObject *args) } if (FAILED(hr)) { OleSetOleError(hr); @@ -1011,7 +995,7 @@ index b661334..6602767 100644 return rc; } %} -@@ -945,7 +942,7 @@ void decodertfhtml(char *buf,unsigned int *len) +@@ -947,7 +944,7 @@ void decodertfhtml(char *buf,unsigned int *len) else if (strncmp(c,"\\pntext",7)==0) {c+=7; while (c|OpenStreamOnFileW|Allocates and initializes an OLE IStream object to access the contents of a file. %native(OpenStreamOnFileW) PyOpenStreamOnFileW; %{ -@@ -1123,6 +1117,7 @@ PyObject *PyOpenStreamOnFileW(PyObject *self, PyObject *args) +@@ -1125,6 +1119,7 @@ PyObject *PyOpenStreamOnFileW(PyObject *self, PyObject *args) return PyCom_PyObjectFromIUnknown(pStream, IID_IStream, FALSE); } %} @@ -1060,7 +1044,7 @@ index b661334..6602767 100644 // @pyswig item|HrGetOneProp|Retrieves the value of a single property from an IMAPIProp object. %native(HrGetOneProp) PyHrGetOneProp; -@@ -1142,7 +1137,7 @@ PyObject *PyHrGetOneProp(PyObject *self, PyObject *args) +@@ -1144,7 +1139,7 @@ PyObject *PyHrGetOneProp(PyObject *self, PyObject *args) return NULL; if (!PyCom_InterfaceFromPyObject(obProp, IID_IMAPIProp, (void **)&pProp, FALSE)) @@ -1069,7 +1053,7 @@ index b661334..6602767 100644 { PY_INTERFACE_PRECALL; -@@ -1152,10 +1147,10 @@ PyObject *PyHrGetOneProp(PyObject *self, PyObject *args) +@@ -1154,10 +1149,10 @@ PyObject *PyHrGetOneProp(PyObject *self, PyObject *args) if (FAILED(hRes)) { OleSetOleError(hRes); @@ -1082,7 +1066,7 @@ index b661334..6602767 100644 // PyMAPIObject_FromSPropValue does not raise an exception for types // it cannot handle so that GetProps doesn't blow up. Since we are processing -@@ -1164,14 +1159,11 @@ PyObject *PyHrGetOneProp(PyObject *self, PyObject *args) +@@ -1166,14 +1161,11 @@ PyObject *PyHrGetOneProp(PyObject *self, PyObject *args) PyLong_AsUnsignedLong(PyTuple_GET_ITEM(ret, 0)) != PT_NULL) { char buf[128]; @@ -1098,7 +1082,7 @@ index b661334..6602767 100644 return ret; } -@@ -1185,6 +1177,7 @@ PyObject *PyHrSetOneProp(PyObject *self, PyObject *args) +@@ -1187,6 +1179,7 @@ PyObject *PyHrSetOneProp(PyObject *self, PyObject *args) HRESULT hRes; PyObject *obProp; PyObject *obPropValue; @@ -1106,7 +1090,7 @@ index b661334..6602767 100644 IMAPIProp *pProp = NULL; PyObject *ret = NULL; SPropValue *pPV = NULL; -@@ -1195,14 +1188,14 @@ PyObject *PyHrSetOneProp(PyObject *self, PyObject *args) +@@ -1197,14 +1190,14 @@ PyObject *PyHrSetOneProp(PyObject *self, PyObject *args) return NULL; if (!PyCom_InterfaceFromPyObject(obProp, IID_IMAPIProp, (void **)&pProp, FALSE)) @@ -1124,7 +1108,7 @@ index b661334..6602767 100644 { PY_INTERFACE_PRECALL; -@@ -1212,13 +1205,10 @@ PyObject *PyHrSetOneProp(PyObject *self, PyObject *args) +@@ -1214,13 +1207,10 @@ PyObject *PyHrSetOneProp(PyObject *self, PyObject *args) if (FAILED(hRes)) { OleSetOleError(hRes); diff --git a/mingw-w64-python-pywin32/003-win32-extensions-fix.patch b/mingw-w64-python-pywin32/003-win32-extensions-fix.patch index 4bd8b8ee61..db5b4d8b31 100644 --- a/mingw-w64-python-pywin32/003-win32-extensions-fix.patch +++ b/mingw-w64-python-pywin32/003-win32-extensions-fix.patch @@ -60,7 +60,7 @@ index c1baf75..999fab9 100644 // These removed in 3.0 }; diff --git a/win32/src/PyWinTypes.h b/win32/src/PyWinTypes.h -index 620aada..310ed05 100644 +index 37c21c1..51cc98d 100644 --- a/win32/src/PyWinTypes.h +++ b/win32/src/PyWinTypes.h @@ -18,6 +18,18 @@ @@ -83,10 +83,10 @@ index 620aada..310ed05 100644 // Some macros to help the pywin32 modules co-exist in py2x and py3k. // Creates and initializes local variables called 'module' and 'dict'. diff --git a/win32/src/PyWinTypesmodule.cpp b/win32/src/PyWinTypesmodule.cpp -index 1564f84..25068f6 100644 +index 5815ce5..6a1bc3b 100644 --- a/win32/src/PyWinTypesmodule.cpp +++ b/win32/src/PyWinTypesmodule.cpp -@@ -1062,11 +1062,17 @@ extern "C" __declspec(dllexport) BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwR +@@ -1071,11 +1071,17 @@ extern "C" __declspec(dllexport) BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwR } // Function to format a python traceback into a character string. @@ -105,7 +105,7 @@ index 1564f84..25068f6 100644 PYWINTYPES_EXPORT WCHAR *GetPythonTraceback(PyObject *exc_type, PyObject *exc_value, PyObject *exc_tb) { WCHAR *result = NULL; -@@ -1085,22 +1091,27 @@ PYWINTYPES_EXPORT WCHAR *GetPythonTraceback(PyObject *exc_type, PyObject *exc_va +@@ -1094,22 +1100,27 @@ PYWINTYPES_EXPORT WCHAR *GetPythonTraceback(PyObject *exc_type, PyObject *exc_va if (modStringIO == NULL) GPEM_ERROR("can't import cStringIO"); @@ -133,7 +133,7 @@ index 1564f84..25068f6 100644 // Py3k has added an undocumented 'chain' argument which defaults to True // and causes all kinds of exceptions while trying to print a traceback! // This *could* be useful thought if we can tame it - later! -@@ -1112,6 +1123,7 @@ PYWINTYPES_EXPORT WCHAR *GetPythonTraceback(PyObject *exc_type, PyObject *exc_va +@@ -1121,6 +1132,7 @@ PYWINTYPES_EXPORT WCHAR *GetPythonTraceback(PyObject *exc_type, PyObject *exc_va obStringIO, chain); if (argsTB == NULL) GPEM_ERROR("can't make print_exception arguments"); @@ -141,7 +141,7 @@ index 1564f84..25068f6 100644 obResult = PyObject_CallObject(obFuncTB, argsTB); if (obResult == NULL) { -@@ -1122,32 +1134,27 @@ PYWINTYPES_EXPORT WCHAR *GetPythonTraceback(PyObject *exc_type, PyObject *exc_va +@@ -1131,32 +1143,27 @@ PYWINTYPES_EXPORT WCHAR *GetPythonTraceback(PyObject *exc_type, PyObject *exc_va // PyUnicodeObject *uo=(PyUnicodeObject *)v; // DebugBreak(); GPEM_ERROR("traceback.print_exception() failed"); @@ -180,10 +180,10 @@ index 1564f84..25068f6 100644 return result; } diff --git a/win32/src/PythonService.cpp b/win32/src/PythonService.cpp -index 181c97b..3bc1ece 100644 +index 494ae31..d08d711 100644 --- a/win32/src/PythonService.cpp +++ b/win32/src/PythonService.cpp -@@ -1298,7 +1298,7 @@ static void ReportAPIError(DWORD msgCode, DWORD errCode /*= 0*/) +@@ -1296,7 +1296,7 @@ static void ReportAPIError(DWORD msgCode, DWORD errCode /*= 0*/) TCHAR cvtBuf[20]; wsprintf(cvtBuf, L"%d", errCode); @@ -206,28 +206,23 @@ index 40d9c0f..8ecce64 100644 MessageId=0x8 diff --git a/win32/src/_winxptheme.i b/win32/src/_winxptheme.i -index 3ef07bb..9f2b9b2 100644 +index 54ba869..650b44e 100644 --- a/win32/src/_winxptheme.i +++ b/win32/src/_winxptheme.i -@@ -15,10 +15,11 @@ - %include "pywintypes.i" +@@ -16,7 +16,7 @@ %{ -+#undef _WIN32_WINNT - #define _WIN32_WINNT 0x0501 - #undef PyHANDLE -#include "pywinobjects.h" +#include "PyWinObjects.h" #include "windows.h" #include "Uxtheme.h" - #include "commctrl.h" -@@ -91,6 +92,8 @@ typedef float HDC; + #include "CommCtrl.h" +@@ -87,6 +87,7 @@ typedef float HDC; return NULL; } +%typedef RECT RECT; -+ %typemap(python,ignore) RECT *OUTPUT(RECT temp) { $target = &temp; @@ -245,7 +240,7 @@ index 44b1eda..1f7834d 100644 if (ret) self->pos += 1; diff --git a/win32/src/odbc.cpp b/win32/src/odbc.cpp -index 6190ce5..2e7523b 100644 +index 6190ce5..1685337 100644 --- a/win32/src/odbc.cpp +++ b/win32/src/odbc.cpp @@ -93,8 +93,8 @@ typedef struct { @@ -315,34 +310,8 @@ index 6190ce5..2e7523b 100644 {"error", T_OBJECT, offsetof(cursorObject, cursorError), READONLY}, {NULL}}; -@@ -1450,13 +1450,25 @@ static void parseInfo(connectionObject *conn, const TCHAR *c) - - if (!firstEqualsSign || (firstSlash && firstSlash < firstEqualsSign)) { - _tcsncpy(buf, c, sizeof(buf) / sizeof(TCHAR)); -+#ifdef _UCRT -+ p = _tcstok(buf, _T("/"), 0); -+#else - p = _tcstok(buf, _T("/")); -+#endif - if (p) { - _tcsncpy(dsn, p, sizeof(dsn) / sizeof(TCHAR)); -+#ifdef _UCRT -+ p = _tcstok(buf, _T("/"), 0); -+#else - p = _tcstok(0, _T("/")); -+#endif - if (p) { - _tcsncpy(uid, p, sizeof(uid) / sizeof(TCHAR)); -+#ifdef _UCRT -+ p = _tcstok(buf, _T("/"), 0); -+#else - p = _tcstok(0, _T("/")); -+#endif - if (p) { - _tcsncpy(pwd, p, sizeof(pwd) / sizeof(TCHAR)); - } diff --git a/win32/src/timermodule.cpp b/win32/src/timermodule.cpp -index f06e8a4..b2ec845 100644 +index 7336897..7f2a5d2 100644 --- a/win32/src/timermodule.cpp +++ b/win32/src/timermodule.cpp @@ -8,7 +8,7 @@ @@ -355,28 +324,28 @@ index f06e8a4..b2ec845 100644 static PyObject *timer_id_callback_map = NULL; diff --git a/win32/src/win32apimodule.cpp b/win32/src/win32apimodule.cpp -index 026816e..3072b6e 100644 +index d08e665..d2b9ee6 100644 --- a/win32/src/win32apimodule.cpp +++ b/win32/src/win32apimodule.cpp -@@ -528,7 +528,7 @@ static PyObject *PyFindExecutable(PyObject *self, PyObject *args) +@@ -545,7 +545,7 @@ static PyObject *PyFindExecutable(PyObject *self, PyObject *args) if (rc == (HINSTANCE)31) PyErr_SetString(PyWinExc_ApiError, "FindExecutable: There is no association for the file"); else - PyWin_SetAPIError("FindExecutable", (int)rc); + PyWin_SetAPIError("FindExecutable", (INT_PTR)rc); } - else ret = Py_BuildValue("(NN)", PyWinLong_FromHANDLE(rc), PyWinObject_FromTCHAR(res)); - } -@@ -1173,7 +1173,7 @@ static PyObject *PyLoadCursor(PyObject *self, PyObject *args) - if (!PyWinObject_AsResourceId(obid, &id)) + else + ret = Py_BuildValue("(NN)", PyWinLong_FromHANDLE(rc), PyWinObject_FromTCHAR(res)); +@@ -1215,7 +1215,7 @@ static PyObject *PyLoadCursor(PyObject *self, PyObject *args) return NULL; // @pyseeapi LoadCursor -- PyW32_BEGIN_ALLOW_THREADS HCURSOR ret = ::LoadCursor(hInstance, MAKEINTRESOURCE(id)); -+ PyW32_BEGIN_ALLOW_THREADS HCURSOR ret = ::LoadCursor(hInstance, MAKEINTRESOURCE((ULONG_PTR)id)); - PyW32_END_ALLOW_THREADS PyWinObject_FreeResourceId(id); + PyW32_BEGIN_ALLOW_THREADS; +- HCURSOR ret = ::LoadCursor(hInstance, MAKEINTRESOURCE(id)); ++ HCURSOR ret = ::LoadCursor(hInstance, MAKEINTRESOURCE((ULONG_PTR)id)); + PyW32_END_ALLOW_THREADS; + PyWinObject_FreeResourceId(id); if (ret == NULL) - ReturnAPIError("LoadCursor"); -@@ -1787,7 +1787,7 @@ static PyObject *PyGetProcAddress(PyObject *self, PyObject *args) +@@ -1855,7 +1855,7 @@ static PyObject *PyGetProcAddress(PyObject *self, PyObject *args) if (proc == NULL) return ReturnAPIError("GetProcAddress"); // @pyseeapi GetProcAddress @@ -385,16 +354,16 @@ index 026816e..3072b6e 100644 } // @pymethod |win32api|GetDllDirectory|Returns the DLL search path -@@ -4298,7 +4298,7 @@ static PyObject *PyShellExecute(PyObject *self, PyObject *args) - PyW32_BEGIN_ALLOW_THREADS HINSTANCE rc = ::ShellExecute(hwnd, op, file, params, dir, show); - PyW32_END_ALLOW_THREADS - // @pyseeapi ShellExecute -- if (rc <= (HINSTANCE)32) PyWin_SetAPIError("ShellExecute", (int)rc); -+ if (rc <= (HINSTANCE)32) PyWin_SetAPIError("ShellExecute", (INT_PTR)rc); - else ret = PyWinLong_FromVoidPtr(rc); +@@ -4454,7 +4454,7 @@ static PyObject *PyShellExecute(PyObject *self, PyObject *args) + PyW32_END_ALLOW_THREADS; + // @pyseeapi ShellExecute + if (rc <= (HINSTANCE)32) +- PyWin_SetAPIError("ShellExecute", (int)rc); ++ PyWin_SetAPIError("ShellExecute", (INT_PTR)rc); + else + ret = PyWinLong_FromVoidPtr(rc); } - PyWinObject_FreeTCHAR(op); -@@ -5277,8 +5277,8 @@ static PyObject *PyApply(PyObject *self, PyObject *args) +@@ -5464,8 +5464,8 @@ static PyObject *PyApply(PyObject *self, PyObject *args) } PyThreadState *stateSave = PyThreadState_Swap(NULL); PyThreadState_Swap(stateSave); @@ -432,27 +401,11 @@ index 9ffe4b0..c89bef6 100644 ADD_CONSTANT(CF_TEXT); ADD_CONSTANT(CF_BITMAP); ADD_CONSTANT(CF_METAFILEPICT); -diff --git a/win32/src/win32consolemodule.cpp b/win32/src/win32consolemodule.cpp -index daae981..df0ba07 100644 ---- a/win32/src/win32consolemodule.cpp -+++ b/win32/src/win32consolemodule.cpp -@@ -1,4 +1,5 @@ - // @doc -+#undef _WIN32_WINNT - #define _WIN32_WINNT 0x501 - #include "PyWinTypes.h" - #include "PyWinObjects.h" diff --git a/win32/src/win32credmodule.cpp b/win32/src/win32credmodule.cpp -index 2825c22..084b85d 100644 +index 4c8567f..475dd1a 100644 --- a/win32/src/win32credmodule.cpp +++ b/win32/src/win32credmodule.cpp -@@ -1,4 +1,5 @@ - // @doc -+#undef _WIN32_WINNT - #define _WIN32_WINNT 0x501 // Credentials functions only available on WinXP - #include "PyWinTypes.h" - #include "PyWinObjects.h" -@@ -1175,8 +1176,10 @@ PYWIN_MODULE_INIT_FUNC(win32cred) +@@ -1174,8 +1174,10 @@ PYWIN_MODULE_INIT_FUNC(win32cred) PyModule_AddIntConstant(module, "CRED_TYPE_DOMAIN_PASSWORD", CRED_TYPE_DOMAIN_PASSWORD); PyModule_AddIntConstant(module, "CRED_TYPE_DOMAIN_CERTIFICATE", CRED_TYPE_DOMAIN_CERTIFICATE); PyModule_AddIntConstant(module, "CRED_TYPE_DOMAIN_VISIBLE_PASSWORD", CRED_TYPE_DOMAIN_VISIBLE_PASSWORD); @@ -463,7 +416,7 @@ index 2825c22..084b85d 100644 PyModule_AddIntConstant(module, "CRED_TYPE_MAXIMUM", CRED_TYPE_MAXIMUM); PyModule_AddIntConstant(module, "CRED_TYPE_MAXIMUM_EX", CRED_TYPE_MAXIMUM + 1000); // credential flags -@@ -1238,7 +1241,9 @@ PYWIN_MODULE_INIT_FUNC(win32cred) +@@ -1237,7 +1239,9 @@ PYWIN_MODULE_INIT_FUNC(win32cred) PyModule_AddIntConstant(module, "CREDUI_MAX_USERNAME_LENGTH", CREDUI_MAX_USERNAME_LENGTH); PyModule_AddIntConstant(module, "CREDUI_MAX_PASSWORD_LENGTH", CREDUI_MAX_PASSWORD_LENGTH); @@ -474,16 +427,10 @@ index 2825c22..084b85d 100644 PYWIN_MODULE_INIT_RETURN_SUCCESS; } diff --git a/win32/src/win32crypt/win32cryptmodule.cpp b/win32/src/win32crypt/win32cryptmodule.cpp -index 3f801fc..2a1c637 100644 +index 102422f..a576ef3 100644 --- a/win32/src/win32crypt/win32cryptmodule.cpp +++ b/win32/src/win32crypt/win32cryptmodule.cpp -@@ -1,4 +1,5 @@ - // @doc -+#undef _WIN32_WINNT - #define _WIN32_WINNT 0x502 - #include "win32crypt.h" - -@@ -583,6 +584,7 @@ static PyObject *PyCertOpenStore(PyObject *self, PyObject *args, PyObject *kwarg +@@ -582,6 +582,7 @@ static PyObject *PyCertOpenStore(PyObject *self, PyObject *args, PyObject *kwarg pvPara = (void *)&cssrp; } else { @@ -491,7 +438,7 @@ index 3f801fc..2a1c637 100644 switch ((ULONG_PTR)StoreProvider) { case CERT_STORE_PROV_PHYSICAL: case CERT_STORE_PROV_FILENAME: -@@ -624,6 +626,41 @@ static PyObject *PyCertOpenStore(PyObject *self, PyObject *args, PyObject *kwarg +@@ -623,6 +624,41 @@ static PyObject *PyCertOpenStore(PyObject *self, PyObject *args, PyObject *kwarg return NULL; } } @@ -534,7 +481,7 @@ index 3f801fc..2a1c637 100644 Py_BEGIN_ALLOW_THREADS hcertstore = CertOpenStore(StoreProvider, dwEncodingType, hcryptprov, dwFlags, pvPara); diff --git a/win32/src/win32dynamicdialog.cpp b/win32/src/win32dynamicdialog.cpp -index bef6473..9e159a3 100644 +index 2b1992d..fecf525 100644 --- a/win32/src/win32dynamicdialog.cpp +++ b/win32/src/win32dynamicdialog.cpp @@ -31,14 +31,14 @@ @@ -545,7 +492,7 @@ index bef6473..9e159a3 100644 +#include "Python.h" #undef PyHANDLE #include - #include "commctrl.h" + #include "CommCtrl.h" #include "windowsx.h" // For edit control hacks. -#include "pywintypes.h" @@ -630,20 +577,10 @@ index 2ed1fab..992b1b6 100644 Py_BEGIN_ALLOW_THREADS $function diff --git a/win32/src/win32evtlog.i b/win32/src/win32evtlog.i -index 111b0a3..dd865f2 100644 +index 111b0a3..1ef9a32 100644 --- a/win32/src/win32evtlog.i +++ b/win32/src/win32evtlog.i -@@ -4,9 +4,18 @@ - // The Evt* functions are only available on Vista and later. Attempting to call - // them on XP will result in the process exiting, rather than a python exception. - -+%{ -+#ifndef _MSC_VER -+#undef _WIN32_WINNT -+#define _WIN32_WINNT 0x0600 // for EVT_SUBSCRIBE_NOTIFY_ACTION -+#endif -+%} -+ +@@ -7,6 +7,8 @@ %include "typemaps.i" %include "pywin32.i" @@ -653,10 +590,10 @@ index 111b0a3..dd865f2 100644 #include diff --git a/win32/src/win32file.i b/win32/src/win32file.i -index 5b1b010..4f05d0b 100644 +index e9c57aa..82a43ad 100644 --- a/win32/src/win32file.i +++ b/win32/src/win32file.i -@@ -47,7 +47,7 @@ +@@ -42,7 +42,7 @@ #include "winsock2.h" #include "mswsock.h" @@ -665,7 +602,7 @@ index 5b1b010..4f05d0b 100644 #include "winbase.h" #include "assert.h" #include -@@ -71,6 +71,9 @@ +@@ -62,6 +62,9 @@ %include "typemaps.i" %include "pywin32.i" @@ -675,7 +612,7 @@ index 5b1b010..4f05d0b 100644 %{ #include "datetime.h" // python's datetime header. -@@ -697,8 +700,8 @@ static PyObject *PySetFileTime (PyObject *self, PyObject *args, PyObject *kwargs +@@ -688,8 +691,8 @@ static PyObject *PySetFileTime (PyObject *self, PyObject *args, PyObject *kwargs &obHandle, &obCreationTime, &obLastAccessTime, &obLastWriteTime, &UTCTimes)) return NULL; @@ -686,7 +623,7 @@ index 5b1b010..4f05d0b 100644 if (obCreationTime != Py_None){ if (!PyWinObject_AsFILETIME(obCreationTime, &FileTime)) return NULL; -@@ -5297,7 +5300,7 @@ static PyObject *py_GetFullPathName(PyObject *self, PyObject *args, PyObject *kw +@@ -5283,7 +5286,7 @@ static PyObject *py_GetFullPathName(PyObject *self, PyObject *args, PyObject *kw PyErr_Clear(); char *cpathin; @@ -736,18 +673,10 @@ index bcd2d36..cb2eda0 100644 } diff --git a/win32/src/win32gui.i b/win32/src/win32gui.i -index 518e84c..ecc30ef 100644 +index 3890202..62d2fa4 100644 --- a/win32/src/win32gui.i +++ b/win32/src/win32gui.i -@@ -4,15 +4,28 @@ - %module win32gui // A module which provides an interface to the native win32 GUI API. - - %{ -+#ifndef _WIN32_WINNT - #define _WIN32_WINNT 0x0501 -+#endif - - %} +@@ -6,9 +6,20 @@ %include "typemaps.i" %include "pywintypes.i" @@ -767,9 +696,9 @@ index 518e84c..ecc30ef 100644 -#include "pywinobjects.h" +#include "PyWinObjects.h" #include "winuser.h" - #include "commctrl.h" + #include "CommCtrl.h" #include "windowsx.h" // For edit control hacks. -@@ -336,14 +349,14 @@ typedef float HDC, HCURSOR, HINSTANCE, HMENU, HICON, HGDIOBJ, HIMAGELIST, HACCEL +@@ -326,14 +337,14 @@ typedef float HDC, HCURSOR, HINSTANCE, HMENU, HICON, HGDIOBJ, HIMAGELIST, HACCEL } %apply COLORREF {long}; @@ -786,7 +715,7 @@ index 518e84c..ecc30ef 100644 %typemap(python,in) NULL_ONLY { if ($source != Py_None) { -@@ -1711,9 +1724,9 @@ static PyObject *PyGetBufferAddressAndLen(PyObject *self, PyObject *args) +@@ -1701,9 +1712,9 @@ static PyObject *PyGetBufferAddressAndLen(PyObject *self, PyObject *args) %native (PyGetBufferAddressAndLen) PyGetBufferAddressAndLen; @@ -799,7 +728,7 @@ index 518e84c..ecc30ef 100644 %typemap(python,arginit) STRING_OR_ATOM_CW, RESOURCE_ID, RESOURCE_ID_NULLOK{ $target=NULL; -@@ -1776,12 +1789,12 @@ PyObject *PyFlashWindowEx(PyObject *self, PyObject *args) +@@ -1766,12 +1777,12 @@ PyObject *PyFlashWindowEx(PyObject *self, PyObject *args) return NULL; // not on NT HMODULE hmod = GetModuleHandle(_T("user32")); @@ -818,7 +747,7 @@ index 518e84c..ecc30ef 100644 Py_BEGIN_ALLOW_THREADS rc = (*pfnFW)(&f); Py_END_ALLOW_THREADS -@@ -7521,13 +7534,13 @@ PyObject *PyRegisterDeviceNotification(PyObject *self, PyObject *args) +@@ -7511,13 +7522,13 @@ PyObject *PyRegisterDeviceNotification(PyObject *self, PyObject *args) "structure says it has %d bytes, but %d was provided", (int)struct_bytes, (int)pybuf.len()); // @pyseeapi RegisterDeviceNotification @@ -837,10 +766,10 @@ index 518e84c..ecc30ef 100644 %} %native(RegisterDeviceNotification) PyRegisterDeviceNotification; diff --git a/win32/src/win32helpmodule.cpp b/win32/src/win32helpmodule.cpp -index 9bf9bf7..ee48fdd 100644 +index ce473ef..5526578 100644 --- a/win32/src/win32helpmodule.cpp +++ b/win32/src/win32helpmodule.cpp -@@ -2544,13 +2544,11 @@ data tuple items must be integers"); +@@ -2539,13 +2539,11 @@ data tuple items must be integers"); // Module constants: #define ADD_CONSTANT(tok) \ @@ -855,7 +784,7 @@ index 9bf9bf7..ee48fdd 100644 #ifdef _DEBUG int debug = 1; #else -@@ -3091,7 +3089,7 @@ int AddConstants(PyObject *module) +@@ -3086,7 +3084,7 @@ int AddConstants(PyObject *module) // @const win32help|HH_GPROPID_CONTENT_LANGUAGE|long: LandId for desired // content. @@ -893,29 +822,26 @@ index 651bdcf..9ac5406 100644 static PyObject *obHandleMap = NULL; diff --git a/win32/src/win32net/win32netmisc.cpp b/win32/src/win32net/win32netmisc.cpp -index 025665e..7277690 100644 +index aa1b5da..9127be8 100644 --- a/win32/src/win32net/win32netmisc.cpp +++ b/win32/src/win32net/win32netmisc.cpp -@@ -1355,7 +1355,8 @@ PyObject *PyNetServerComputerNameDel(PyObject *self, PyObject *args) - - #if WINVER >= 0x0500 +@@ -1353,7 +1353,7 @@ PyObject *PyNetServerComputerNameDel(PyObject *self, PyObject *args) + return ret; + } -extern "C" NetValidateNamefunc pfnNetValidateName = NULL; -+extern "C" NetValidateNamefunc pfnNetValidateName; -+NetValidateNamefunc pfnNetValidateName = NULL; ++extern "C" { NetValidateNamefunc pfnNetValidateName = NULL; } // @pymethod |win32net|NetValidateName|Checks that domain/machine/workgroup name is valid for given context // @rdesc Returns none if valid, exception if not // @comm If Account and Password aren't passed, current logon credentials are used -@@ -1398,8 +1399,10 @@ PyObject *PyNetValidateName(PyObject *self, PyObject *args) +@@ -1396,8 +1396,8 @@ PyObject *PyNetValidateName(PyObject *self, PyObject *args) return ret; } -extern "C" NetValidatePasswordPolicyfunc pfnNetValidatePasswordPolicy = NULL; -extern "C" NetValidatePasswordPolicyFreefunc pfnNetValidatePasswordPolicyFree = NULL; -+extern "C" NetValidatePasswordPolicyfunc pfnNetValidatePasswordPolicy; -+NetValidatePasswordPolicyfunc pfnNetValidatePasswordPolicy = NULL; -+extern "C" NetValidatePasswordPolicyFreefunc pfnNetValidatePasswordPolicyFree; -+NetValidatePasswordPolicyFreefunc pfnNetValidatePasswordPolicyFree = NULL; ++extern "C" { NetValidatePasswordPolicyfunc pfnNetValidatePasswordPolicy = NULL; } ++extern "C" { NetValidatePasswordPolicyFreefunc pfnNetValidatePasswordPolicyFree = NULL; } static void PyObject_CleanupAUTH_INPUT(NET_VALIDATE_AUTHENTICATION_INPUT_ARG *p) { @@ -933,7 +859,7 @@ index 8d3c7d7..1b08a04 100644 } diff --git a/win32/src/win32process.i b/win32/src/win32process.i -index 331ed0f..6689827 100644 +index c938f45..20f70c5 100644 --- a/win32/src/win32process.i +++ b/win32/src/win32process.i @@ -1598,6 +1598,7 @@ PyObject *PyIsWow64Process(PyObject *self, PyObject *args) @@ -945,19 +871,19 @@ index 331ed0f..6689827 100644 // @pyswig long|VirtualAllocEx| LONG_VOIDPTR VirtualAllocEx( diff --git a/win32/src/win32rasmodule.cpp b/win32/src/win32rasmodule.cpp -index 3ed8c33..9aeac86 100644 +index 2213d20..d4bdb88 100644 --- a/win32/src/win32rasmodule.cpp +++ b/win32/src/win32rasmodule.cpp -@@ -15,7 +15,7 @@ generates Windows .hlp files. - #define WINVER 0x500 - #endif +@@ -11,7 +11,7 @@ generates Windows .hlp files. + + ******************************************************************/ -#include "pywintypes.h" +#include "PyWinTypes.h" #include "ras.h" #include "raserror.h" -@@ -549,7 +549,7 @@ static PyObject *PyRasDial(PyObject *self, PyObject *args) +@@ -541,7 +541,7 @@ static PyObject *PyRasDial(PyObject *self, PyObject *args) pNotification = NULL; } else if (PyCallable_Check(obCallback)) { @@ -966,7 +892,7 @@ index 3ed8c33..9aeac86 100644 notType = 1; } else if (PyLong_Check(obCallback)) { -@@ -782,15 +782,15 @@ static PyObject *PyRasGetEntryDialParams(PyObject *self, PyObject *args) +@@ -774,15 +774,15 @@ static PyObject *PyRasGetEntryDialParams(PyObject *self, PyObject *args) // @pymethod string|win32ras|GetErrorString|Returns an error string for a RAS error code. static PyObject *PyRasGetErrorString(PyObject *self, PyObject *args) { @@ -985,7 +911,7 @@ index 3ed8c33..9aeac86 100644 return ReturnRasError("RasGetErrorString"); return PyWinObject_FromTCHAR(buf); } -@@ -798,14 +798,14 @@ static PyObject *PyRasGetErrorString(PyObject *self, PyObject *args) +@@ -790,14 +790,14 @@ static PyObject *PyRasGetErrorString(PyObject *self, PyObject *args) // @pymethod |win32ras|HangUp|Terminates a remote access session. static PyObject *PyRasHangUp(PyObject *self, PyObject *args) { @@ -1002,7 +928,7 @@ index 3ed8c33..9aeac86 100644 return ReturnRasError("RasHangup"); Py_INCREF(Py_None); return Py_None; -@@ -818,7 +818,7 @@ static PyObject *PyRasIsHandleValid(PyObject *self, PyObject *args) +@@ -810,7 +810,7 @@ static PyObject *PyRasIsHandleValid(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "O&:IsHandleValid", PyWinObject_AsHANDLE, &hras)) // @pyparm int|hras||The handle to the RAS connection being checked. return NULL; @@ -1011,7 +937,7 @@ index 3ed8c33..9aeac86 100644 return PyBool_FromLong(bRet); } -@@ -924,7 +924,7 @@ static struct PyMethodDef win32ras_functions[] = { +@@ -916,7 +916,7 @@ static struct PyMethodDef win32ras_functions[] = { {NULL, NULL}}; #define ADD_CONSTANT(tok) \ @@ -1020,7 +946,7 @@ index 3ed8c33..9aeac86 100644 return rc #define ADD_ENUM(parta, partb) \ if (rc = PyModule_AddIntConstant(module, #parta "_" #partb, parta::partb)) \ -@@ -935,7 +935,6 @@ static struct PyMethodDef win32ras_functions[] = { +@@ -927,7 +927,6 @@ static struct PyMethodDef win32ras_functions[] = { static int AddConstants(PyObject *module) { @@ -1029,18 +955,10 @@ index 3ed8c33..9aeac86 100644 ADD_CONSTANT(RASCS_PortOpened); // @const win32ras|RASCS_PortOpened|Constant for RAS state. ADD_CONSTANT(RASCS_ConnectDevice); // @const win32ras|RASCS_ConnectDevice|Constant for RAS state. diff --git a/win32/src/win32security.i b/win32/src/win32security.i -index c614d30..c0de13a 100644 +index ff24c6d..688bd04 100644 --- a/win32/src/win32security.i +++ b/win32/src/win32security.i -@@ -5,6 +5,7 @@ - %module win32security // An interface to the win32 security API's - - %{ -+#undef _WIN32_WINNT - #define _WIN32_WINNT 0x0600 // Vista! - %} - -@@ -76,7 +77,7 @@ static IsTokenRestrictedfunc pfnIsTokenRestricted = NULL; +@@ -72,7 +72,7 @@ static IsTokenRestrictedfunc pfnIsTokenRestricted = NULL; typedef PSecurityFunctionTableW (SEC_ENTRY *InitSecurityInterfacefunc)(void); static InitSecurityInterfacefunc pfnInitSecurityInterface=NULL; @@ -1049,7 +967,7 @@ index c614d30..c0de13a 100644 typedef BOOL (WINAPI *TranslateNamefunc)(LPCTSTR, EXTENDED_NAME_FORMAT, EXTENDED_NAME_FORMAT, LPTSTR, PULONG); static TranslateNamefunc pfnTranslateName=NULL; -@@ -89,20 +90,20 @@ static LogonUserExExfunc pfnLogonUserExEx = NULL; +@@ -85,20 +85,20 @@ static LogonUserExExfunc pfnLogonUserExEx = NULL; // function pointers used in win32security_sspi.cpp and win32security_ds.cpp @@ -1084,7 +1002,7 @@ index c614d30..c0de13a 100644 static HMODULE advapi32_dll=NULL; static HMODULE secur32_dll =NULL; -@@ -114,8 +115,8 @@ static HMODULE netapi32_dll=NULL; +@@ -110,8 +110,8 @@ static HMODULE netapi32_dll=NULL; HMODULE loadmodule(WCHAR *dllname) { HMODULE hmodule = GetModuleHandle(dllname); @@ -1095,7 +1013,7 @@ index c614d30..c0de13a 100644 return hmodule; } -@@ -3337,12 +3338,14 @@ static PyObject *PyCreateRestrictedToken(PyObject *self, PyObject *args, PyObjec +@@ -3312,12 +3312,14 @@ static PyObject *PyCreateRestrictedToken(PyObject *self, PyObject *args, PyObjec if (PyWinObject_AsHANDLE(obExistingTokenHandle, &ExistingTokenHandle)) if (PyWinObject_AsSID_AND_ATTRIBUTESArray(obSidsToDisable, &SidsToDisable, &DisableSidCount)) if (PyWinObject_AsSID_AND_ATTRIBUTESArray(obSidsToRestrict, &SidsToRestrict, &RestrictedSidCount)) @@ -1114,20 +1032,10 @@ index c614d30..c0de13a 100644 free(SidsToDisable); if (PrivilegesToDelete!=NULL) diff --git a/win32/src/win32service.i b/win32/src/win32service.i -index 1150dff..c43ad17 100644 +index b91a0e1..7dfb479 100644 --- a/win32/src/win32service.i +++ b/win32/src/win32service.i -@@ -3,9 +3,18 @@ - %module win32service // An interface to the Windows NT Service API - - -+%{ -+#ifndef _MSC_VER -+#undef _WIN32_WINNT -+#define _WIN32_WINNT 0x0600 // for SERVICE_* -+#endif -+%} -+ +@@ -6,6 +6,8 @@ %include "typemaps.i" %include "pywin32.i" @@ -1136,18 +1044,6 @@ index 1150dff..c43ad17 100644 %{ #undef PyHANDLE #include "PyWinObjects.h" -diff --git a/win32/src/win32tsmodule.cpp b/win32/src/win32tsmodule.cpp -index c4156f9..c5f8e37 100644 ---- a/win32/src/win32tsmodule.cpp -+++ b/win32/src/win32tsmodule.cpp -@@ -1,5 +1,7 @@ - // @doc -+#ifndef _WIN32_WINNT - #define _WIN32_WINNT 0x501 -+#endif - #include "PyWinTypes.h" - #include "PyWinObjects.h" - #include "structmember.h" diff --git a/win32/src/win32wnet/PyNCB.cpp b/win32/src/win32wnet/PyNCB.cpp index e2290be..ee73e80 100644 --- a/win32/src/win32wnet/PyNCB.cpp diff --git a/mingw-w64-python-pywin32/006-mapi-headers-fix.patch b/mingw-w64-python-pywin32/006-mapi-headers-fix.patch index 12a28a38c9..25d42d8b24 100644 --- a/mingw-w64-python-pywin32/006-mapi-headers-fix.patch +++ b/mingw-w64-python-pywin32/006-mapi-headers-fix.patch @@ -1,20 +1,20 @@ -diff --git a/com/win32comext/mapi/src/mapi_headers/EdkMdb.h b/com/win32comext/mapi/src/mapi_headers/EdkMdb.h -index 6de3859..39ac0c3 100644 ---- a/com/win32comext/mapi/src/mapi_headers/EdkMdb.h -+++ b/com/win32comext/mapi/src/mapi_headers/EdkMdb.h -@@ -76,7 +76,7 @@ - #define PR_PROFILE_RECONNECT_INTERVAL PROP_TAG(PT_LONG, pidProfileMin + 0x1a) // dup tag of PR_USER_NAME - #define PR_PROFILE_SERVER_VERSION PROP_TAG(PT_LONG, pidProfileMin + 0x1b) +diff --git a/com/win32comext/mapi/src/MAPIStubLibrary/include/EdkMdb.h b/com/win32comext/mapi/src/MAPIStubLibrary/include/EdkMdb.h +index 3f7d164..3390d9d 100644 +--- a/com/win32comext/mapi/src/MAPIStubLibrary/include/EdkMdb.h ++++ b/com/win32comext/mapi/src/MAPIStubLibrary/include/EdkMdb.h +@@ -87,7 +87,7 @@ + #define PR_PROFILE_RECONNECT_INTERVAL PROP_TAG( PT_LONG, pidProfileMin+0x1a) // dup tag of PR_USER_NAME 0x661a + #define PR_PROFILE_SERVER_VERSION PROP_TAG( PT_LONG, pidProfileMin+0x1b) -/* SE 233155 - MarkH: EMSABP DCR /* +/* SE 233155 - MarkH: EMSABP DCR */ /* Properties in the abp section - I got these values from AlecDun (Outlook team) */ - #define PR_PROFILE_ABP_ALLOW_RECONNECT PROP_TAG(PT_LONG, pidProfileMin + 0x39) - #define PR_PROFILE_ABP_MTHREAD_TIMEOUT_SECS PROP_TAG(PT_LONG, pidProfileMin + 0x3A) -diff --git a/com/win32comext/mapi/src/mapi_headers/MAPI.h b/com/win32comext/mapi/src/mapi_headers/MAPI.h -index 038b58f..dbc0e40 100644 ---- a/com/win32comext/mapi/src/mapi_headers/MAPI.h -+++ b/com/win32comext/mapi/src/mapi_headers/MAPI.h + #define PR_PROFILE_SERVER_FULL_VERSION PROP_TAG( PT_BINARY, pidProfileMin+0x3b) + +diff --git a/com/win32comext/mapi/src/MAPIStubLibrary/include/MAPI.h b/com/win32comext/mapi/src/MAPIStubLibrary/include/MAPI.h +index 09b2e4b..181cdd7 100644 +--- a/com/win32comext/mapi/src/MAPIStubLibrary/include/MAPI.h ++++ b/com/win32comext/mapi/src/MAPIStubLibrary/include/MAPI.h @@ -20,6 +20,13 @@ #pragma once #endif @@ -29,7 +29,7 @@ index 038b58f..dbc0e40 100644 /* * Types. */ -@@ -160,7 +167,7 @@ typedef struct +@@ -170,7 +177,7 @@ typedef struct /* #define MAPI_LOGON_UI 0x00000001 Display logon UI */ /* #define MAPI_NEW_SESSION 0x00000002 Don't use shared session */ @@ -38,20 +38,10 @@ index 038b58f..dbc0e40 100644 /* MAPIAddress() flags. */ -diff --git a/com/win32comext/mapi/src/mapi_headers/MAPICode.h b/com/win32comext/mapi/src/mapi_headers/MAPICode.h -index 467023a..a27609d 100644 ---- a/com/win32comext/mapi/src/mapi_headers/MAPICode.h -+++ b/com/win32comext/mapi/src/mapi_headers/MAPICode.h -@@ -216,5 +216,4 @@ - #endif - - #endif /* MAPICODE_H */ -- - -diff --git a/com/win32comext/mapi/src/mapi_headers/MAPIDefS.h b/com/win32comext/mapi/src/mapi_headers/MAPIDefS.h -index 159935b..a44ba3c 100644 ---- a/com/win32comext/mapi/src/mapi_headers/MAPIDefS.h -+++ b/com/win32comext/mapi/src/mapi_headers/MAPIDefS.h +diff --git a/com/win32comext/mapi/src/MAPIStubLibrary/include/MAPIDefS.h b/com/win32comext/mapi/src/MAPIStubLibrary/include/MAPIDefS.h +index 9e83e2d..85791b2 100644 +--- a/com/win32comext/mapi/src/MAPIStubLibrary/include/MAPIDefS.h ++++ b/com/win32comext/mapi/src/MAPIStubLibrary/include/MAPIDefS.h @@ -51,6 +51,12 @@ #include #endif @@ -64,40 +54,14 @@ index 159935b..a44ba3c 100644 + /* Array dimension for structures with variable-sized arrays at the end. */ - #ifndef MAPI_DIM -@@ -2728,5 +2734,4 @@ DECLARE_MAPI_INTERFACE_(IMAPIProviderShutdown, IUnknown) - #endif - - #endif /* MAPIDEFS_H */ -- - -diff --git a/com/win32comext/mapi/src/mapi_headers/MAPIForm.h b/com/win32comext/mapi/src/mapi_headers/MAPIForm.h -index cfdd84a..02b9669 100644 ---- a/com/win32comext/mapi/src/mapi_headers/MAPIForm.h -+++ b/com/win32comext/mapi/src/mapi_headers/MAPIForm.h -@@ -631,5 +631,4 @@ DECLARE_MAPI_INTERFACE_(IMAPIFormFactory, IUnknown) - - #endif /* MAPIFORM_H */ - -- - -diff --git a/com/win32comext/mapi/src/mapi_headers/MAPIWin.h b/com/win32comext/mapi/src/mapi_headers/MAPIWin.h -index cc9ef14..9e913e9 100644 ---- a/com/win32comext/mapi/src/mapi_headers/MAPIWin.h -+++ b/com/win32comext/mapi/src/mapi_headers/MAPIWin.h + #pragma warning(push) +diff --git a/com/win32comext/mapi/src/MAPIStubLibrary/include/MAPIWin.h b/com/win32comext/mapi/src/MAPIStubLibrary/include/MAPIWin.h +index cbf9c93..23f3bbc 100644 +--- a/com/win32comext/mapi/src/MAPIStubLibrary/include/MAPIWin.h ++++ b/com/win32comext/mapi/src/MAPIStubLibrary/include/MAPIWin.h @@ -272,5 +272,4 @@ BOOL WINAPI IsBadBoundedStringPtr(const void FAR* lpsz, UINT cchMax); #endif #endif /* __MAPIWIN_H__ */ - -diff --git a/com/win32comext/mapi/src/mapi_headers/MSPST.h b/com/win32comext/mapi/src/mapi_headers/MSPST.h -index dae5b31..9ca667d 100644 ---- a/com/win32comext/mapi/src/mapi_headers/MSPST.h -+++ b/com/win32comext/mapi/src/mapi_headers/MSPST.h -@@ -97,5 +97,4 @@ - 0xd9, 0x6e, 0x00, 0x00 } - - #endif /* _MSPST_H_ */ -- - diff --git a/mingw-w64-python-pywin32/PKGBUILD b/mingw-w64-python-pywin32/PKGBUILD index a949455edc..198f21df1a 100644 --- a/mingw-w64-python-pywin32/PKGBUILD +++ b/mingw-w64-python-pywin32/PKGBUILD @@ -6,8 +6,8 @@ _realname=pywin32 pkgbase=mingw-w64-python-${_realname} pkgname=${MINGW_PACKAGE_PREFIX}-python-${_realname} -pkgver=308 -pkgrel=3 +pkgver=310 +pkgrel=1 pkgdesc='Python for Windows Extensions (mingw-w64)' arch=('any') mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64') @@ -30,13 +30,13 @@ source=(https://github.com/mhammond/pywin32/archive/b${pkgver}/${_realname}-${pk 004-isapi-fix.patch 005-swig-fix.patch 006-mapi-headers-fix.patch) -sha256sums=('8aa09d39739764bec2378cfbd45940264c8b7f5a24caa17f04a01f7b750799ce' - '6cf1981d8484b9874891b582e3c71ba9409d6c180a6f4e7fd84ec3307bfd746e' - 'af050c9c1e9c92c5ed3be73b606a4b931c78d6bb01175ecf5db503ba688d64ba' - '0e4aadf7b6dec6baf1c347664396787110ad756d53720f2c1bb0eba48c733169' +sha256sums=('b3e07c8c1383c0d6e75a360ed5d0d85edce30e6d7b67e9a070f0056156e1c5a3' + '7e7a8f53a8440d877bade76be3bc9ee15516dfdffc30d4795bae8e595bbb5fd7' + 'dbb2204aa69ab07fbd3cfe9afe0262c1d59f815af4dfc4b7a6a7f6f242144260' + '5317c09132110f710cca730e321b313f2726ae35f8a22b76af4329f552f32026' '0d303188a4a34759e4be1c2e11d68ba33f40edaf3056656618490c983d932dff' 'cfe20ab0034b7f872d96363ea85261430f6a64ae403831978bd433c20415566c' - '14c7c6db61fcef7fa799770874bc4cad464fb8c08495a56c9cf5beb795ba522b') + 'c8ba874b0b7b960b6bc4aba251e4a55edf39d92982ab8e038804975f57eb305c') apply_patch_with_msg() { for _patch in "$@" @@ -61,14 +61,14 @@ prepare() { build() { cp -r "${_realname}-b${pkgver}" "python-build-${MSYSTEM}" && cd "python-build-${MSYSTEM}" - ${MINGW_PREFIX}/bin/python -m build --wheel --skip-dependency-check --no-isolation + python -m build --wheel --skip-dependency-check --no-isolation } package() { cd "python-build-${MSYSTEM}" MSYS2_ARG_CONV_EXCL="--prefix=" \ - ${MINGW_PREFIX}/bin/python -m installer --prefix=${MINGW_PREFIX} \ + python -m installer --prefix=${MINGW_PREFIX} \ --destdir="${pkgdir}" dist/*.whl install -Dm644 "win32/License.txt" "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE.txt"