diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h index 00a4f6009186af9..1f7e414b2dfe48f 100644 --- a/Modules/clinic/posixmodule.c.h +++ b/Modules/clinic/posixmodule.c.h @@ -1851,7 +1851,7 @@ os_listdrives(PyObject *module, PyObject *Py_UNUSED(ignored)) #endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)) */ -#if (defined(MS_WINDOWS_APP) || defined(MS_WINDOWS_SYSTEM)) +#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)) PyDoc_STRVAR(os_listvolumes__doc__, "listvolumes($module, /)\n" @@ -1873,7 +1873,7 @@ os_listvolumes(PyObject *module, PyObject *Py_UNUSED(ignored)) return os_listvolumes_impl(module); } -#endif /* (defined(MS_WINDOWS_APP) || defined(MS_WINDOWS_SYSTEM)) */ +#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)) */ #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)) @@ -13733,4 +13733,4 @@ os__emscripten_log(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py #ifndef OS__EMSCRIPTEN_LOG_METHODDEF #define OS__EMSCRIPTEN_LOG_METHODDEF #endif /* !defined(OS__EMSCRIPTEN_LOG_METHODDEF) */ -/*[clinic end generated code: output=250ea2e34fdd133f input=a9049054013a1b77]*/ +/*[clinic end generated code: output=d81494ceb6ce44ed input=a9049054013a1b77]*/ diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 57db175336702e2..8167f7fbacff5bd 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -5197,7 +5197,7 @@ os_listdrives_impl(PyObject *module) #endif /* MS_WINDOWS_DESKTOP || MS_WINDOWS_SYSTEM */ -#if defined(MS_WINDOWS_APP) || defined(MS_WINDOWS_SYSTEM) +#if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) /*[clinic input] os.listvolumes @@ -5260,7 +5260,7 @@ os_listvolumes_impl(PyObject *module) return result; } -#endif /* MS_WINDOWS_APP || MS_WINDOWS_SYSTEM */ +#endif /* MS_WINDOWS_DESKTOP || MS_WINDOWS_SYSTEM */ #if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) @@ -9933,6 +9933,7 @@ os_setpgrp_impl(PyObject *module) #include #include +#ifdef MS_WINDOWS_DESKTOP // The structure definition in winternl.h may be incomplete. // This structure is the full version from the MSDN documentation. typedef struct _PROCESS_BASIC_INFORMATION_FULL { @@ -10005,6 +10006,7 @@ win32_getppid_fast(void) cached_ppid = (ULONG) basic_information.InheritedFromUniqueProcessId; return cached_ppid; } +#endif // MS_WINDOWS_DESKTOP static PyObject* win32_getppid(void) @@ -10013,12 +10015,13 @@ win32_getppid(void) PyObject* result = NULL; HANDLE process = GetCurrentProcess(); HPSS snapshot = NULL; - ULONG pid; - pid = win32_getppid_fast(); +#ifdef MS_WINDOWS_DESKTOP + ULONG pid = win32_getppid_fast(); if (pid != 0) { return PyLong_FromUnsignedLong(pid); } +#endif // If failure occurs in win32_getppid_fast(), fall back to using the PSS API. @@ -15227,6 +15230,7 @@ os_abort_impl(PyObject *module) } #ifdef MS_WINDOWS +#ifdef MS_WINDOWS_DESKTOP /* Grab ShellExecute dynamically from shell32 */ static int has_ShellExecute = -1; static HINSTANCE (CALLBACK *Py_ShellExecuteW)(HWND, LPCWSTR, LPCWSTR, LPCWSTR, @@ -15255,6 +15259,7 @@ check_ShellExecute(void) } return has_ShellExecute; } +#endif // MS_WINDOWS_DESKTOP /*[clinic input] @@ -15299,6 +15304,9 @@ os_startfile_impl(PyObject *module, path_t *filepath, path_t *cwd, int show_cmd) /*[clinic end generated code: output=1c6f2f3340e31ffa input=8248997b80669622]*/ { +#if defined(MS_WINDOWS_APP) && !defined(MS_WINDOWS_DESKTOP) + return PyErr_Format(PyExc_NotImplementedError, "startfile not available on UWP"); +#else HINSTANCE rc; if(!check_ShellExecute()) { @@ -15327,6 +15335,7 @@ os_startfile_impl(PyObject *module, path_t *filepath, return NULL; } Py_RETURN_NONE; +#endif } #endif /* MS_WINDOWS */