mirror of
https://github.com/python/cpython.git
synced 2024-11-23 09:54:58 +08:00
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.
This commit is contained in:
parent
ca066bdbed
commit
c6858d1e7f
@ -251,6 +251,14 @@ extern int _Py_add_relfile(wchar_t *dirname,
|
|||||||
extern size_t _Py_find_basename(const wchar_t *filename);
|
extern size_t _Py_find_basename(const wchar_t *filename);
|
||||||
PyAPI_FUNC(wchar_t *) _Py_normpath(wchar_t *path, Py_ssize_t size);
|
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
|
// Macros to protect CRT calls against instant termination when passed an
|
||||||
// invalid parameter (bpo-23524). IPH stands for Invalid Parameter Handler.
|
// invalid parameter (bpo-23524). IPH stands for Invalid Parameter Handler.
|
||||||
|
@ -3084,11 +3084,13 @@ class DeviceEncodingTests(unittest.TestCase):
|
|||||||
class PidTests(unittest.TestCase):
|
class PidTests(unittest.TestCase):
|
||||||
@unittest.skipUnless(hasattr(os, 'getppid'), "test needs os.getppid")
|
@unittest.skipUnless(hasattr(os, 'getppid'), "test needs os.getppid")
|
||||||
def test_getppid(self):
|
def test_getppid(self):
|
||||||
p = subprocess.Popen([sys.executable, '-c',
|
p = subprocess.Popen([sys._base_executable, '-c',
|
||||||
'import os; print(os.getppid())'],
|
'import os; print(os.getppid())'],
|
||||||
stdout=subprocess.PIPE)
|
stdout=subprocess.PIPE,
|
||||||
stdout, _ = p.communicate()
|
stderr=subprocess.PIPE)
|
||||||
|
stdout, error = p.communicate()
|
||||||
# We are the parent of our subprocess
|
# We are the parent of our subprocess
|
||||||
|
self.assertEqual(error, b'')
|
||||||
self.assertEqual(int(stdout), os.getpid())
|
self.assertEqual(int(stdout), os.getpid())
|
||||||
|
|
||||||
def check_waitpid(self, code, exitcode, callback=None):
|
def check_waitpid(self, code, exitcode, callback=None):
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
Improve build support for the Xbox. Patch by Max Bachmann.
|
@ -317,7 +317,7 @@ _io_open_impl(PyObject *module, PyObject *file, const char *mode,
|
|||||||
_PyIO_State *state = get_io_state(module);
|
_PyIO_State *state = get_io_state(module);
|
||||||
{
|
{
|
||||||
PyObject *RawIO_class = (PyObject *)state->PyFileIO_Type;
|
PyObject *RawIO_class = (PyObject *)state->PyFileIO_Type;
|
||||||
#ifdef MS_WINDOWS
|
#ifdef HAVE_WINDOWS_CONSOLE_IO
|
||||||
const PyConfig *config = _Py_GetConfig();
|
const PyConfig *config = _Py_GetConfig();
|
||||||
if (!config->legacy_windows_stdio && _PyIO_get_console_type(path_or_fd) != '\0') {
|
if (!config->legacy_windows_stdio && _PyIO_get_console_type(path_or_fd) != '\0') {
|
||||||
RawIO_class = (PyObject *)&PyWindowsConsoleIO_Type;
|
RawIO_class = (PyObject *)&PyWindowsConsoleIO_Type;
|
||||||
@ -660,7 +660,7 @@ static PyTypeObject* static_types[] = {
|
|||||||
|
|
||||||
// PyRawIOBase_Type(PyIOBase_Type) subclasses
|
// PyRawIOBase_Type(PyIOBase_Type) subclasses
|
||||||
&_PyBytesIOBuffer_Type,
|
&_PyBytesIOBuffer_Type,
|
||||||
#ifdef MS_WINDOWS
|
#ifdef HAVE_WINDOWS_CONSOLE_IO
|
||||||
&PyWindowsConsoleIO_Type,
|
&PyWindowsConsoleIO_Type,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@ -718,7 +718,7 @@ PyInit__io(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set type base classes
|
// Set type base classes
|
||||||
#ifdef MS_WINDOWS
|
#ifdef HAVE_WINDOWS_CONSOLE_IO
|
||||||
PyWindowsConsoleIO_Type.tp_base = &PyRawIOBase_Type;
|
PyWindowsConsoleIO_Type.tp_base = &PyRawIOBase_Type;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -26,9 +26,9 @@ extern PyType_Spec fileio_spec;
|
|||||||
extern PyType_Spec stringio_spec;
|
extern PyType_Spec stringio_spec;
|
||||||
extern PyType_Spec textiowrapper_spec;
|
extern PyType_Spec textiowrapper_spec;
|
||||||
|
|
||||||
#ifdef MS_WINDOWS
|
#ifdef HAVE_WINDOWS_CONSOLE_IO
|
||||||
extern PyTypeObject PyWindowsConsoleIO_Type;
|
extern PyTypeObject PyWindowsConsoleIO_Type;
|
||||||
#endif /* MS_WINDOWS */
|
#endif /* HAVE_WINDOWS_CONSOLE_IO */
|
||||||
|
|
||||||
/* These functions are used as METH_NOARGS methods, are normally called
|
/* These functions are used as METH_NOARGS methods, are normally called
|
||||||
* with args=NULL, and return a new reference.
|
* with args=NULL, and return a new reference.
|
||||||
@ -178,7 +178,7 @@ find_io_state_by_def(PyTypeObject *type)
|
|||||||
|
|
||||||
extern _PyIO_State *_PyIO_get_module_state(void);
|
extern _PyIO_State *_PyIO_get_module_state(void);
|
||||||
|
|
||||||
#ifdef MS_WINDOWS
|
#ifdef HAVE_WINDOWS_CONSOLE_IO
|
||||||
extern char _PyIO_get_console_type(PyObject *);
|
extern char _PyIO_get_console_type(PyObject *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
42
Modules/_io/clinic/winconsoleio.c.h
generated
42
Modules/_io/clinic/winconsoleio.c.h
generated
@ -8,7 +8,7 @@ preserve
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(MS_WINDOWS)
|
#if defined(HAVE_WINDOWS_CONSOLE_IO)
|
||||||
|
|
||||||
PyDoc_STRVAR(_io__WindowsConsoleIO_close__doc__,
|
PyDoc_STRVAR(_io__WindowsConsoleIO_close__doc__,
|
||||||
"close($self, /)\n"
|
"close($self, /)\n"
|
||||||
@ -31,9 +31,9 @@ _io__WindowsConsoleIO_close(winconsoleio *self, PyObject *Py_UNUSED(ignored))
|
|||||||
return _io__WindowsConsoleIO_close_impl(self);
|
return _io__WindowsConsoleIO_close_impl(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(MS_WINDOWS) */
|
#endif /* defined(HAVE_WINDOWS_CONSOLE_IO) */
|
||||||
|
|
||||||
#if defined(MS_WINDOWS)
|
#if defined(HAVE_WINDOWS_CONSOLE_IO)
|
||||||
|
|
||||||
PyDoc_STRVAR(_io__WindowsConsoleIO___init____doc__,
|
PyDoc_STRVAR(_io__WindowsConsoleIO___init____doc__,
|
||||||
"_WindowsConsoleIO(file, mode=\'r\', closefd=True, opener=None)\n"
|
"_WindowsConsoleIO(file, mode=\'r\', closefd=True, opener=None)\n"
|
||||||
@ -131,9 +131,9 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(MS_WINDOWS) */
|
#endif /* defined(HAVE_WINDOWS_CONSOLE_IO) */
|
||||||
|
|
||||||
#if defined(MS_WINDOWS)
|
#if defined(HAVE_WINDOWS_CONSOLE_IO)
|
||||||
|
|
||||||
PyDoc_STRVAR(_io__WindowsConsoleIO_fileno__doc__,
|
PyDoc_STRVAR(_io__WindowsConsoleIO_fileno__doc__,
|
||||||
"fileno($self, /)\n"
|
"fileno($self, /)\n"
|
||||||
@ -153,9 +153,9 @@ _io__WindowsConsoleIO_fileno(winconsoleio *self, PyObject *Py_UNUSED(ignored))
|
|||||||
return _io__WindowsConsoleIO_fileno_impl(self);
|
return _io__WindowsConsoleIO_fileno_impl(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(MS_WINDOWS) */
|
#endif /* defined(HAVE_WINDOWS_CONSOLE_IO) */
|
||||||
|
|
||||||
#if defined(MS_WINDOWS)
|
#if defined(HAVE_WINDOWS_CONSOLE_IO)
|
||||||
|
|
||||||
PyDoc_STRVAR(_io__WindowsConsoleIO_readable__doc__,
|
PyDoc_STRVAR(_io__WindowsConsoleIO_readable__doc__,
|
||||||
"readable($self, /)\n"
|
"readable($self, /)\n"
|
||||||
@ -175,9 +175,9 @@ _io__WindowsConsoleIO_readable(winconsoleio *self, PyObject *Py_UNUSED(ignored))
|
|||||||
return _io__WindowsConsoleIO_readable_impl(self);
|
return _io__WindowsConsoleIO_readable_impl(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(MS_WINDOWS) */
|
#endif /* defined(HAVE_WINDOWS_CONSOLE_IO) */
|
||||||
|
|
||||||
#if defined(MS_WINDOWS)
|
#if defined(HAVE_WINDOWS_CONSOLE_IO)
|
||||||
|
|
||||||
PyDoc_STRVAR(_io__WindowsConsoleIO_writable__doc__,
|
PyDoc_STRVAR(_io__WindowsConsoleIO_writable__doc__,
|
||||||
"writable($self, /)\n"
|
"writable($self, /)\n"
|
||||||
@ -197,9 +197,9 @@ _io__WindowsConsoleIO_writable(winconsoleio *self, PyObject *Py_UNUSED(ignored))
|
|||||||
return _io__WindowsConsoleIO_writable_impl(self);
|
return _io__WindowsConsoleIO_writable_impl(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(MS_WINDOWS) */
|
#endif /* defined(HAVE_WINDOWS_CONSOLE_IO) */
|
||||||
|
|
||||||
#if defined(MS_WINDOWS)
|
#if defined(HAVE_WINDOWS_CONSOLE_IO)
|
||||||
|
|
||||||
PyDoc_STRVAR(_io__WindowsConsoleIO_readinto__doc__,
|
PyDoc_STRVAR(_io__WindowsConsoleIO_readinto__doc__,
|
||||||
"readinto($self, buffer, /)\n"
|
"readinto($self, buffer, /)\n"
|
||||||
@ -239,9 +239,9 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(MS_WINDOWS) */
|
#endif /* defined(HAVE_WINDOWS_CONSOLE_IO) */
|
||||||
|
|
||||||
#if defined(MS_WINDOWS)
|
#if defined(HAVE_WINDOWS_CONSOLE_IO)
|
||||||
|
|
||||||
PyDoc_STRVAR(_io__WindowsConsoleIO_readall__doc__,
|
PyDoc_STRVAR(_io__WindowsConsoleIO_readall__doc__,
|
||||||
"readall($self, /)\n"
|
"readall($self, /)\n"
|
||||||
@ -263,9 +263,9 @@ _io__WindowsConsoleIO_readall(winconsoleio *self, PyObject *Py_UNUSED(ignored))
|
|||||||
return _io__WindowsConsoleIO_readall_impl(self);
|
return _io__WindowsConsoleIO_readall_impl(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(MS_WINDOWS) */
|
#endif /* defined(HAVE_WINDOWS_CONSOLE_IO) */
|
||||||
|
|
||||||
#if defined(MS_WINDOWS)
|
#if defined(HAVE_WINDOWS_CONSOLE_IO)
|
||||||
|
|
||||||
PyDoc_STRVAR(_io__WindowsConsoleIO_read__doc__,
|
PyDoc_STRVAR(_io__WindowsConsoleIO_read__doc__,
|
||||||
"read($self, size=-1, /)\n"
|
"read($self, size=-1, /)\n"
|
||||||
@ -305,9 +305,9 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(MS_WINDOWS) */
|
#endif /* defined(HAVE_WINDOWS_CONSOLE_IO) */
|
||||||
|
|
||||||
#if defined(MS_WINDOWS)
|
#if defined(HAVE_WINDOWS_CONSOLE_IO)
|
||||||
|
|
||||||
PyDoc_STRVAR(_io__WindowsConsoleIO_write__doc__,
|
PyDoc_STRVAR(_io__WindowsConsoleIO_write__doc__,
|
||||||
"write($self, b, /)\n"
|
"write($self, b, /)\n"
|
||||||
@ -348,9 +348,9 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(MS_WINDOWS) */
|
#endif /* defined(HAVE_WINDOWS_CONSOLE_IO) */
|
||||||
|
|
||||||
#if defined(MS_WINDOWS)
|
#if defined(HAVE_WINDOWS_CONSOLE_IO)
|
||||||
|
|
||||||
PyDoc_STRVAR(_io__WindowsConsoleIO_isatty__doc__,
|
PyDoc_STRVAR(_io__WindowsConsoleIO_isatty__doc__,
|
||||||
"isatty($self, /)\n"
|
"isatty($self, /)\n"
|
||||||
@ -370,7 +370,7 @@ _io__WindowsConsoleIO_isatty(winconsoleio *self, PyObject *Py_UNUSED(ignored))
|
|||||||
return _io__WindowsConsoleIO_isatty_impl(self);
|
return _io__WindowsConsoleIO_isatty_impl(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(MS_WINDOWS) */
|
#endif /* defined(HAVE_WINDOWS_CONSOLE_IO) */
|
||||||
|
|
||||||
#ifndef _IO__WINDOWSCONSOLEIO_CLOSE_METHODDEF
|
#ifndef _IO__WINDOWSCONSOLEIO_CLOSE_METHODDEF
|
||||||
#define _IO__WINDOWSCONSOLEIO_CLOSE_METHODDEF
|
#define _IO__WINDOWSCONSOLEIO_CLOSE_METHODDEF
|
||||||
@ -407,4 +407,4 @@ _io__WindowsConsoleIO_isatty(winconsoleio *self, PyObject *Py_UNUSED(ignored))
|
|||||||
#ifndef _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
|
#ifndef _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
|
||||||
#define _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
|
#define _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
|
||||||
#endif /* !defined(_IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF) */
|
#endif /* !defined(_IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF) */
|
||||||
/*[clinic end generated code: output=4920e9068e0cf08a input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=163e934aa9b0ef16 input=a9049054013a1b77]*/
|
||||||
|
@ -37,7 +37,9 @@
|
|||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
/* can simulate truncate with Win32 API functions; see file_truncate */
|
/* can simulate truncate with Win32 API functions; see file_truncate */
|
||||||
#define HAVE_FTRUNCATE
|
#define HAVE_FTRUNCATE
|
||||||
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "pycore_fileutils.h" // _Py_BEGIN_SUPPRESS_IPH
|
#include "pycore_fileutils.h" // _Py_BEGIN_SUPPRESS_IPH
|
||||||
#include "pycore_object.h" // _PyObject_GC_UNTRACK()
|
#include "pycore_object.h" // _PyObject_GC_UNTRACK()
|
||||||
|
|
||||||
#ifdef MS_WINDOWS
|
#ifdef HAVE_WINDOWS_CONSOLE_IO
|
||||||
|
|
||||||
#include "structmember.h" // PyMemberDef
|
#include "structmember.h" // PyMemberDef
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
@ -22,7 +22,9 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <stddef.h> /* For offsetof */
|
#include <stddef.h> /* For offsetof */
|
||||||
|
|
||||||
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
@ -1177,4 +1179,4 @@ PyTypeObject PyWindowsConsoleIO_Type = {
|
|||||||
0, /* tp_finalize */
|
0, /* tp_finalize */
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MS_WINDOWS */
|
#endif /* HAVE_WINDOWS_CONSOLE_IO */
|
||||||
|
@ -35,7 +35,9 @@ This software comes with no warranty. Use at your own risk.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MS_WINDOWS)
|
#if defined(MS_WINDOWS)
|
||||||
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -457,12 +459,12 @@ _locale__getdefaultlocale_impl(PyObject *module)
|
|||||||
|
|
||||||
PyOS_snprintf(encoding, sizeof(encoding), "cp%u", GetACP());
|
PyOS_snprintf(encoding, sizeof(encoding), "cp%u", GetACP());
|
||||||
|
|
||||||
if (GetLocaleInfo(LOCALE_USER_DEFAULT,
|
if (GetLocaleInfoA(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_SISO639LANGNAME,
|
LOCALE_SISO639LANGNAME,
|
||||||
locale, sizeof(locale))) {
|
locale, sizeof(locale))) {
|
||||||
Py_ssize_t i = strlen(locale);
|
Py_ssize_t i = strlen(locale);
|
||||||
locale[i++] = '_';
|
locale[i++] = '_';
|
||||||
if (GetLocaleInfo(LOCALE_USER_DEFAULT,
|
if (GetLocaleInfoA(LOCALE_USER_DEFAULT,
|
||||||
LOCALE_SISO3166CTRYNAME,
|
LOCALE_SISO3166CTRYNAME,
|
||||||
locale+i, (int)(sizeof(locale)-i)))
|
locale+i, (int)(sizeof(locale)-i)))
|
||||||
return Py_BuildValue("ss", locale, encoding);
|
return Py_BuildValue("ss", locale, encoding);
|
||||||
@ -474,7 +476,7 @@ _locale__getdefaultlocale_impl(PyObject *module)
|
|||||||
|
|
||||||
locale[0] = '0';
|
locale[0] = '0';
|
||||||
locale[1] = 'x';
|
locale[1] = 'x';
|
||||||
if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_IDEFAULTLANGUAGE,
|
if (GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_IDEFAULTLANGUAGE,
|
||||||
locale+2, sizeof(locale)-2)) {
|
locale+2, sizeof(locale)-2)) {
|
||||||
return Py_BuildValue("ss", locale, encoding);
|
return Py_BuildValue("ss", locale, encoding);
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
# define WIN32_LEAN_AND_MEAN
|
# ifndef WIN32_LEAN_AND_MEAN
|
||||||
|
# define WIN32_LEAN_AND_MEAN
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
# include <process.h> /* getpid() */
|
# include <process.h> /* getpid() */
|
||||||
|
@ -42,6 +42,12 @@ enum {
|
|||||||
#define FLOAT FLOAT_
|
#define FLOAT FLOAT_
|
||||||
#define INT INT_
|
#define INT INT_
|
||||||
#define LONG LONG_
|
#define LONG LONG_
|
||||||
|
|
||||||
|
/* This can already be defined on Windows to set the character set
|
||||||
|
the Windows header files treat as default */
|
||||||
|
#ifdef UNICODE
|
||||||
|
#undef UNICODE
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Pickle opcodes. These must be kept updated with pickle.py.
|
/* Pickle opcodes. These must be kept updated with pickle.py.
|
||||||
|
@ -77,6 +77,10 @@
|
|||||||
# include <process.h> // getpid()
|
# include <process.h> // getpid()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef MS_WINDOWS
|
||||||
|
# include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Period parameters -- These are all magic. Don't change. */
|
/* Period parameters -- These are all magic. Don't change. */
|
||||||
#define N 624
|
#define N 624
|
||||||
#define M 397
|
#define M 397
|
||||||
@ -259,7 +263,7 @@ random_seed_time_pid(RandomObject *self)
|
|||||||
key[0] = (uint32_t)(now & 0xffffffffU);
|
key[0] = (uint32_t)(now & 0xffffffffU);
|
||||||
key[1] = (uint32_t)(now >> 32);
|
key[1] = (uint32_t)(now >> 32);
|
||||||
|
|
||||||
#ifdef MS_WINDOWS_NON_DESKTOP
|
#if defined(MS_WINDOWS) && !defined(MS_WINDOWS_DESKTOP) && !defined(MS_WINDOWS_SYSTEM)
|
||||||
key[2] = (uint32_t)GetCurrentProcessId();
|
key[2] = (uint32_t)GetCurrentProcessId();
|
||||||
#elif defined(HAVE_GETPID)
|
#elif defined(HAVE_GETPID)
|
||||||
key[2] = (uint32_t)getpid();
|
key[2] = (uint32_t)getpid();
|
||||||
|
@ -28,6 +28,10 @@
|
|||||||
/* Include symbols from _socket module */
|
/* Include symbols from _socket module */
|
||||||
#include "socketmodule.h"
|
#include "socketmodule.h"
|
||||||
|
|
||||||
|
#ifdef MS_WINDOWS
|
||||||
|
# include <wincrypt.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "_ssl.h"
|
#include "_ssl.h"
|
||||||
|
|
||||||
/* Redefined below for Windows debug builds after important #includes */
|
/* Redefined below for Windows debug builds after important #includes */
|
||||||
|
@ -39,8 +39,11 @@
|
|||||||
#include "structmember.h" // PyMemberDef
|
#include "structmember.h" // PyMemberDef
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef WINDOWS_LEAN_AND_MEAN
|
||||||
#define WINDOWS_LEAN_AND_MEAN
|
#define WINDOWS_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
|
#include <winioctl.h>
|
||||||
#include <crtdbg.h>
|
#include <crtdbg.h>
|
||||||
#include "winreparse.h"
|
#include "winreparse.h"
|
||||||
|
|
||||||
@ -63,6 +66,14 @@
|
|||||||
|
|
||||||
#define T_HANDLE T_POINTER
|
#define T_HANDLE T_POINTER
|
||||||
|
|
||||||
|
// winbase.h limits the STARTF_* flags to the desktop API as of 10.0.19041.
|
||||||
|
#ifndef STARTF_USESHOWWINDOW
|
||||||
|
#define STARTF_USESHOWWINDOW 0x00000001
|
||||||
|
#endif
|
||||||
|
#ifndef STARTF_USESTDHANDLES
|
||||||
|
#define STARTF_USESTDHANDLES 0x00000100
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyTypeObject *overlapped_type;
|
PyTypeObject *overlapped_type;
|
||||||
} WinApiState;
|
} WinApiState;
|
||||||
@ -1201,8 +1212,10 @@ _winapi_ExitProcess_impl(PyObject *module, UINT ExitCode)
|
|||||||
/*[clinic end generated code: output=a387deb651175301 input=4f05466a9406c558]*/
|
/*[clinic end generated code: output=a387deb651175301 input=4f05466a9406c558]*/
|
||||||
{
|
{
|
||||||
#if defined(Py_DEBUG)
|
#if defined(Py_DEBUG)
|
||||||
|
#ifdef MS_WINDOWS_DESKTOP
|
||||||
SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOALIGNMENTFAULTEXCEPT|
|
SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOALIGNMENTFAULTEXCEPT|
|
||||||
SEM_NOGPFAULTERRORBOX|SEM_NOOPENFILEERRORBOX);
|
SEM_NOGPFAULTERRORBOX|SEM_NOOPENFILEERRORBOX);
|
||||||
|
#endif
|
||||||
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
|
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
10
Modules/clinic/posixmodule.c.h
generated
10
Modules/clinic/posixmodule.c.h
generated
@ -10988,7 +10988,7 @@ exit:
|
|||||||
|
|
||||||
#endif /* defined(HAVE_GETRANDOM_SYSCALL) */
|
#endif /* defined(HAVE_GETRANDOM_SYSCALL) */
|
||||||
|
|
||||||
#if defined(MS_WINDOWS)
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_APP) || defined(MS_WINDOWS_SYSTEM))
|
||||||
|
|
||||||
PyDoc_STRVAR(os__add_dll_directory__doc__,
|
PyDoc_STRVAR(os__add_dll_directory__doc__,
|
||||||
"_add_dll_directory($module, /, path)\n"
|
"_add_dll_directory($module, /, path)\n"
|
||||||
@ -11057,9 +11057,9 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(MS_WINDOWS) */
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_APP) || defined(MS_WINDOWS_SYSTEM)) */
|
||||||
|
|
||||||
#if defined(MS_WINDOWS)
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_APP) || defined(MS_WINDOWS_SYSTEM))
|
||||||
|
|
||||||
PyDoc_STRVAR(os__remove_dll_directory__doc__,
|
PyDoc_STRVAR(os__remove_dll_directory__doc__,
|
||||||
"_remove_dll_directory($module, /, cookie)\n"
|
"_remove_dll_directory($module, /, cookie)\n"
|
||||||
@ -11120,7 +11120,7 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(MS_WINDOWS) */
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_APP) || defined(MS_WINDOWS_SYSTEM)) */
|
||||||
|
|
||||||
#if (defined(WIFEXITED) || defined(MS_WINDOWS))
|
#if (defined(WIFEXITED) || defined(MS_WINDOWS))
|
||||||
|
|
||||||
@ -11796,4 +11796,4 @@ exit:
|
|||||||
#ifndef OS_WAITSTATUS_TO_EXITCODE_METHODDEF
|
#ifndef OS_WAITSTATUS_TO_EXITCODE_METHODDEF
|
||||||
#define OS_WAITSTATUS_TO_EXITCODE_METHODDEF
|
#define OS_WAITSTATUS_TO_EXITCODE_METHODDEF
|
||||||
#endif /* !defined(OS_WAITSTATUS_TO_EXITCODE_METHODDEF) */
|
#endif /* !defined(OS_WAITSTATUS_TO_EXITCODE_METHODDEF) */
|
||||||
/*[clinic end generated code: output=1b0eb6a76b1a0e28 input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=9495478e51701b8a input=a9049054013a1b77]*/
|
||||||
|
@ -5,7 +5,9 @@
|
|||||||
|
|
||||||
/* Windows socket errors (WSA*) */
|
/* Windows socket errors (WSA*) */
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
/* The following constants were added to errno.h in VS2010 but have
|
/* The following constants were added to errno.h in VS2010 but have
|
||||||
preferred WSA equivalents. */
|
preferred WSA equivalents. */
|
||||||
|
@ -953,7 +953,7 @@ faulthandler_unregister_py(PyObject *self, PyObject *args)
|
|||||||
static void
|
static void
|
||||||
faulthandler_suppress_crash_report(void)
|
faulthandler_suppress_crash_report(void)
|
||||||
{
|
{
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS_DESKTOP
|
||||||
UINT mode;
|
UINT mode;
|
||||||
|
|
||||||
/* Configure Windows to not display the Windows Error Reporting dialog */
|
/* Configure Windows to not display the Windows Error Reporting dialog */
|
||||||
|
@ -745,10 +745,12 @@ static int
|
|||||||
library_to_dict(PyObject *dict, const char *key)
|
library_to_dict(PyObject *dict, const char *key)
|
||||||
{
|
{
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
|
#ifdef Py_ENABLE_SHARED
|
||||||
extern HMODULE PyWin_DLLhModule;
|
extern HMODULE PyWin_DLLhModule;
|
||||||
if (PyWin_DLLhModule) {
|
if (PyWin_DLLhModule) {
|
||||||
return winmodule_to_dict(dict, key, PyWin_DLLhModule);
|
return winmodule_to_dict(dict, key, PyWin_DLLhModule);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#elif defined(WITH_NEXT_FRAMEWORK)
|
#elif defined(WITH_NEXT_FRAMEWORK)
|
||||||
static char modPath[MAXPATHLEN + 1];
|
static char modPath[MAXPATHLEN + 1];
|
||||||
static int modPathInitialized = -1;
|
static int modPathInitialized = -1;
|
||||||
|
@ -29,6 +29,10 @@
|
|||||||
#include "structmember.h" // PyMemberDef
|
#include "structmember.h" // PyMemberDef
|
||||||
#include <stddef.h> // offsetof()
|
#include <stddef.h> // offsetof()
|
||||||
|
|
||||||
|
// to support MS_WINDOWS_SYSTEM OpenFileMappingA / CreateFileMappingA
|
||||||
|
// need to be replaced with OpenFileMappingW / CreateFileMappingW
|
||||||
|
#if !defined(MS_WINDOWS) || defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_GAMES)
|
||||||
|
|
||||||
#ifndef MS_WINDOWS
|
#ifndef MS_WINDOWS
|
||||||
#define UNIX
|
#define UNIX
|
||||||
# ifdef HAVE_FCNTL_H
|
# ifdef HAVE_FCNTL_H
|
||||||
@ -647,7 +651,7 @@ mmap_flush_method(mmap_object *self, PyObject *args)
|
|||||||
if (self->access == ACCESS_READ || self->access == ACCESS_COPY)
|
if (self->access == ACCESS_READ || self->access == ACCESS_COPY)
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
|
|
||||||
#ifdef MS_WINDOWS
|
#if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_APP) || defined(MS_WINDOWS_SYSTEM)
|
||||||
if (!FlushViewOfFile(self->data+offset, size)) {
|
if (!FlushViewOfFile(self->data+offset, size)) {
|
||||||
PyErr_SetFromWindowsErr(GetLastError());
|
PyErr_SetFromWindowsErr(GetLastError());
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1724,3 +1728,5 @@ PyInit_mmap(void)
|
|||||||
{
|
{
|
||||||
return PyModuleDef_Init(&mmapmodule);
|
return PyModuleDef_Init(&mmapmodule);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* !MS_WINDOWS || MS_WINDOWS_DESKTOP || MS_WINDOWS_GAMES */
|
||||||
|
@ -26,11 +26,15 @@
|
|||||||
|
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <pathcch.h>
|
# if !defined(MS_WINDOWS_GAMES) || defined(MS_WINDOWS_DESKTOP)
|
||||||
|
# include <pathcch.h>
|
||||||
|
# endif
|
||||||
# include <winioctl.h>
|
# include <winioctl.h>
|
||||||
# include <lmcons.h> // UNLEN
|
# include <lmcons.h> // UNLEN
|
||||||
# include "osdefs.h" // SEP
|
# include "osdefs.h" // SEP
|
||||||
# define HAVE_SYMLINK
|
# if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)
|
||||||
|
# define HAVE_SYMLINK
|
||||||
|
# endif /* MS_WINDOWS_DESKTOP | MS_WINDOWS_SYSTEM */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "structmember.h" // PyMemberDef
|
#include "structmember.h" // PyMemberDef
|
||||||
@ -311,7 +315,7 @@ corresponding Unix manual entries for more information on calls.");
|
|||||||
# include <sys/syscall.h>
|
# include <sys/syscall.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MS_WINDOWS)
|
#ifdef HAVE_WINDOWS_CONSOLE_IO
|
||||||
# define TERMSIZE_USE_CONIO
|
# define TERMSIZE_USE_CONIO
|
||||||
#elif defined(HAVE_SYS_IOCTL_H)
|
#elif defined(HAVE_SYS_IOCTL_H)
|
||||||
# include <sys/ioctl.h>
|
# include <sys/ioctl.h>
|
||||||
@ -321,7 +325,7 @@ corresponding Unix manual entries for more information on calls.");
|
|||||||
# if defined(TIOCGWINSZ)
|
# if defined(TIOCGWINSZ)
|
||||||
# define TERMSIZE_USE_IOCTL
|
# define TERMSIZE_USE_IOCTL
|
||||||
# endif
|
# endif
|
||||||
#endif /* MS_WINDOWS */
|
#endif /* HAVE_WINDOWS_CONSOLE_IO */
|
||||||
|
|
||||||
/* Various compilers have only certain posix functions */
|
/* Various compilers have only certain posix functions */
|
||||||
/* XXX Gosh I wish these were all moved into pyconfig.h */
|
/* XXX Gosh I wish these were all moved into pyconfig.h */
|
||||||
@ -329,21 +333,25 @@ corresponding Unix manual entries for more information on calls.");
|
|||||||
# define HAVE_OPENDIR 1
|
# define HAVE_OPENDIR 1
|
||||||
# define HAVE_SYSTEM 1
|
# define HAVE_SYSTEM 1
|
||||||
# include <process.h>
|
# include <process.h>
|
||||||
#else
|
#elif defined( _MSC_VER)
|
||||||
# ifdef _MSC_VER
|
/* Microsoft compiler */
|
||||||
/* Microsoft compiler */
|
# if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_APP) || defined(MS_WINDOWS_SYSTEM)
|
||||||
# define HAVE_GETPPID 1
|
# define HAVE_GETPPID 1
|
||||||
|
# endif /* MS_WINDOWS_DESKTOP | MS_WINDOWS_APP | MS_WINDOWS_SYSTEM */
|
||||||
|
# if defined(MS_WINDOWS_DESKTOP)
|
||||||
# define HAVE_GETLOGIN 1
|
# define HAVE_GETLOGIN 1
|
||||||
|
# endif /* MS_WINDOWS_DESKTOP */
|
||||||
|
# if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)
|
||||||
# define HAVE_SPAWNV 1
|
# define HAVE_SPAWNV 1
|
||||||
# define HAVE_EXECV 1
|
# define HAVE_EXECV 1
|
||||||
# define HAVE_WSPAWNV 1
|
# define HAVE_WSPAWNV 1
|
||||||
# define HAVE_WEXECV 1
|
# define HAVE_WEXECV 1
|
||||||
# define HAVE_PIPE 1
|
|
||||||
# define HAVE_SYSTEM 1
|
# define HAVE_SYSTEM 1
|
||||||
# define HAVE_CWAIT 1
|
# define HAVE_CWAIT 1
|
||||||
# define HAVE_FSYNC 1
|
# endif /* MS_WINDOWS_DESKTOP | MS_WINDOWS_SYSTEM */
|
||||||
# define fsync _commit
|
# define HAVE_PIPE 1
|
||||||
# endif /* _MSC_VER */
|
# define HAVE_FSYNC 1
|
||||||
|
# define fsync _commit
|
||||||
#endif /* ! __WATCOMC__ || __QNX__ */
|
#endif /* ! __WATCOMC__ || __QNX__ */
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
@ -1536,7 +1544,7 @@ convertenviron(void)
|
|||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
/* _wenviron must be initialized in this way if the program is started
|
/* _wenviron must be initialized in this way if the program is started
|
||||||
through main() instead of wmain(). */
|
through main() instead of wmain(). */
|
||||||
_wgetenv(L"");
|
(void)_wgetenv(L"");
|
||||||
e = _wenviron;
|
e = _wenviron;
|
||||||
#elif defined(WITH_NEXT_FRAMEWORK) || (defined(__APPLE__) && defined(Py_ENABLE_SHARED))
|
#elif defined(WITH_NEXT_FRAMEWORK) || (defined(__APPLE__) && defined(Py_ENABLE_SHARED))
|
||||||
/* environ is not accessible as an extern in a shared object on OSX; use
|
/* environ is not accessible as an extern in a shared object on OSX; use
|
||||||
@ -1785,6 +1793,10 @@ attributes_from_dir(LPCWSTR pszFile, BY_HANDLE_FILE_INFORMATION *info, ULONG *re
|
|||||||
if (n && (pszFile[n - 1] == L'\\' || pszFile[n - 1] == L'/')) {
|
if (n && (pszFile[n - 1] == L'\\' || pszFile[n - 1] == L'/')) {
|
||||||
// cannot use PyMem_Malloc here because we do not hold the GIL
|
// cannot use PyMem_Malloc here because we do not hold the GIL
|
||||||
filename = (LPCWSTR)malloc((n + 1) * sizeof(filename[0]));
|
filename = (LPCWSTR)malloc((n + 1) * sizeof(filename[0]));
|
||||||
|
if(!filename) {
|
||||||
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
wcsncpy_s((LPWSTR)filename, n + 1, pszFile, n);
|
wcsncpy_s((LPWSTR)filename, n + 1, pszFile, n);
|
||||||
while (--n > 0 && (filename[n] == L'\\' || filename[n] == L'/')) {
|
while (--n > 0 && (filename[n] == L'\\' || filename[n] == L'/')) {
|
||||||
((LPWSTR)filename)[n] = L'\0';
|
((LPWSTR)filename)[n] = L'\0';
|
||||||
@ -7933,10 +7945,10 @@ static PyObject *
|
|||||||
os_getpid_impl(PyObject *module)
|
os_getpid_impl(PyObject *module)
|
||||||
/*[clinic end generated code: output=9ea6fdac01ed2b3c input=5a9a00f0ab68aa00]*/
|
/*[clinic end generated code: output=9ea6fdac01ed2b3c input=5a9a00f0ab68aa00]*/
|
||||||
{
|
{
|
||||||
#ifdef MS_WINDOWS_NON_DESKTOP
|
#if !defined(MS_WINDOWS) || defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)
|
||||||
return PyLong_FromUnsignedLong(GetCurrentProcessId());
|
|
||||||
#else
|
|
||||||
return PyLong_FromPid(getpid());
|
return PyLong_FromPid(getpid());
|
||||||
|
#else
|
||||||
|
return PyLong_FromUnsignedLong(GetCurrentProcessId());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* defined(HAVE_GETPID) */
|
#endif /* defined(HAVE_GETPID) */
|
||||||
@ -8392,6 +8404,7 @@ os_kill_impl(PyObject *module, pid_t pid, Py_ssize_t signal)
|
|||||||
DWORD err;
|
DWORD err;
|
||||||
HANDLE handle;
|
HANDLE handle;
|
||||||
|
|
||||||
|
#ifdef HAVE_WINDOWS_CONSOLE_IO
|
||||||
/* Console processes which share a common console can be sent CTRL+C or
|
/* Console processes which share a common console can be sent CTRL+C or
|
||||||
CTRL+BREAK events, provided they handle said events. */
|
CTRL+BREAK events, provided they handle said events. */
|
||||||
if (sig == CTRL_C_EVENT || sig == CTRL_BREAK_EVENT) {
|
if (sig == CTRL_C_EVENT || sig == CTRL_BREAK_EVENT) {
|
||||||
@ -8399,9 +8412,11 @@ os_kill_impl(PyObject *module, pid_t pid, Py_ssize_t signal)
|
|||||||
err = GetLastError();
|
err = GetLastError();
|
||||||
PyErr_SetFromWindowsErr(err);
|
PyErr_SetFromWindowsErr(err);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_WINDOWS_CONSOLE_IO */
|
||||||
|
|
||||||
/* If the signal is outside of what GenerateConsoleCtrlEvent can use,
|
/* If the signal is outside of what GenerateConsoleCtrlEvent can use,
|
||||||
attempt to open and terminate the process. */
|
attempt to open and terminate the process. */
|
||||||
@ -13776,7 +13791,9 @@ os_cpu_count_impl(PyObject *module)
|
|||||||
{
|
{
|
||||||
int ncpu = 0;
|
int ncpu = 0;
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
|
#ifdef MS_WINDOWS_DESKTOP
|
||||||
ncpu = GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
|
ncpu = GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
|
||||||
|
#endif
|
||||||
#elif defined(__hpux)
|
#elif defined(__hpux)
|
||||||
ncpu = mpctl(MPC_GETNUMSPUS, NULL, NULL);
|
ncpu = mpctl(MPC_GETNUMSPUS, NULL, NULL);
|
||||||
#elif defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN)
|
#elif defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN)
|
||||||
@ -13848,6 +13865,10 @@ os_set_inheritable_impl(PyObject *module, int fd, int inheritable)
|
|||||||
|
|
||||||
|
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
|
#ifndef HANDLE_FLAG_INHERIT
|
||||||
|
#define HANDLE_FLAG_INHERIT 0x00000001
|
||||||
|
#endif
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
os.get_handle_inheritable -> bool
|
os.get_handle_inheritable -> bool
|
||||||
handle: intptr_t
|
handle: intptr_t
|
||||||
@ -15023,7 +15044,8 @@ error:
|
|||||||
}
|
}
|
||||||
#endif /* HAVE_GETRANDOM_SYSCALL */
|
#endif /* HAVE_GETRANDOM_SYSCALL */
|
||||||
|
|
||||||
#ifdef MS_WINDOWS
|
#if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_APP) || defined(MS_WINDOWS_SYSTEM)
|
||||||
|
|
||||||
/* bpo-36085: Helper functions for managing DLL search directories
|
/* bpo-36085: Helper functions for managing DLL search directories
|
||||||
* on win32
|
* on win32
|
||||||
*/
|
*/
|
||||||
@ -15114,7 +15136,7 @@ os__remove_dll_directory_impl(PyObject *module, PyObject *cookie)
|
|||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif /* MS_WINDOWS_APP || MS_WINDOWS_SYSTEM */
|
||||||
|
|
||||||
|
|
||||||
/* Only check if WIFEXITED is available: expect that it comes
|
/* Only check if WIFEXITED is available: expect that it comes
|
||||||
|
@ -57,8 +57,10 @@ extern void bzero(void *, int);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
# define WIN32_LEAN_AND_MEAN
|
# ifndef WIN32_LEAN_AND_MEAN
|
||||||
# include <winsock.h>
|
# define WIN32_LEAN_AND_MEAN
|
||||||
|
# endif
|
||||||
|
# include <winsock2.h>
|
||||||
#else
|
#else
|
||||||
# define SOCKET int
|
# define SOCKET int
|
||||||
#endif
|
#endif
|
||||||
|
@ -270,7 +270,7 @@ shutdown(how) -- shut down traffic in one or both directions\n\
|
|||||||
|
|
||||||
# include <fcntl.h>
|
# include <fcntl.h>
|
||||||
|
|
||||||
#else
|
#else /* MS_WINDOWS */
|
||||||
|
|
||||||
/* MS_WINDOWS includes */
|
/* MS_WINDOWS includes */
|
||||||
# ifdef HAVE_FCNTL_H
|
# ifdef HAVE_FCNTL_H
|
||||||
@ -281,7 +281,6 @@ shutdown(how) -- shut down traffic in one or both directions\n\
|
|||||||
# include <Rpc.h>
|
# include <Rpc.h>
|
||||||
|
|
||||||
/* Macros based on the IPPROTO enum, see: https://bugs.python.org/issue29515 */
|
/* Macros based on the IPPROTO enum, see: https://bugs.python.org/issue29515 */
|
||||||
#ifdef MS_WINDOWS
|
|
||||||
#define IPPROTO_ICMP IPPROTO_ICMP
|
#define IPPROTO_ICMP IPPROTO_ICMP
|
||||||
#define IPPROTO_IGMP IPPROTO_IGMP
|
#define IPPROTO_IGMP IPPROTO_IGMP
|
||||||
#define IPPROTO_GGP IPPROTO_GGP
|
#define IPPROTO_GGP IPPROTO_GGP
|
||||||
@ -312,7 +311,6 @@ shutdown(how) -- shut down traffic in one or both directions\n\
|
|||||||
#define IPPROTO_PGM IPPROTO_PGM // WinSock2 only
|
#define IPPROTO_PGM IPPROTO_PGM // WinSock2 only
|
||||||
#define IPPROTO_L2TP IPPROTO_L2TP // WinSock2 only
|
#define IPPROTO_L2TP IPPROTO_L2TP // WinSock2 only
|
||||||
#define IPPROTO_SCTP IPPROTO_SCTP // WinSock2 only
|
#define IPPROTO_SCTP IPPROTO_SCTP // WinSock2 only
|
||||||
#endif /* MS_WINDOWS */
|
|
||||||
|
|
||||||
/* Provides the IsWindows7SP1OrGreater() function */
|
/* Provides the IsWindows7SP1OrGreater() function */
|
||||||
#include <versionhelpers.h>
|
#include <versionhelpers.h>
|
||||||
@ -348,13 +346,18 @@ remove_unusable_flags(PyObject *m)
|
|||||||
{
|
{
|
||||||
PyObject *dict;
|
PyObject *dict;
|
||||||
OSVERSIONINFOEX info;
|
OSVERSIONINFOEX info;
|
||||||
DWORDLONG dwlConditionMask;
|
|
||||||
|
|
||||||
dict = PyModule_GetDict(m);
|
dict = PyModule_GetDict(m);
|
||||||
if (dict == NULL) {
|
if (dict == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#ifndef MS_WINDOWS_DESKTOP
|
||||||
|
info.dwOSVersionInfoSize = sizeof(info);
|
||||||
|
if (!GetVersionExW((OSVERSIONINFOW*) &info)) {
|
||||||
|
PyErr_SetFromWindowsErr(0);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#else
|
||||||
/* set to Windows 10, except BuildNumber. */
|
/* set to Windows 10, except BuildNumber. */
|
||||||
memset(&info, 0, sizeof(info));
|
memset(&info, 0, sizeof(info));
|
||||||
info.dwOSVersionInfoSize = sizeof(info);
|
info.dwOSVersionInfoSize = sizeof(info);
|
||||||
@ -362,19 +365,30 @@ remove_unusable_flags(PyObject *m)
|
|||||||
info.dwMinorVersion = 0;
|
info.dwMinorVersion = 0;
|
||||||
|
|
||||||
/* set Condition Mask */
|
/* set Condition Mask */
|
||||||
dwlConditionMask = 0;
|
DWORDLONG dwlConditionMask = 0;
|
||||||
VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
|
VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
|
||||||
VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
|
VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
|
||||||
VER_SET_CONDITION(dwlConditionMask, VER_BUILDNUMBER, VER_GREATER_EQUAL);
|
VER_SET_CONDITION(dwlConditionMask, VER_BUILDNUMBER, VER_GREATER_EQUAL);
|
||||||
|
#endif
|
||||||
|
|
||||||
for (int i=0; i<sizeof(win_runtime_flags)/sizeof(FlagRuntimeInfo); i++) {
|
for (int i=0; i<sizeof(win_runtime_flags)/sizeof(FlagRuntimeInfo); i++) {
|
||||||
|
#ifdef MS_WINDOWS_DESKTOP
|
||||||
info.dwBuildNumber = win_runtime_flags[i].build_number;
|
info.dwBuildNumber = win_runtime_flags[i].build_number;
|
||||||
/* greater than or equal to the specified version?
|
/* greater than or equal to the specified version?
|
||||||
Compatibility Mode will not cheat VerifyVersionInfo(...) */
|
Compatibility Mode will not cheat VerifyVersionInfo(...) */
|
||||||
if (VerifyVersionInfo(
|
BOOL isSupported = VerifyVersionInfo(
|
||||||
&info,
|
&info,
|
||||||
VER_MAJORVERSION|VER_MINORVERSION|VER_BUILDNUMBER,
|
VER_MAJORVERSION|VER_MINORVERSION|VER_BUILDNUMBER,
|
||||||
dwlConditionMask)) {
|
dwlConditionMask);
|
||||||
|
#else
|
||||||
|
/* note in this case 'info' is the actual OS version, whereas above
|
||||||
|
it is the version to compare against. */
|
||||||
|
BOOL isSupported = info.dwMajorVersion > 10 ||
|
||||||
|
(info.dwMajorVersion == 10 && info.dwMinorVersion > 0) ||
|
||||||
|
(info.dwMajorVersion == 10 && info.dwMinorVersion == 0 &&
|
||||||
|
info.dwBuildNumber >= win_runtime_flags[i].build_number);
|
||||||
|
#endif
|
||||||
|
if (isSupported) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -497,14 +511,14 @@ remove_unusable_flags(PyObject *m)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS_DESKTOP
|
||||||
#define sockaddr_rc SOCKADDR_BTH_REDEF
|
#define sockaddr_rc SOCKADDR_BTH_REDEF
|
||||||
|
|
||||||
#define USE_BLUETOOTH 1
|
#define USE_BLUETOOTH 1
|
||||||
#define AF_BLUETOOTH AF_BTH
|
#define AF_BLUETOOTH AF_BTH
|
||||||
#define BTPROTO_RFCOMM BTHPROTO_RFCOMM
|
#define BTPROTO_RFCOMM BTHPROTO_RFCOMM
|
||||||
#define _BT_RC_MEMB(sa, memb) ((sa)->memb)
|
#define _BT_RC_MEMB(sa, memb) ((sa)->memb)
|
||||||
#endif
|
#endif /* MS_WINDOWS_DESKTOP */
|
||||||
|
|
||||||
/* Convert "sock_addr_t *" to "struct sockaddr *". */
|
/* Convert "sock_addr_t *" to "struct sockaddr *". */
|
||||||
#define SAS2SA(x) (&((x)->sa))
|
#define SAS2SA(x) (&((x)->sa))
|
||||||
@ -2869,11 +2883,16 @@ sock_accept(PySocketSockObject *s, PyObject *Py_UNUSED(ignored))
|
|||||||
newfd = ctx.result;
|
newfd = ctx.result;
|
||||||
|
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
|
#if defined(MS_WINDOWS_APP) || defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)
|
||||||
|
#ifndef HANDLE_FLAG_INHERIT
|
||||||
|
#define HANDLE_FLAG_INHERIT 0x00000001
|
||||||
|
#endif
|
||||||
if (!SetHandleInformation((HANDLE)newfd, HANDLE_FLAG_INHERIT, 0)) {
|
if (!SetHandleInformation((HANDLE)newfd, HANDLE_FLAG_INHERIT, 0)) {
|
||||||
PyErr_SetFromWindowsErr(0);
|
PyErr_SetFromWindowsErr(0);
|
||||||
SOCKETCLOSE(newfd);
|
SOCKETCLOSE(newfd);
|
||||||
goto finally;
|
goto finally;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#if defined(HAVE_ACCEPT4) && defined(SOCK_CLOEXEC)
|
#if defined(HAVE_ACCEPT4) && defined(SOCK_CLOEXEC)
|
||||||
@ -5434,11 +5453,6 @@ sock_initobj_impl(PySocketSockObject *self, int family, int type, int proto,
|
|||||||
proto = 0;
|
proto = 0;
|
||||||
}
|
}
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
/* Windows implementation */
|
|
||||||
#ifndef WSA_FLAG_NO_HANDLE_INHERIT
|
|
||||||
#define WSA_FLAG_NO_HANDLE_INHERIT 0x80
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Py_BEGIN_ALLOW_THREADS
|
Py_BEGIN_ALLOW_THREADS
|
||||||
fd = WSASocketW(family, type, proto,
|
fd = WSASocketW(family, type, proto,
|
||||||
NULL, 0,
|
NULL, 0,
|
||||||
@ -6150,8 +6164,9 @@ socket_dup(PyObject *self, PyObject *fdobj)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
fd = PyLong_AsSocket_t(fdobj);
|
fd = PyLong_AsSocket_t(fdobj);
|
||||||
if (fd == (SOCKET_T)(-1) && PyErr_Occurred())
|
if (fd == (SOCKET_T)(-1) && PyErr_Occurred()) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
if (WSADuplicateSocketW(fd, GetCurrentProcessId(), &info))
|
if (WSADuplicateSocketW(fd, GetCurrentProcessId(), &info))
|
||||||
@ -6160,8 +6175,9 @@ socket_dup(PyObject *self, PyObject *fdobj)
|
|||||||
newfd = WSASocketW(FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO,
|
newfd = WSASocketW(FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO,
|
||||||
FROM_PROTOCOL_INFO,
|
FROM_PROTOCOL_INFO,
|
||||||
&info, 0, WSA_FLAG_OVERLAPPED);
|
&info, 0, WSA_FLAG_OVERLAPPED);
|
||||||
if (newfd == INVALID_SOCKET)
|
if (newfd == INVALID_SOCKET) {
|
||||||
return set_error();
|
return set_error();
|
||||||
|
}
|
||||||
|
|
||||||
if (!SetHandleInformation((HANDLE)newfd, HANDLE_FLAG_INHERIT, 0)) {
|
if (!SetHandleInformation((HANDLE)newfd, HANDLE_FLAG_INHERIT, 0)) {
|
||||||
closesocket(newfd);
|
closesocket(newfd);
|
||||||
@ -6171,13 +6187,15 @@ socket_dup(PyObject *self, PyObject *fdobj)
|
|||||||
#else
|
#else
|
||||||
/* On UNIX, dup can be used to duplicate the file descriptor of a socket */
|
/* On UNIX, dup can be used to duplicate the file descriptor of a socket */
|
||||||
newfd = _Py_dup(fd);
|
newfd = _Py_dup(fd);
|
||||||
if (newfd == INVALID_SOCKET)
|
if (newfd == INVALID_SOCKET) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
newfdobj = PyLong_FromSocket_t(newfd);
|
newfdobj = PyLong_FromSocket_t(newfd);
|
||||||
if (newfdobj == NULL)
|
if (newfdobj == NULL) {
|
||||||
SOCKETCLOSE(newfd);
|
SOCKETCLOSE(newfd);
|
||||||
|
}
|
||||||
return newfdobj;
|
return newfdobj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,9 @@
|
|||||||
# include <i86.h>
|
# include <i86.h>
|
||||||
#else
|
#else
|
||||||
# ifdef MS_WINDOWS
|
# ifdef MS_WINDOWS
|
||||||
# define WIN32_LEAN_AND_MEAN
|
# ifndef WIN32_LEAN_AND_MEAN
|
||||||
|
# define WIN32_LEAN_AND_MEAN
|
||||||
|
# endif
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# endif /* MS_WINDOWS */
|
# endif /* MS_WINDOWS */
|
||||||
#endif /* !__WATCOMC__ || __QNX__ */
|
#endif /* !__WATCOMC__ || __QNX__ */
|
||||||
@ -1135,7 +1137,9 @@ time_tzset(PyObject *self, PyObject *unused)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(MS_WINDOWS) || defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)
|
||||||
tzset();
|
tzset();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Reset timezone, altzone, daylight and tzname */
|
/* Reset timezone, altzone, daylight and tzname */
|
||||||
if (init_timezone(m) < 0) {
|
if (init_timezone(m) < 0) {
|
||||||
@ -1753,7 +1757,9 @@ init_timezone(PyObject *m)
|
|||||||
*/
|
*/
|
||||||
#ifdef HAVE_DECL_TZNAME
|
#ifdef HAVE_DECL_TZNAME
|
||||||
PyObject *otz0, *otz1;
|
PyObject *otz0, *otz1;
|
||||||
|
#if !defined(MS_WINDOWS) || defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)
|
||||||
tzset();
|
tzset();
|
||||||
|
#endif
|
||||||
PyModule_AddIntConstant(m, "timezone", _Py_timezone);
|
PyModule_AddIntConstant(m, "timezone", _Py_timezone);
|
||||||
#ifdef HAVE_ALTZONE
|
#ifdef HAVE_ALTZONE
|
||||||
PyModule_AddIntConstant(m, "altzone", altzone);
|
PyModule_AddIntConstant(m, "altzone", altzone);
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#include <stdlib.h> // malloc()
|
#include <stdlib.h> // malloc()
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
|
||||||
#undef uint
|
#undef uint
|
||||||
#define uint pymem_uint
|
#define uint pymem_uint
|
||||||
|
|
||||||
|
42
PC/clinic/msvcrtmodule.c.h
generated
42
PC/clinic/msvcrtmodule.c.h
generated
@ -261,6 +261,8 @@ msvcrt_getch(PyObject *module, PyObject *Py_UNUSED(ignored))
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(MS_WINDOWS_DESKTOP)
|
||||||
|
|
||||||
PyDoc_STRVAR(msvcrt_getwch__doc__,
|
PyDoc_STRVAR(msvcrt_getwch__doc__,
|
||||||
"getwch($module, /)\n"
|
"getwch($module, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -285,6 +287,8 @@ msvcrt_getwch(PyObject *module, PyObject *Py_UNUSED(ignored))
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* defined(MS_WINDOWS_DESKTOP) */
|
||||||
|
|
||||||
PyDoc_STRVAR(msvcrt_getche__doc__,
|
PyDoc_STRVAR(msvcrt_getche__doc__,
|
||||||
"getche($module, /)\n"
|
"getche($module, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -309,6 +313,8 @@ msvcrt_getche(PyObject *module, PyObject *Py_UNUSED(ignored))
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(MS_WINDOWS_DESKTOP)
|
||||||
|
|
||||||
PyDoc_STRVAR(msvcrt_getwche__doc__,
|
PyDoc_STRVAR(msvcrt_getwche__doc__,
|
||||||
"getwche($module, /)\n"
|
"getwche($module, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -333,6 +339,8 @@ msvcrt_getwche(PyObject *module, PyObject *Py_UNUSED(ignored))
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* defined(MS_WINDOWS_DESKTOP) */
|
||||||
|
|
||||||
PyDoc_STRVAR(msvcrt_putch__doc__,
|
PyDoc_STRVAR(msvcrt_putch__doc__,
|
||||||
"putch($module, char, /)\n"
|
"putch($module, char, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -367,6 +375,8 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(MS_WINDOWS_DESKTOP)
|
||||||
|
|
||||||
PyDoc_STRVAR(msvcrt_putwch__doc__,
|
PyDoc_STRVAR(msvcrt_putwch__doc__,
|
||||||
"putwch($module, unicode_char, /)\n"
|
"putwch($module, unicode_char, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -403,6 +413,8 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* defined(MS_WINDOWS_DESKTOP) */
|
||||||
|
|
||||||
PyDoc_STRVAR(msvcrt_ungetch__doc__,
|
PyDoc_STRVAR(msvcrt_ungetch__doc__,
|
||||||
"ungetch($module, char, /)\n"
|
"ungetch($module, char, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -441,6 +453,8 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(MS_WINDOWS_DESKTOP)
|
||||||
|
|
||||||
PyDoc_STRVAR(msvcrt_ungetwch__doc__,
|
PyDoc_STRVAR(msvcrt_ungetwch__doc__,
|
||||||
"ungetwch($module, unicode_char, /)\n"
|
"ungetwch($module, unicode_char, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -477,6 +491,8 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* defined(MS_WINDOWS_DESKTOP) */
|
||||||
|
|
||||||
#if defined(_DEBUG)
|
#if defined(_DEBUG)
|
||||||
|
|
||||||
PyDoc_STRVAR(msvcrt_CrtSetReportFile__doc__,
|
PyDoc_STRVAR(msvcrt_CrtSetReportFile__doc__,
|
||||||
@ -610,6 +626,8 @@ exit:
|
|||||||
|
|
||||||
#endif /* defined(_DEBUG) */
|
#endif /* defined(_DEBUG) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_APP) || defined(MS_WINDOWS_SYSTEM))
|
||||||
|
|
||||||
PyDoc_STRVAR(msvcrt_GetErrorMode__doc__,
|
PyDoc_STRVAR(msvcrt_GetErrorMode__doc__,
|
||||||
"GetErrorMode($module, /)\n"
|
"GetErrorMode($module, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -628,6 +646,8 @@ msvcrt_GetErrorMode(PyObject *module, PyObject *Py_UNUSED(ignored))
|
|||||||
return msvcrt_GetErrorMode_impl(module);
|
return msvcrt_GetErrorMode_impl(module);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_APP) || defined(MS_WINDOWS_SYSTEM)) */
|
||||||
|
|
||||||
PyDoc_STRVAR(msvcrt_SetErrorMode__doc__,
|
PyDoc_STRVAR(msvcrt_SetErrorMode__doc__,
|
||||||
"SetErrorMode($module, mode, /)\n"
|
"SetErrorMode($module, mode, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -656,6 +676,22 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef MSVCRT_GETWCH_METHODDEF
|
||||||
|
#define MSVCRT_GETWCH_METHODDEF
|
||||||
|
#endif /* !defined(MSVCRT_GETWCH_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef MSVCRT_GETWCHE_METHODDEF
|
||||||
|
#define MSVCRT_GETWCHE_METHODDEF
|
||||||
|
#endif /* !defined(MSVCRT_GETWCHE_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef MSVCRT_PUTWCH_METHODDEF
|
||||||
|
#define MSVCRT_PUTWCH_METHODDEF
|
||||||
|
#endif /* !defined(MSVCRT_PUTWCH_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef MSVCRT_UNGETWCH_METHODDEF
|
||||||
|
#define MSVCRT_UNGETWCH_METHODDEF
|
||||||
|
#endif /* !defined(MSVCRT_UNGETWCH_METHODDEF) */
|
||||||
|
|
||||||
#ifndef MSVCRT_CRTSETREPORTFILE_METHODDEF
|
#ifndef MSVCRT_CRTSETREPORTFILE_METHODDEF
|
||||||
#define MSVCRT_CRTSETREPORTFILE_METHODDEF
|
#define MSVCRT_CRTSETREPORTFILE_METHODDEF
|
||||||
#endif /* !defined(MSVCRT_CRTSETREPORTFILE_METHODDEF) */
|
#endif /* !defined(MSVCRT_CRTSETREPORTFILE_METHODDEF) */
|
||||||
@ -667,4 +703,8 @@ exit:
|
|||||||
#ifndef MSVCRT_SET_ERROR_MODE_METHODDEF
|
#ifndef MSVCRT_SET_ERROR_MODE_METHODDEF
|
||||||
#define MSVCRT_SET_ERROR_MODE_METHODDEF
|
#define MSVCRT_SET_ERROR_MODE_METHODDEF
|
||||||
#endif /* !defined(MSVCRT_SET_ERROR_MODE_METHODDEF) */
|
#endif /* !defined(MSVCRT_SET_ERROR_MODE_METHODDEF) */
|
||||||
/*[clinic end generated code: output=204bae9fee7f6124 input=a9049054013a1b77]*/
|
|
||||||
|
#ifndef MSVCRT_GETERRORMODE_METHODDEF
|
||||||
|
#define MSVCRT_GETERRORMODE_METHODDEF
|
||||||
|
#endif /* !defined(MSVCRT_GETERRORMODE_METHODDEF) */
|
||||||
|
/*[clinic end generated code: output=2db6197608a6aab3 input=a9049054013a1b77]*/
|
||||||
|
218
PC/clinic/winreg.c.h
generated
218
PC/clinic/winreg.c.h
generated
@ -8,6 +8,8 @@ preserve
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_HKEYType_Close__doc__,
|
PyDoc_STRVAR(winreg_HKEYType_Close__doc__,
|
||||||
"Close($self, /)\n"
|
"Close($self, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -28,6 +30,10 @@ winreg_HKEYType_Close(PyHKEYObject *self, PyObject *Py_UNUSED(ignored))
|
|||||||
return winreg_HKEYType_Close_impl(self);
|
return winreg_HKEYType_Close_impl(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_HKEYType_Detach__doc__,
|
PyDoc_STRVAR(winreg_HKEYType_Detach__doc__,
|
||||||
"Detach($self, /)\n"
|
"Detach($self, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -54,6 +60,10 @@ winreg_HKEYType_Detach(PyHKEYObject *self, PyObject *Py_UNUSED(ignored))
|
|||||||
return winreg_HKEYType_Detach_impl(self);
|
return winreg_HKEYType_Detach_impl(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_HKEYType___enter____doc__,
|
PyDoc_STRVAR(winreg_HKEYType___enter____doc__,
|
||||||
"__enter__($self, /)\n"
|
"__enter__($self, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -77,6 +87,10 @@ winreg_HKEYType___enter__(PyHKEYObject *self, PyObject *Py_UNUSED(ignored))
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_HKEYType___exit____doc__,
|
PyDoc_STRVAR(winreg_HKEYType___exit____doc__,
|
||||||
"__exit__($self, /, exc_type, exc_value, traceback)\n"
|
"__exit__($self, /, exc_type, exc_value, traceback)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -136,6 +150,10 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_CloseKey__doc__,
|
PyDoc_STRVAR(winreg_CloseKey__doc__,
|
||||||
"CloseKey($module, hkey, /)\n"
|
"CloseKey($module, hkey, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -151,6 +169,10 @@ PyDoc_STRVAR(winreg_CloseKey__doc__,
|
|||||||
#define WINREG_CLOSEKEY_METHODDEF \
|
#define WINREG_CLOSEKEY_METHODDEF \
|
||||||
{"CloseKey", (PyCFunction)winreg_CloseKey, METH_O, winreg_CloseKey__doc__},
|
{"CloseKey", (PyCFunction)winreg_CloseKey, METH_O, winreg_CloseKey__doc__},
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_ConnectRegistry__doc__,
|
PyDoc_STRVAR(winreg_ConnectRegistry__doc__,
|
||||||
"ConnectRegistry($module, computer_name, key, /)\n"
|
"ConnectRegistry($module, computer_name, key, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -213,6 +235,10 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_CreateKey__doc__,
|
PyDoc_STRVAR(winreg_CreateKey__doc__,
|
||||||
"CreateKey($module, key, sub_key, /)\n"
|
"CreateKey($module, key, sub_key, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -278,6 +304,10 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_CreateKeyEx__doc__,
|
PyDoc_STRVAR(winreg_CreateKeyEx__doc__,
|
||||||
"CreateKeyEx($module, /, key, sub_key, reserved=0,\n"
|
"CreateKeyEx($module, /, key, sub_key, reserved=0,\n"
|
||||||
" access=winreg.KEY_WRITE)\n"
|
" access=winreg.KEY_WRITE)\n"
|
||||||
@ -398,6 +428,10 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_DeleteKey__doc__,
|
PyDoc_STRVAR(winreg_DeleteKey__doc__,
|
||||||
"DeleteKey($module, key, sub_key, /)\n"
|
"DeleteKey($module, key, sub_key, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -452,6 +486,10 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_DeleteKeyEx__doc__,
|
PyDoc_STRVAR(winreg_DeleteKeyEx__doc__,
|
||||||
"DeleteKeyEx($module, /, key, sub_key, access=winreg.KEY_WOW64_64KEY,\n"
|
"DeleteKeyEx($module, /, key, sub_key, access=winreg.KEY_WOW64_64KEY,\n"
|
||||||
" reserved=0)\n"
|
" reserved=0)\n"
|
||||||
@ -565,6 +603,10 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_DeleteValue__doc__,
|
PyDoc_STRVAR(winreg_DeleteValue__doc__,
|
||||||
"DeleteValue($module, key, value, /)\n"
|
"DeleteValue($module, key, value, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -617,6 +659,10 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_EnumKey__doc__,
|
PyDoc_STRVAR(winreg_EnumKey__doc__,
|
||||||
"EnumKey($module, key, index, /)\n"
|
"EnumKey($module, key, index, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -661,6 +707,10 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_EnumValue__doc__,
|
PyDoc_STRVAR(winreg_EnumValue__doc__,
|
||||||
"EnumValue($module, key, index, /)\n"
|
"EnumValue($module, key, index, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -714,6 +764,10 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_ExpandEnvironmentStrings__doc__,
|
PyDoc_STRVAR(winreg_ExpandEnvironmentStrings__doc__,
|
||||||
"ExpandEnvironmentStrings($module, string, /)\n"
|
"ExpandEnvironmentStrings($module, string, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -750,6 +804,10 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_FlushKey__doc__,
|
PyDoc_STRVAR(winreg_FlushKey__doc__,
|
||||||
"FlushKey($module, key, /)\n"
|
"FlushKey($module, key, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -790,6 +848,10 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_LoadKey__doc__,
|
PyDoc_STRVAR(winreg_LoadKey__doc__,
|
||||||
"LoadKey($module, key, sub_key, file_name, /)\n"
|
"LoadKey($module, key, sub_key, file_name, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -866,6 +928,10 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_OpenKey__doc__,
|
PyDoc_STRVAR(winreg_OpenKey__doc__,
|
||||||
"OpenKey($module, /, key, sub_key, reserved=0, access=winreg.KEY_READ)\n"
|
"OpenKey($module, /, key, sub_key, reserved=0, access=winreg.KEY_READ)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -979,6 +1045,10 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_OpenKeyEx__doc__,
|
PyDoc_STRVAR(winreg_OpenKeyEx__doc__,
|
||||||
"OpenKeyEx($module, /, key, sub_key, reserved=0, access=winreg.KEY_READ)\n"
|
"OpenKeyEx($module, /, key, sub_key, reserved=0, access=winreg.KEY_READ)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -1092,6 +1162,10 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_QueryInfoKey__doc__,
|
PyDoc_STRVAR(winreg_QueryInfoKey__doc__,
|
||||||
"QueryInfoKey($module, key, /)\n"
|
"QueryInfoKey($module, key, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -1128,6 +1202,10 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_QueryValue__doc__,
|
PyDoc_STRVAR(winreg_QueryValue__doc__,
|
||||||
"QueryValue($module, key, sub_key, /)\n"
|
"QueryValue($module, key, sub_key, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -1189,6 +1267,10 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_QueryValueEx__doc__,
|
PyDoc_STRVAR(winreg_QueryValueEx__doc__,
|
||||||
"QueryValueEx($module, key, name, /)\n"
|
"QueryValueEx($module, key, name, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -1246,6 +1328,10 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_SaveKey__doc__,
|
PyDoc_STRVAR(winreg_SaveKey__doc__,
|
||||||
"SaveKey($module, key, file_name, /)\n"
|
"SaveKey($module, key, file_name, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -1303,6 +1389,10 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_SetValue__doc__,
|
PyDoc_STRVAR(winreg_SetValue__doc__,
|
||||||
"SetValue($module, key, sub_key, type, value, /)\n"
|
"SetValue($module, key, sub_key, type, value, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -1384,6 +1474,10 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_SetValueEx__doc__,
|
PyDoc_STRVAR(winreg_SetValueEx__doc__,
|
||||||
"SetValueEx($module, key, value_name, reserved, type, value, /)\n"
|
"SetValueEx($module, key, value_name, reserved, type, value, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -1478,6 +1572,10 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_DisableReflectionKey__doc__,
|
PyDoc_STRVAR(winreg_DisableReflectionKey__doc__,
|
||||||
"DisableReflectionKey($module, key, /)\n"
|
"DisableReflectionKey($module, key, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -1514,6 +1612,10 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_EnableReflectionKey__doc__,
|
PyDoc_STRVAR(winreg_EnableReflectionKey__doc__,
|
||||||
"EnableReflectionKey($module, key, /)\n"
|
"EnableReflectionKey($module, key, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -1548,6 +1650,10 @@ exit:
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)) */
|
||||||
|
|
||||||
|
#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM))
|
||||||
|
|
||||||
PyDoc_STRVAR(winreg_QueryReflectionKey__doc__,
|
PyDoc_STRVAR(winreg_QueryReflectionKey__doc__,
|
||||||
"QueryReflectionKey($module, key, /)\n"
|
"QueryReflectionKey($module, key, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
@ -1579,4 +1685,114 @@ winreg_QueryReflectionKey(PyObject *module, PyObject *arg)
|
|||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=7e817dc5edc914d3 input=a9049054013a1b77]*/
|
|
||||||
|
#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)) */
|
||||||
|
|
||||||
|
#ifndef WINREG_HKEYTYPE_CLOSE_METHODDEF
|
||||||
|
#define WINREG_HKEYTYPE_CLOSE_METHODDEF
|
||||||
|
#endif /* !defined(WINREG_HKEYTYPE_CLOSE_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef WINREG_HKEYTYPE_DETACH_METHODDEF
|
||||||
|
#define WINREG_HKEYTYPE_DETACH_METHODDEF
|
||||||
|
#endif /* !defined(WINREG_HKEYTYPE_DETACH_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef WINREG_HKEYTYPE___ENTER___METHODDEF
|
||||||
|
#define WINREG_HKEYTYPE___ENTER___METHODDEF
|
||||||
|
#endif /* !defined(WINREG_HKEYTYPE___ENTER___METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef WINREG_HKEYTYPE___EXIT___METHODDEF
|
||||||
|
#define WINREG_HKEYTYPE___EXIT___METHODDEF
|
||||||
|
#endif /* !defined(WINREG_HKEYTYPE___EXIT___METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef WINREG_CLOSEKEY_METHODDEF
|
||||||
|
#define WINREG_CLOSEKEY_METHODDEF
|
||||||
|
#endif /* !defined(WINREG_CLOSEKEY_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef WINREG_CONNECTREGISTRY_METHODDEF
|
||||||
|
#define WINREG_CONNECTREGISTRY_METHODDEF
|
||||||
|
#endif /* !defined(WINREG_CONNECTREGISTRY_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef WINREG_CREATEKEY_METHODDEF
|
||||||
|
#define WINREG_CREATEKEY_METHODDEF
|
||||||
|
#endif /* !defined(WINREG_CREATEKEY_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef WINREG_CREATEKEYEX_METHODDEF
|
||||||
|
#define WINREG_CREATEKEYEX_METHODDEF
|
||||||
|
#endif /* !defined(WINREG_CREATEKEYEX_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef WINREG_DELETEKEY_METHODDEF
|
||||||
|
#define WINREG_DELETEKEY_METHODDEF
|
||||||
|
#endif /* !defined(WINREG_DELETEKEY_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef WINREG_DELETEKEYEX_METHODDEF
|
||||||
|
#define WINREG_DELETEKEYEX_METHODDEF
|
||||||
|
#endif /* !defined(WINREG_DELETEKEYEX_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef WINREG_DELETEVALUE_METHODDEF
|
||||||
|
#define WINREG_DELETEVALUE_METHODDEF
|
||||||
|
#endif /* !defined(WINREG_DELETEVALUE_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef WINREG_ENUMKEY_METHODDEF
|
||||||
|
#define WINREG_ENUMKEY_METHODDEF
|
||||||
|
#endif /* !defined(WINREG_ENUMKEY_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef WINREG_ENUMVALUE_METHODDEF
|
||||||
|
#define WINREG_ENUMVALUE_METHODDEF
|
||||||
|
#endif /* !defined(WINREG_ENUMVALUE_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef WINREG_EXPANDENVIRONMENTSTRINGS_METHODDEF
|
||||||
|
#define WINREG_EXPANDENVIRONMENTSTRINGS_METHODDEF
|
||||||
|
#endif /* !defined(WINREG_EXPANDENVIRONMENTSTRINGS_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef WINREG_FLUSHKEY_METHODDEF
|
||||||
|
#define WINREG_FLUSHKEY_METHODDEF
|
||||||
|
#endif /* !defined(WINREG_FLUSHKEY_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef WINREG_LOADKEY_METHODDEF
|
||||||
|
#define WINREG_LOADKEY_METHODDEF
|
||||||
|
#endif /* !defined(WINREG_LOADKEY_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef WINREG_OPENKEY_METHODDEF
|
||||||
|
#define WINREG_OPENKEY_METHODDEF
|
||||||
|
#endif /* !defined(WINREG_OPENKEY_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef WINREG_OPENKEYEX_METHODDEF
|
||||||
|
#define WINREG_OPENKEYEX_METHODDEF
|
||||||
|
#endif /* !defined(WINREG_OPENKEYEX_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef WINREG_QUERYINFOKEY_METHODDEF
|
||||||
|
#define WINREG_QUERYINFOKEY_METHODDEF
|
||||||
|
#endif /* !defined(WINREG_QUERYINFOKEY_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef WINREG_QUERYVALUE_METHODDEF
|
||||||
|
#define WINREG_QUERYVALUE_METHODDEF
|
||||||
|
#endif /* !defined(WINREG_QUERYVALUE_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef WINREG_QUERYVALUEEX_METHODDEF
|
||||||
|
#define WINREG_QUERYVALUEEX_METHODDEF
|
||||||
|
#endif /* !defined(WINREG_QUERYVALUEEX_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef WINREG_SAVEKEY_METHODDEF
|
||||||
|
#define WINREG_SAVEKEY_METHODDEF
|
||||||
|
#endif /* !defined(WINREG_SAVEKEY_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef WINREG_SETVALUE_METHODDEF
|
||||||
|
#define WINREG_SETVALUE_METHODDEF
|
||||||
|
#endif /* !defined(WINREG_SETVALUE_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef WINREG_SETVALUEEX_METHODDEF
|
||||||
|
#define WINREG_SETVALUEEX_METHODDEF
|
||||||
|
#endif /* !defined(WINREG_SETVALUEEX_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef WINREG_DISABLEREFLECTIONKEY_METHODDEF
|
||||||
|
#define WINREG_DISABLEREFLECTIONKEY_METHODDEF
|
||||||
|
#endif /* !defined(WINREG_DISABLEREFLECTIONKEY_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef WINREG_ENABLEREFLECTIONKEY_METHODDEF
|
||||||
|
#define WINREG_ENABLEREFLECTIONKEY_METHODDEF
|
||||||
|
#endif /* !defined(WINREG_ENABLEREFLECTIONKEY_METHODDEF) */
|
||||||
|
|
||||||
|
#ifndef WINREG_QUERYREFLECTIONKEY_METHODDEF
|
||||||
|
#define WINREG_QUERYREFLECTIONKEY_METHODDEF
|
||||||
|
#endif /* !defined(WINREG_QUERYREFLECTIONKEY_METHODDEF) */
|
||||||
|
/*[clinic end generated code: output=715db416dc1321ee input=a9049054013a1b77]*/
|
||||||
|
@ -43,10 +43,14 @@ extern PyObject* PyInit__collections(void);
|
|||||||
extern PyObject* PyInit__heapq(void);
|
extern PyObject* PyInit__heapq(void);
|
||||||
extern PyObject* PyInit__bisect(void);
|
extern PyObject* PyInit__bisect(void);
|
||||||
extern PyObject* PyInit__symtable(void);
|
extern PyObject* PyInit__symtable(void);
|
||||||
|
#if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_GAMES)
|
||||||
extern PyObject* PyInit_mmap(void);
|
extern PyObject* PyInit_mmap(void);
|
||||||
|
#endif
|
||||||
extern PyObject* PyInit__csv(void);
|
extern PyObject* PyInit__csv(void);
|
||||||
extern PyObject* PyInit__sre(void);
|
extern PyObject* PyInit__sre(void);
|
||||||
|
#if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)
|
||||||
extern PyObject* PyInit_winreg(void);
|
extern PyObject* PyInit_winreg(void);
|
||||||
|
#endif
|
||||||
extern PyObject* PyInit__struct(void);
|
extern PyObject* PyInit__struct(void);
|
||||||
extern PyObject* PyInit__datetime(void);
|
extern PyObject* PyInit__datetime(void);
|
||||||
extern PyObject* PyInit__functools(void);
|
extern PyObject* PyInit__functools(void);
|
||||||
@ -122,10 +126,14 @@ struct _inittab _PyImport_Inittab[] = {
|
|||||||
{"itertools", PyInit_itertools},
|
{"itertools", PyInit_itertools},
|
||||||
{"_collections", PyInit__collections},
|
{"_collections", PyInit__collections},
|
||||||
{"_symtable", PyInit__symtable},
|
{"_symtable", PyInit__symtable},
|
||||||
|
#if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_GAMES)
|
||||||
{"mmap", PyInit_mmap},
|
{"mmap", PyInit_mmap},
|
||||||
|
#endif
|
||||||
{"_csv", PyInit__csv},
|
{"_csv", PyInit__csv},
|
||||||
{"_sre", PyInit__sre},
|
{"_sre", PyInit__sre},
|
||||||
|
#if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)
|
||||||
{"winreg", PyInit_winreg},
|
{"winreg", PyInit_winreg},
|
||||||
|
#endif
|
||||||
{"_struct", PyInit__struct},
|
{"_struct", PyInit__struct},
|
||||||
{"_datetime", PyInit__datetime},
|
{"_datetime", PyInit__datetime},
|
||||||
{"_functools", PyInit__functools},
|
{"_functools", PyInit__functools},
|
||||||
|
@ -5,8 +5,10 @@
|
|||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
|
||||||
|
#ifdef Py_ENABLE_SHARED
|
||||||
/* Define extern variables omitted from minimal builds */
|
/* Define extern variables omitted from minimal builds */
|
||||||
void *PyWin_DLLhModule = NULL;
|
void *PyWin_DLLhModule = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
extern PyObject* PyInit_faulthandler(void);
|
extern PyObject* PyInit_faulthandler(void);
|
||||||
@ -14,7 +16,9 @@ extern PyObject* PyInit__tracemalloc(void);
|
|||||||
extern PyObject* PyInit_gc(void);
|
extern PyObject* PyInit_gc(void);
|
||||||
extern PyObject* PyInit_nt(void);
|
extern PyObject* PyInit_nt(void);
|
||||||
extern PyObject* PyInit__signal(void);
|
extern PyObject* PyInit__signal(void);
|
||||||
|
#if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)
|
||||||
extern PyObject* PyInit_winreg(void);
|
extern PyObject* PyInit_winreg(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
extern PyObject* PyInit__ast(void);
|
extern PyObject* PyInit__ast(void);
|
||||||
extern PyObject* PyInit__io(void);
|
extern PyObject* PyInit__io(void);
|
||||||
@ -35,7 +39,9 @@ struct _inittab _PyImport_Inittab[] = {
|
|||||||
{"_tokenize", PyInit__tokenize},
|
{"_tokenize", PyInit__tokenize},
|
||||||
{"_tracemalloc", PyInit__tracemalloc},
|
{"_tracemalloc", PyInit__tracemalloc},
|
||||||
|
|
||||||
|
#if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)
|
||||||
{"winreg", PyInit_winreg},
|
{"winreg", PyInit_winreg},
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This module "lives in" with marshal.c */
|
/* This module "lives in" with marshal.c */
|
||||||
{"marshal", PyMarshal_Init},
|
{"marshal", PyMarshal_Init},
|
||||||
|
@ -253,6 +253,8 @@ msvcrt_getch_impl(PyObject *module)
|
|||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MS_WINDOWS_DESKTOP
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
msvcrt.getwch -> wchar_t
|
msvcrt.getwch -> wchar_t
|
||||||
|
|
||||||
@ -271,6 +273,8 @@ msvcrt_getwch_impl(PyObject *module)
|
|||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* MS_WINDOWS_DESKTOP */
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
msvcrt.getche -> byte_char
|
msvcrt.getche -> byte_char
|
||||||
|
|
||||||
@ -289,6 +293,8 @@ msvcrt_getche_impl(PyObject *module)
|
|||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MS_WINDOWS_DESKTOP
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
msvcrt.getwche -> wchar_t
|
msvcrt.getwche -> wchar_t
|
||||||
|
|
||||||
@ -307,6 +313,8 @@ msvcrt_getwche_impl(PyObject *module)
|
|||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* MS_WINDOWS_DESKTOP */
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
msvcrt.putch
|
msvcrt.putch
|
||||||
|
|
||||||
@ -326,6 +334,8 @@ msvcrt_putch_impl(PyObject *module, char char_value)
|
|||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MS_WINDOWS_DESKTOP
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
msvcrt.putwch
|
msvcrt.putwch
|
||||||
|
|
||||||
@ -346,6 +356,8 @@ msvcrt_putwch_impl(PyObject *module, int unicode_char)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* MS_WINDOWS_DESKTOP */
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
msvcrt.ungetch
|
msvcrt.ungetch
|
||||||
|
|
||||||
@ -374,6 +386,8 @@ msvcrt_ungetch_impl(PyObject *module, char char_value)
|
|||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MS_WINDOWS_DESKTOP
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
msvcrt.ungetwch
|
msvcrt.ungetwch
|
||||||
|
|
||||||
@ -398,6 +412,8 @@ msvcrt_ungetwch_impl(PyObject *module, int unicode_char)
|
|||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* MS_WINDOWS_DESKTOP */
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
msvcrt.CrtSetReportFile -> HANDLE
|
msvcrt.CrtSetReportFile -> HANDLE
|
||||||
@ -475,6 +491,8 @@ msvcrt_set_error_mode_impl(PyObject *module, int mode)
|
|||||||
}
|
}
|
||||||
#endif /* _DEBUG */
|
#endif /* _DEBUG */
|
||||||
|
|
||||||
|
#if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_APP) || defined(MS_WINDOWS_SYSTEM)
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
msvcrt.GetErrorMode
|
msvcrt.GetErrorMode
|
||||||
|
|
||||||
@ -494,6 +512,8 @@ msvcrt_GetErrorMode_impl(PyObject *module)
|
|||||||
return PyLong_FromUnsignedLong(res);
|
return PyLong_FromUnsignedLong(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* MS_WINDOWS_APP || MS_WINDOWS_SYSTEM */
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
msvcrt.SetErrorMode
|
msvcrt.SetErrorMode
|
||||||
|
|
||||||
@ -601,10 +621,12 @@ PyInit_msvcrt(void)
|
|||||||
insertint(d, "LK_NBRLCK", _LK_NBRLCK);
|
insertint(d, "LK_NBRLCK", _LK_NBRLCK);
|
||||||
insertint(d, "LK_RLCK", _LK_RLCK);
|
insertint(d, "LK_RLCK", _LK_RLCK);
|
||||||
insertint(d, "LK_UNLCK", _LK_UNLCK);
|
insertint(d, "LK_UNLCK", _LK_UNLCK);
|
||||||
|
#ifdef MS_WINDOWS_DESKTOP
|
||||||
insertint(d, "SEM_FAILCRITICALERRORS", SEM_FAILCRITICALERRORS);
|
insertint(d, "SEM_FAILCRITICALERRORS", SEM_FAILCRITICALERRORS);
|
||||||
insertint(d, "SEM_NOALIGNMENTFAULTEXCEPT", SEM_NOALIGNMENTFAULTEXCEPT);
|
insertint(d, "SEM_NOALIGNMENTFAULTEXCEPT", SEM_NOALIGNMENTFAULTEXCEPT);
|
||||||
insertint(d, "SEM_NOGPFAULTERRORBOX", SEM_NOGPFAULTERRORBOX);
|
insertint(d, "SEM_NOGPFAULTERRORBOX", SEM_NOGPFAULTERRORBOX);
|
||||||
insertint(d, "SEM_NOOPENFILEERRORBOX", SEM_NOOPENFILEERRORBOX);
|
insertint(d, "SEM_NOOPENFILEERRORBOX", SEM_NOOPENFILEERRORBOX);
|
||||||
|
#endif
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
insertint(d, "CRT_WARN", _CRT_WARN);
|
insertint(d, "CRT_WARN", _CRT_WARN);
|
||||||
insertint(d, "CRT_ERROR", _CRT_ERROR);
|
insertint(d, "CRT_ERROR", _CRT_ERROR);
|
||||||
|
@ -72,9 +72,27 @@ WIN32 is still required for the locale module.
|
|||||||
#define USE_SOCKET
|
#define USE_SOCKET
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
|
#if defined(Py_BUILD_CORE) || defined(Py_BUILD_CORE_BUILTIN) || defined(Py_BUILD_CORE_MODULE)
|
||||||
#define MS_WINDOWS_NON_DESKTOP
|
#include <winapifamily.h>
|
||||||
|
|
||||||
|
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||||
|
#define MS_WINDOWS_DESKTOP
|
||||||
#endif
|
#endif
|
||||||
|
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
|
||||||
|
#define MS_WINDOWS_APP
|
||||||
|
#endif
|
||||||
|
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_SYSTEM)
|
||||||
|
#define MS_WINDOWS_SYSTEM
|
||||||
|
#endif
|
||||||
|
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_GAMES)
|
||||||
|
#define MS_WINDOWS_GAMES
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define to 1 if you support windows console io */
|
||||||
|
#if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_APP) || defined(MS_WINDOWS_SYSTEM)
|
||||||
|
#define HAVE_WINDOWS_CONSOLE_IO 1
|
||||||
|
#endif
|
||||||
|
#endif /* Py_BUILD_CORE || Py_BUILD_CORE_BUILTIN || Py_BUILD_CORE_MODULE */
|
||||||
|
|
||||||
/* Compiler specific defines */
|
/* Compiler specific defines */
|
||||||
|
|
||||||
@ -300,7 +318,7 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
|
|||||||
# endif /* Py_BUILD_CORE */
|
# endif /* Py_BUILD_CORE */
|
||||||
#endif /* MS_COREDLL */
|
#endif /* MS_COREDLL */
|
||||||
|
|
||||||
#if defined(MS_WIN64)
|
#ifdef MS_WIN64
|
||||||
/* maintain "win32" sys.platform for backward compatibility of Python code,
|
/* maintain "win32" sys.platform for backward compatibility of Python code,
|
||||||
the Win64 API should be close enough to the Win32 API to make this
|
the Win64 API should be close enough to the Win32 API to make this
|
||||||
preferable */
|
preferable */
|
||||||
|
25
PC/winreg.c
25
PC/winreg.c
@ -18,6 +18,8 @@
|
|||||||
#include "structmember.h" // PyMemberDef
|
#include "structmember.h" // PyMemberDef
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
#if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)
|
||||||
|
|
||||||
static BOOL PyHKEY_AsHKEY(PyObject *ob, HKEY *pRes, BOOL bNoneOK);
|
static BOOL PyHKEY_AsHKEY(PyObject *ob, HKEY *pRes, BOOL bNoneOK);
|
||||||
static BOOL clinic_HKEY_converter(PyObject *ob, void *p);
|
static BOOL clinic_HKEY_converter(PyObject *ob, void *p);
|
||||||
static PyObject *PyHKEY_FromHKEY(HKEY h);
|
static PyObject *PyHKEY_FromHKEY(HKEY h);
|
||||||
@ -829,6 +831,8 @@ winreg_CloseKey(PyObject *module, PyObject *hkey)
|
|||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
winreg.ConnectRegistry -> HKEY
|
winreg.ConnectRegistry -> HKEY
|
||||||
|
|
||||||
@ -866,6 +870,8 @@ winreg_ConnectRegistry_impl(PyObject *module,
|
|||||||
return retKey;
|
return retKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* MS_WINDOWS_DESKTOP || MS_WINDOWS_SYSTEM */
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
winreg.CreateKey -> HKEY
|
winreg.CreateKey -> HKEY
|
||||||
|
|
||||||
@ -1272,6 +1278,8 @@ winreg_ExpandEnvironmentStrings_impl(PyObject *module,
|
|||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
winreg.FlushKey
|
winreg.FlushKey
|
||||||
|
|
||||||
@ -1305,6 +1313,9 @@ winreg_FlushKey_impl(PyObject *module, HKEY key)
|
|||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* MS_WINDOWS_DESKTOP || MS_WINDOWS_SYSTEM */
|
||||||
|
|
||||||
|
#if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
winreg.LoadKey
|
winreg.LoadKey
|
||||||
@ -1354,6 +1365,8 @@ winreg_LoadKey_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key,
|
|||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* MS_WINDOWS_DESKTOP || MS_WINDOWS_SYSTEM */
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
winreg.OpenKey -> HKEY
|
winreg.OpenKey -> HKEY
|
||||||
|
|
||||||
@ -1463,6 +1476,7 @@ winreg_QueryInfoKey_impl(PyObject *module, HKEY key)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
winreg.QueryValue
|
winreg.QueryValue
|
||||||
|
|
||||||
@ -1634,6 +1648,8 @@ winreg_QueryValueEx_impl(PyObject *module, HKEY key, const Py_UNICODE *name)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
winreg.SaveKey
|
winreg.SaveKey
|
||||||
|
|
||||||
@ -1679,6 +1695,8 @@ winreg_SaveKey_impl(PyObject *module, HKEY key, const Py_UNICODE *file_name)
|
|||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* MS_WINDOWS_DESKTOP || MS_WINDOWS_SYSTEM */
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
winreg.SetValue
|
winreg.SetValue
|
||||||
|
|
||||||
@ -1776,6 +1794,7 @@ exit:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
winreg.SetValueEx
|
winreg.SetValueEx
|
||||||
|
|
||||||
@ -1861,6 +1880,8 @@ exit:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
winreg.DisableReflectionKey
|
winreg.DisableReflectionKey
|
||||||
|
|
||||||
@ -2009,6 +2030,8 @@ winreg_QueryReflectionKey_impl(PyObject *module, HKEY key)
|
|||||||
return PyBool_FromLong(result);
|
return PyBool_FromLong(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* MS_WINDOWS_DESKTOP || MS_WINDOWS_SYSTEM */
|
||||||
|
|
||||||
static struct PyMethodDef winreg_methods[] = {
|
static struct PyMethodDef winreg_methods[] = {
|
||||||
WINREG_CLOSEKEY_METHODDEF
|
WINREG_CLOSEKEY_METHODDEF
|
||||||
WINREG_CONNECTREGISTRY_METHODDEF
|
WINREG_CONNECTREGISTRY_METHODDEF
|
||||||
@ -2149,3 +2172,5 @@ PyMODINIT_FUNC PyInit_winreg(void)
|
|||||||
ADD_INT(REG_RESOURCE_REQUIREMENTS_LIST);
|
ADD_INT(REG_RESOURCE_REQUIREMENTS_LIST);
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* MS_WINDOWS_DESKTOP || MS_WINDOWS_SYSTEM || MS_WINDOWS_GAMES */
|
||||||
|
@ -13,7 +13,9 @@
|
|||||||
#include "pycore_fileutils.h" // _Py_BEGIN_SUPPRESS_IPH
|
#include "pycore_fileutils.h" // _Py_BEGIN_SUPPRESS_IPH
|
||||||
#include "pycore_pystate.h" // _PyThreadState_GET()
|
#include "pycore_pystate.h" // _PyThreadState_GET()
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
|
# ifndef WIN32_LEAN_AND_MEAN
|
||||||
# define WIN32_LEAN_AND_MEAN
|
# define WIN32_LEAN_AND_MEAN
|
||||||
|
# endif
|
||||||
# include "windows.h"
|
# include "windows.h"
|
||||||
#endif /* MS_WINDOWS */
|
#endif /* MS_WINDOWS */
|
||||||
|
|
||||||
@ -108,7 +110,7 @@ my_fgets(PyThreadState* tstate, char *buf, int len, FILE *fp)
|
|||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MS_WINDOWS
|
#ifdef HAVE_WINDOWS_CONSOLE_IO
|
||||||
/* Readline implementation using ReadConsoleW */
|
/* Readline implementation using ReadConsoleW */
|
||||||
|
|
||||||
extern char _get_console_type(HANDLE handle);
|
extern char _get_console_type(HANDLE handle);
|
||||||
@ -233,7 +235,7 @@ exit:
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif /* HAVE_WINDOWS_CONSOLE_IO */
|
||||||
|
|
||||||
|
|
||||||
/* Readline implementation using fgets() */
|
/* Readline implementation using fgets() */
|
||||||
@ -246,7 +248,7 @@ PyOS_StdioReadline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt)
|
|||||||
PyThreadState *tstate = _PyOS_ReadlineTState;
|
PyThreadState *tstate = _PyOS_ReadlineTState;
|
||||||
assert(tstate != NULL);
|
assert(tstate != NULL);
|
||||||
|
|
||||||
#ifdef MS_WINDOWS
|
#ifdef HAVE_WINDOWS_CONSOLE_IO
|
||||||
const PyConfig *config = _PyInterpreterState_GetConfig(tstate->interp);
|
const PyConfig *config = _PyInterpreterState_GetConfig(tstate->interp);
|
||||||
if (!config->legacy_windows_stdio && sys_stdin == stdin) {
|
if (!config->legacy_windows_stdio && sys_stdin == stdin) {
|
||||||
HANDLE hStdIn, hStdErr;
|
HANDLE hStdIn, hStdErr;
|
||||||
|
@ -163,6 +163,7 @@ static char *GetPythonImport (HINSTANCE hModule)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef Py_ENABLE_SHARED
|
||||||
/* Load python3.dll before loading any extension module that might refer
|
/* Load python3.dll before loading any extension module that might refer
|
||||||
to it. That way, we can be sure that always the python3.dll corresponding
|
to it. That way, we can be sure that always the python3.dll corresponding
|
||||||
to this python DLL is loaded, not a python3.dll that might be on the path
|
to this python DLL is loaded, not a python3.dll that might be on the path
|
||||||
@ -216,6 +217,7 @@ _Py_CheckPython3(void)
|
|||||||
return hPython3 != NULL;
|
return hPython3 != NULL;
|
||||||
#undef MAXPATHLEN
|
#undef MAXPATHLEN
|
||||||
}
|
}
|
||||||
|
#endif /* Py_ENABLE_SHARED */
|
||||||
|
|
||||||
dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
|
dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
|
||||||
const char *shortname,
|
const char *shortname,
|
||||||
@ -224,7 +226,9 @@ dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
|
|||||||
dl_funcptr p;
|
dl_funcptr p;
|
||||||
char funcname[258], *import_python;
|
char funcname[258], *import_python;
|
||||||
|
|
||||||
|
#ifdef Py_ENABLE_SHARED
|
||||||
_Py_CheckPython3();
|
_Py_CheckPython3();
|
||||||
|
#endif /* Py_ENABLE_SHARED */
|
||||||
|
|
||||||
wchar_t *wpathname = PyUnicode_AsWideCharString(pathname, NULL);
|
wchar_t *wpathname = PyUnicode_AsWideCharString(pathname, NULL);
|
||||||
if (wpathname == NULL)
|
if (wpathname == NULL)
|
||||||
@ -234,10 +238,12 @@ dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
|
|||||||
|
|
||||||
{
|
{
|
||||||
HINSTANCE hDLL = NULL;
|
HINSTANCE hDLL = NULL;
|
||||||
|
#ifdef MS_WINDOWS_DESKTOP
|
||||||
unsigned int old_mode;
|
unsigned int old_mode;
|
||||||
|
|
||||||
/* Don't display a message box when Python can't load a DLL */
|
/* Don't display a message box when Python can't load a DLL */
|
||||||
old_mode = SetErrorMode(SEM_FAILCRITICALERRORS);
|
old_mode = SetErrorMode(SEM_FAILCRITICALERRORS);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* bpo-36085: We use LoadLibraryEx with restricted search paths
|
/* bpo-36085: We use LoadLibraryEx with restricted search paths
|
||||||
to avoid DLL preloading attacks and enable use of the
|
to avoid DLL preloading attacks and enable use of the
|
||||||
@ -250,8 +256,10 @@ dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
|
|||||||
Py_END_ALLOW_THREADS
|
Py_END_ALLOW_THREADS
|
||||||
PyMem_Free(wpathname);
|
PyMem_Free(wpathname);
|
||||||
|
|
||||||
|
#ifdef MS_WINDOWS_DESKTOP
|
||||||
/* restore old error mode settings */
|
/* restore old error mode settings */
|
||||||
SetErrorMode(old_mode);
|
SetErrorMode(old_mode);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (hDLL==NULL){
|
if (hDLL==NULL){
|
||||||
PyObject *message;
|
PyObject *message;
|
||||||
|
@ -8,7 +8,11 @@
|
|||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
# include <malloc.h>
|
# include <malloc.h>
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <pathcch.h> // PathCchCombineEx
|
# if defined(MS_WINDOWS_GAMES) && !defined(MS_WINDOWS_DESKTOP)
|
||||||
|
# define PATHCCH_ALLOW_LONG_PATHS 0x01
|
||||||
|
# else
|
||||||
|
# include <pathcch.h> // PathCchCombineEx
|
||||||
|
# endif
|
||||||
extern int winerror_to_errno(int);
|
extern int winerror_to_errno(int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -77,7 +81,8 @@ _Py_device_encoding(int fd)
|
|||||||
if (!valid)
|
if (!valid)
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
|
|
||||||
#if defined(MS_WINDOWS)
|
#ifdef MS_WINDOWS
|
||||||
|
#ifdef HAVE_WINDOWS_CONSOLE_IO
|
||||||
UINT cp;
|
UINT cp;
|
||||||
if (fd == 0)
|
if (fd == 0)
|
||||||
cp = GetConsoleCP();
|
cp = GetConsoleCP();
|
||||||
@ -92,6 +97,9 @@ _Py_device_encoding(int fd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return PyUnicode_FromFormat("cp%u", (unsigned int)cp);
|
return PyUnicode_FromFormat("cp%u", (unsigned int)cp);
|
||||||
|
#else
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
#endif /* HAVE_WINDOWS_CONSOLE_IO */
|
||||||
#else
|
#else
|
||||||
if (_PyRuntime.preconfig.utf8_mode) {
|
if (_PyRuntime.preconfig.utf8_mode) {
|
||||||
_Py_DECLARE_STR(utf_8, "utf-8");
|
_Py_DECLARE_STR(utf_8, "utf-8");
|
||||||
@ -1270,6 +1278,13 @@ _Py_stat(PyObject *path, struct stat *statbuf)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MS_WINDOWS
|
||||||
|
// For some Windows API partitions, SetHandleInformation() is declared
|
||||||
|
// but none of the handle flags are defined.
|
||||||
|
#ifndef HANDLE_FLAG_INHERIT
|
||||||
|
#define HANDLE_FLAG_INHERIT 0x00000001
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This function MUST be kept async-signal-safe on POSIX when raise=0. */
|
/* This function MUST be kept async-signal-safe on POSIX when raise=0. */
|
||||||
static int
|
static int
|
||||||
@ -2096,6 +2111,72 @@ _Py_abspath(const wchar_t *path, wchar_t **abspath_p)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The Windows Games API family implements the PathCch* APIs in the Xbox OS,
|
||||||
|
// but does not expose them yet. Load them dynamically until
|
||||||
|
// 1) they are officially exposed
|
||||||
|
// 2) we stop supporting older versions of the GDK which do not expose them
|
||||||
|
#if defined(MS_WINDOWS_GAMES) && !defined(MS_WINDOWS_DESKTOP)
|
||||||
|
HRESULT
|
||||||
|
PathCchSkipRoot(const wchar_t *path, const wchar_t **rootEnd)
|
||||||
|
{
|
||||||
|
static int initialized = 0;
|
||||||
|
typedef HRESULT(__stdcall *PPathCchSkipRoot) (PCWSTR pszPath,
|
||||||
|
PCWSTR *ppszRootEnd);
|
||||||
|
static PPathCchSkipRoot _PathCchSkipRoot;
|
||||||
|
|
||||||
|
if (initialized == 0) {
|
||||||
|
HMODULE pathapi = LoadLibraryExW(L"api-ms-win-core-path-l1-1-0.dll", NULL,
|
||||||
|
LOAD_LIBRARY_SEARCH_SYSTEM32);
|
||||||
|
if (pathapi) {
|
||||||
|
_PathCchSkipRoot = (PPathCchSkipRoot)GetProcAddress(
|
||||||
|
pathapi, "PathCchSkipRoot");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_PathCchSkipRoot = NULL;
|
||||||
|
}
|
||||||
|
initialized = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_PathCchSkipRoot) {
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _PathCchSkipRoot(path, rootEnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT
|
||||||
|
PathCchCombineEx(wchar_t *buffer, size_t bufsize, const wchar_t *dirname,
|
||||||
|
const wchar_t *relfile, unsigned long flags)
|
||||||
|
{
|
||||||
|
static int initialized = 0;
|
||||||
|
typedef HRESULT(__stdcall *PPathCchCombineEx) (PWSTR pszPathOut,
|
||||||
|
size_t cchPathOut,
|
||||||
|
PCWSTR pszPathIn,
|
||||||
|
PCWSTR pszMore,
|
||||||
|
unsigned long dwFlags);
|
||||||
|
static PPathCchCombineEx _PathCchCombineEx;
|
||||||
|
|
||||||
|
if (initialized == 0) {
|
||||||
|
HMODULE pathapi = LoadLibraryExW(L"api-ms-win-core-path-l1-1-0.dll", NULL,
|
||||||
|
LOAD_LIBRARY_SEARCH_SYSTEM32);
|
||||||
|
if (pathapi) {
|
||||||
|
_PathCchCombineEx = (PPathCchCombineEx)GetProcAddress(
|
||||||
|
pathapi, "PathCchCombineEx");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_PathCchCombineEx = NULL;
|
||||||
|
}
|
||||||
|
initialized = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_PathCchCombineEx) {
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _PathCchCombineEx(buffer, bufsize, dirname, relfile, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* defined(MS_WINDOWS_GAMES) && !defined(MS_WINDOWS_DESKTOP) */
|
||||||
|
|
||||||
// The caller must ensure "buffer" is big enough.
|
// The caller must ensure "buffer" is big enough.
|
||||||
static int
|
static int
|
||||||
@ -2491,12 +2572,12 @@ _Py_get_blocking(int fd)
|
|||||||
success = GetNamedPipeHandleStateW(handle, &mode,
|
success = GetNamedPipeHandleStateW(handle, &mode,
|
||||||
NULL, NULL, NULL, NULL, 0);
|
NULL, NULL, NULL, NULL, 0);
|
||||||
Py_END_ALLOW_THREADS
|
Py_END_ALLOW_THREADS
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
PyErr_SetFromWindowsErr(0);
|
PyErr_SetFromWindowsErr(0);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return !(mode & PIPE_NOWAIT);
|
return !(mode & PIPE_NOWAIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2289,7 +2289,7 @@ create_stdio(const PyConfig *config, PyObject* io,
|
|||||||
raw = Py_NewRef(buf);
|
raw = Py_NewRef(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MS_WINDOWS
|
#ifdef HAVE_WINDOWS_CONSOLE_IO
|
||||||
/* Windows console IO is always UTF-8 encoded */
|
/* Windows console IO is always UTF-8 encoded */
|
||||||
PyTypeObject *winconsoleio_type = (PyTypeObject *)_PyImport_GetModuleAttr(
|
PyTypeObject *winconsoleio_type = (PyTypeObject *)_PyImport_GetModuleAttr(
|
||||||
&_Py_ID(_io), &_Py_ID(_WindowsConsoleIO));
|
&_Py_ID(_io), &_Py_ID(_WindowsConsoleIO));
|
||||||
|
@ -1490,6 +1490,9 @@ static PyStructSequence_Desc windows_version_desc = {
|
|||||||
static PyObject *
|
static PyObject *
|
||||||
_sys_getwindowsversion_from_kernel32()
|
_sys_getwindowsversion_from_kernel32()
|
||||||
{
|
{
|
||||||
|
#ifndef MS_WINDOWS_DESKTOP
|
||||||
|
return NULL;
|
||||||
|
#else
|
||||||
HANDLE hKernel32;
|
HANDLE hKernel32;
|
||||||
wchar_t kernel32_path[MAX_PATH];
|
wchar_t kernel32_path[MAX_PATH];
|
||||||
LPVOID verblock;
|
LPVOID verblock;
|
||||||
@ -1523,6 +1526,7 @@ _sys_getwindowsversion_from_kernel32()
|
|||||||
realBuild = HIWORD(ffi->dwProductVersionLS);
|
realBuild = HIWORD(ffi->dwProductVersionLS);
|
||||||
PyMem_RawFree(verblock);
|
PyMem_RawFree(verblock);
|
||||||
return Py_BuildValue("(kkk)", realMajor, realMinor, realBuild);
|
return Py_BuildValue("(kkk)", realMajor, realMinor, realBuild);
|
||||||
|
#endif /* !MS_WINDOWS_DESKTOP */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disable deprecation warnings about GetVersionEx as the result is
|
/* Disable deprecation warnings about GetVersionEx as the result is
|
||||||
|
Loading…
Reference in New Issue
Block a user