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 @@
``_winapi`` module: improve UWP compatibility
12 changes: 12 additions & 0 deletions Modules/_winapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,7 @@ gethandlelist(PyObject *mapping, const char *name, Py_ssize_t *size)
return ret;
}

#ifdef MS_WINDOWS_DESKTOP
typedef struct {
LPPROC_THREAD_ATTRIBUTE_LIST attribute_list;
LPHANDLE handle_list;
Expand Down Expand Up @@ -1325,6 +1326,7 @@ getattributelist(PyObject *obj, const char *name, AttributeList *attribute_list)

return ret;
}
#endif

/*[clinic input]
_winapi.CreateProcess
Expand Down Expand Up @@ -1358,6 +1360,9 @@ _winapi_CreateProcess_impl(PyObject *module, const wchar_t *application_name,
PyObject *startup_info)
/*[clinic end generated code: output=a25c8e49ea1d6427 input=42ac293eaea03fc4]*/
{
#ifndef MS_WINDOWS_DESKTOP
return NULL;
#else
PyObject *ret = NULL;
BOOL result;
PROCESS_INFORMATION pi;
Expand Down Expand Up @@ -1439,6 +1444,7 @@ _winapi_CreateProcess_impl(PyObject *module, const wchar_t *application_name,
freeattributelist(&attribute_list);

return ret;
#endif
}

/*[clinic input]
Expand Down Expand Up @@ -2582,7 +2588,9 @@ _winapi_BatchedWaitForMultipleObjects_impl(PyObject *module,
while (--thread_count >= 0) {
HANDLE t = thread_data[thread_count]->thread;
if (t) {
#ifdef MS_WINDOWS_DESKTOP
TerminateThread(t, WAIT_ABANDONED_0);
#endif
CloseHandle(t);
}
PyMem_Free((void *)thread_data[thread_count]);
Expand Down Expand Up @@ -2776,7 +2784,11 @@ static PyObject *
_winapi_GetOEMCP_impl(PyObject *module)
/*[clinic end generated code: output=4def5b07a8be1b3b input=e8caf4353a28e28e]*/
{
#ifndef MS_WINDOWS_DESKTOP
return NULL;
#else
return PyLong_FromUnsignedLong(GetOEMCP());
#endif
}

/*[clinic input]
Expand Down
Loading