Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow ``posixmodule.c`` to build for Windows UWP.
6 changes: 3 additions & 3 deletions Modules/clinic/posixmodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 13 additions & 4 deletions Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -9933,6 +9933,7 @@ os_setpgrp_impl(PyObject *module)
#include <winternl.h>
#include <ProcessSnapshot.h>

#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 {
Expand Down Expand Up @@ -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)
Expand All @@ -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.

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -15255,6 +15259,7 @@ check_ShellExecute(void)
}
return has_ShellExecute;
}
#endif // MS_WINDOWS_DESKTOP


/*[clinic input]
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -15327,6 +15335,7 @@ os_startfile_impl(PyObject *module, path_t *filepath,
return NULL;
}
Py_RETURN_NONE;
#endif
}
#endif /* MS_WINDOWS */

Expand Down
Loading