diff options
author | Minmin Gong <gongminmin@msn.com> | 2019-02-02 20:26:55 -0800 |
---|---|---|
committer | Steve Dower <steve.dower@microsoft.com> | 2019-02-02 20:26:55 -0800 |
commit | 8ebc6451f36fa213130c316199dbec5ad8a02163 (patch) | |
tree | 8462031060a85ff44ddb0e45d5550a3900f6a18f /Python/sysmodule.c | |
parent | 4c70d9f79c9b371990c8e054ccde53f7ff15946b (diff) | |
download | cpython-git-8ebc6451f36fa213130c316199dbec5ad8a02163.tar.gz |
bpo-35890 : Fix some API calling consistency (GH-11742)
Unicode version of Windows APIs are used in places, but not for GetVersionEx in Python/sysmodule.c
The wcstok_s is called on Windows in Modules/main.c and PC/launcher.c, but not in Python/pathconfig.c
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r-- | Python/sysmodule.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c index c7e68aa364..dd39305f39 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1126,7 +1126,7 @@ sys_getwindowsversion_impl(PyObject *module) { PyObject *version; int pos = 0; - OSVERSIONINFOEX ver; + OSVERSIONINFOEXW ver; DWORD realMajor, realMinor, realBuild; HANDLE hKernel32; wchar_t kernel32_path[MAX_PATH]; @@ -1134,7 +1134,7 @@ sys_getwindowsversion_impl(PyObject *module) DWORD verblock_size; ver.dwOSVersionInfoSize = sizeof(ver); - if (!GetVersionEx((OSVERSIONINFO*) &ver)) + if (!GetVersionExW((OSVERSIONINFOW*) &ver)) return PyErr_SetFromWindowsErr(0); version = PyStructSequence_New(&WindowsVersionType); @@ -1145,7 +1145,7 @@ sys_getwindowsversion_impl(PyObject *module) PyStructSequence_SET_ITEM(version, pos++, PyLong_FromLong(ver.dwMinorVersion)); PyStructSequence_SET_ITEM(version, pos++, PyLong_FromLong(ver.dwBuildNumber)); PyStructSequence_SET_ITEM(version, pos++, PyLong_FromLong(ver.dwPlatformId)); - PyStructSequence_SET_ITEM(version, pos++, PyUnicode_FromString(ver.szCSDVersion)); + PyStructSequence_SET_ITEM(version, pos++, PyUnicode_FromWideChar(ver.szCSDVersion, -1)); PyStructSequence_SET_ITEM(version, pos++, PyLong_FromLong(ver.wServicePackMajor)); PyStructSequence_SET_ITEM(version, pos++, PyLong_FromLong(ver.wServicePackMinor)); PyStructSequence_SET_ITEM(version, pos++, PyLong_FromLong(ver.wSuiteMask)); |