summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_fileutils.h
diff options
context:
space:
mode:
authorMax Bachmann <oss@maxbachmann.de>2023-03-09 21:09:12 (GMT)
committerGitHub <noreply@github.com>2023-03-09 21:09:12 (GMT)
commitc6858d1e7f4cd3184d5ddea4025ad5dfc7596546 (patch)
tree6c5261397eca871567bb29b31cfe02c92f6d3b58 /Include/internal/pycore_fileutils.h
parentca066bdbed85094a9c4d9930823ce3587807db48 (diff)
downloadcpython-c6858d1e7f4cd3184d5ddea4025ad5dfc7596546.zip
cpython-c6858d1e7f4cd3184d5ddea4025ad5dfc7596546.tar.gz
cpython-c6858d1e7f4cd3184d5ddea4025ad5dfc7596546.tar.bz2
gh-102255: Improve build support for Windows API partitions (GH-102256)
Add `MS_WINDOWS_DESKTOP`, `MS_WINDOWS_APPS`, `MS_WINDOWS_SYSTEM` and `MS_WINDOWS_GAMES` preprocessor definitions to allow switching off functionality missing from particular API partitions ("partitions" are used in Windows to identify overlapping subsets of APIs). CPython only officially supports `MS_WINDOWS_DESKTOP` and `MS_WINDOWS_SYSTEM` (APPS is included by normal desktop builds, but APPS without DESKTOP is not covered). Other configurations are a convenience for people building their own runtimes. `MS_WINDOWS_GAMES` is for the Xbox subset of the Windows API, which is also available on client OS, but is restricted compared to `MS_WINDOWS_DESKTOP`. These restrictions may change over time, as they relate to the build headers rather than the OS support, and so we assume that Xbox builds will use the latest available version of the GDK.
Diffstat (limited to 'Include/internal/pycore_fileutils.h')
-rw-r--r--Include/internal/pycore_fileutils.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/Include/internal/pycore_fileutils.h b/Include/internal/pycore_fileutils.h
index f8e2bf2..445ac0a 100644
--- a/Include/internal/pycore_fileutils.h
+++ b/Include/internal/pycore_fileutils.h
@@ -251,6 +251,14 @@ extern int _Py_add_relfile(wchar_t *dirname,
extern size_t _Py_find_basename(const wchar_t *filename);
PyAPI_FUNC(wchar_t *) _Py_normpath(wchar_t *path, Py_ssize_t size);
+// The Windows Games API family does not provide these functions
+// so provide our own implementations. Remove them in case they get added
+// to the Games API family
+#if defined(MS_WINDOWS_GAMES) && !defined(MS_WINDOWS_DESKTOP)
+#include <winerror.h>
+
+extern HRESULT PathCchSkipRoot(const wchar_t *pszPath, const wchar_t **ppszRootEnd);
+#endif /* defined(MS_WINDOWS_GAMES) && !defined(MS_WINDOWS_DESKTOP) */
// Macros to protect CRT calls against instant termination when passed an
// invalid parameter (bpo-23524). IPH stands for Invalid Parameter Handler.