diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2019-03-05 22:11:01 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2019-03-05 22:11:01 +0100 |
commit | f832aa7f008dfeabca61599c539b7b28dd5d4aab (patch) | |
tree | 01b92724560ace9c05b8ed210298c5047bf02c60 | |
parent | 3621689c94fb85d3431f5437ff5a8da13cdbeb56 (diff) | |
download | psutil-f832aa7f008dfeabca61599c539b7b28dd5d4aab.tar.gz |
#1448: fix Wine support due to missing rtlIpv6AddressToStringA
-rw-r--r-- | HISTORY.rst | 2 | ||||
-rw-r--r-- | psutil/_psutil_windows.c | 6 | ||||
-rw-r--r-- | psutil/arch/windows/global.c | 9 |
3 files changed, 10 insertions, 7 deletions
diff --git a/HISTORY.rst b/HISTORY.rst index d2229138..2c9b6215 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,6 +7,8 @@ **Bug fixes** - 1329_: [AIX] psutil doesn't compile on AIX 6.1. (patch by Arnon Yaari) +- 1448_: [Windows] crash on import due to rtlIpv6AddressToStringA not available + on Wine. 5.6.0 ===== diff --git a/psutil/_psutil_windows.c b/psutil/_psutil_windows.c index 5c05ac38..2a498bb1 100644 --- a/psutil/_psutil_windows.c +++ b/psutil/_psutil_windows.c @@ -1565,7 +1565,8 @@ psutil_net_connections(PyObject *self, PyObject *args) { // TCP IPv6 if ((PySequence_Contains(py_af_filter, _AF_INET6) == 1) && - (PySequence_Contains(py_type_filter, _SOCK_STREAM) == 1)) + (PySequence_Contains(py_type_filter, _SOCK_STREAM) == 1) && + (psutil_rtlIpv6AddressToStringA != NULL)) { table = NULL; py_conn_tuple = NULL; @@ -1715,7 +1716,8 @@ psutil_net_connections(PyObject *self, PyObject *args) { // UDP IPv6 if ((PySequence_Contains(py_af_filter, _AF_INET6) == 1) && - (PySequence_Contains(py_type_filter, _SOCK_DGRAM) == 1)) + (PySequence_Contains(py_type_filter, _SOCK_DGRAM) == 1) && + (psutil_rtlIpv6AddressToStringA != NULL)) { table = NULL; py_conn_tuple = NULL; diff --git a/psutil/arch/windows/global.c b/psutil/arch/windows/global.c index a622b635..a6a59abb 100644 --- a/psutil/arch/windows/global.c +++ b/psutil/arch/windows/global.c @@ -95,11 +95,6 @@ psutil_loadlibs() { if (! psutil_rtlIpv4AddressToStringA) return 1; - psutil_rtlIpv6AddressToStringA = psutil_GetProcAddressFromLib( - "ntdll.dll", "RtlIpv6AddressToStringA"); - if (! psutil_rtlIpv6AddressToStringA) - return 1; - // minimum requirement: Win XP SP3 psutil_GetExtendedTcpTable = psutil_GetProcAddressFromLib( "iphlpapi.dll", "GetExtendedTcpTable"); @@ -130,6 +125,10 @@ psutil_loadlibs() { /* * Optional. */ + // not available on Wine + psutil_rtlIpv6AddressToStringA = psutil_GetProcAddressFromLib( + "ntdll.dll", "RtlIpv6AddressToStringA"); + // minimum requirement: Win Vista psutil_GetTickCount64 = psutil_GetProcAddress( "kernel32", "GetTickCount64"); |