diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2019-02-20 04:29:28 -0800 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2019-02-20 04:29:28 -0800 |
commit | b2979388a263c669d40ffe9900afe02224033214 (patch) | |
tree | bae255165df99c0a9f7a7c2e5aea39912a304be4 | |
parent | cf5fa7341eb0a05635704f6bbd683c5438d35353 (diff) | |
download | psutil-b2979388a263c669d40ffe9900afe02224033214.tar.gz |
port WinStationQueryInformationW
-rw-r--r-- | psutil/_psutil_windows.c | 18 | ||||
-rw-r--r-- | psutil/arch/windows/global.c | 4 | ||||
-rw-r--r-- | psutil/arch/windows/global.h | 6 |
3 files changed, 12 insertions, 16 deletions
diff --git a/psutil/_psutil_windows.c b/psutil/_psutil_windows.c index 118a9e59..db2f27a8 100644 --- a/psutil/_psutil_windows.c +++ b/psutil/_psutil_windows.c @@ -2757,11 +2757,6 @@ psutil_users(PyObject *self, PyObject *args) { if (py_retlist == NULL) return NULL; - WinStationQueryInformationW = psutil_GetProcAddressFromLib( - "winsta.dll", "WinStationQueryInformationW"); - if (WinStationQueryInformationW == NULL) - goto error; - if (WTSEnumerateSessions(hServer, 0, 1, &sessions, &count) == 0) { PyErr_SetFromWindowsErr(0); goto error; @@ -2815,12 +2810,13 @@ psutil_users(PyObject *self, PyObject *args) { } // login time - if (!WinStationQueryInformationW(hServer, - sessionId, - WinStationInformation, - &station_info, - sizeof(station_info), - &returnLen)) + if (! psutil_WinStationQueryInformationW( + hServer, + sessionId, + WinStationInformation, + &station_info, + sizeof(station_info), + &returnLen)) { goto error; } diff --git a/psutil/arch/windows/global.c b/psutil/arch/windows/global.c index cfddcb95..bf19c777 100644 --- a/psutil/arch/windows/global.c +++ b/psutil/arch/windows/global.c @@ -68,13 +68,13 @@ psutil_load_globals() { if (! psutil_NtSetInformationProcess) return 1; - -/* psutil_WinStationQueryInformationW = ps_GetProcAddressFromLib( "winsta.dll", "WinStationQueryInformationW"); if (! psutil_WinStationQueryInformationW) return 1; + +/* psutil_rtlIpv4AddressToStringA = ps_GetProcAddressFromLib( "ntdll.dll", "RtlIpv4AddressToStringA"); if (! psutil_rtlIpv4AddressToStringA) diff --git a/psutil/arch/windows/global.h b/psutil/arch/windows/global.h index 7d14b464..69211d86 100644 --- a/psutil/arch/windows/global.h +++ b/psutil/arch/windows/global.h @@ -34,9 +34,6 @@ _RtlIpv6AddressToStringA \ _GetActiveProcessorCount \ psutil_GetActiveProcessorCount; -PWINSTATIONQUERYINFORMATIONW \ - psutil_WinStationQueryInformationW; - _GetTickCount64 \ psutil_GetTickCount64; @@ -56,5 +53,8 @@ _NtQueryInformationProcess \ _NtSetInformationProcess psutil_NtSetInformationProcess; +PWINSTATIONQUERYINFORMATIONW \ + psutil_WinStationQueryInformationW; + int psutil_load_globals(); |