Skip to content

Commit

Permalink
Windows 7 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
NulAsh committed May 14, 2021
1 parent 0a7dcbd commit e455eb1
Show file tree
Hide file tree
Showing 12 changed files with 634 additions and 24 deletions.
12 changes: 12 additions & 0 deletions Include/win7compat.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#define STRSAFE_E_INSUFFICIENT_BUFFER ((HRESULT)0x8007007A)
#define PATHCCH_ALLOW_LONG_PATHS 0x01
#define PATHCCH_FORCE_ENABLE_LONG_NAME_PROCESS 0x02
#define PATHCCH_FORCE_DISABLE_LONG_NAME_PROCESS 0x04
#define PATHCCH_DO_NOT_NORMALIZE_SEGMENTS 0x08
#define PATHCCH_ENSURE_IS_EXTENDED_LENGTH_PATH 0x10
#define PATHCCH_ENSURE_TRAILING_SLASH 0x20
#define PATHCCH_MAX_CCH 0x8000

HRESULT WINAPI PathCchCanonicalizeEx(WCHAR *out, SIZE_T size, const WCHAR *in, DWORD flags);
HRESULT WINAPI PathCchCombineEx(WCHAR *out, SIZE_T size, const WCHAR *path1, const WCHAR *path2, DWORD flags);
HRESULT WINAPI PathCchSkipRoot(const WCHAR *path, const WCHAR **root_end);
2 changes: 1 addition & 1 deletion Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
FSCTL_GET_REPARSE_POINT is not exported with WIN32_LEAN_AND_MEAN. */
# include <windows.h>
# include <pathcch.h>
# include "win7compat.h"
#endif

#include "pycore_ceval.h" // _PyEval_ReInitThreads()
Expand Down
2 changes: 1 addition & 1 deletion PC/getpathp.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
#endif

#include <windows.h>
#include <pathcch.h>
#include "win7compat.h"
#include <shlwapi.h>

#ifdef HAVE_SYS_TYPES_H
Expand Down
6 changes: 3 additions & 3 deletions PC/pyconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ WIN32 is still required for the locale module.
#endif /* MS_WIN64 */

/* set the version macros for the windows headers */
/* Python 3.9+ requires Windows 8 or greater */
#define Py_WINVER 0x0602 /* _WIN32_WINNT_WIN8 */
#define Py_NTDDI NTDDI_WIN8
/* Python 3.9+ requires Windows 7 or greater */
#define Py_WINVER 0x0601 /* _WIN32_WINNT_WIN7 */
#define Py_NTDDI NTDDI_WIN7

/* We only set these values when building Python - we don't want to force
these values on extensions, as that will affect the prototypes and
Expand Down
Loading

0 comments on commit e455eb1

Please sign in to comment.