summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2019-02-20 04:27:36 -0800
committerGiampaolo Rodola <g.rodola@gmail.com>2019-02-20 04:27:36 -0800
commitcf5fa7341eb0a05635704f6bbd683c5438d35353 (patch)
treee4d555ba5aacd1b4bf60f611136f8e0f53ec1470
parent5ebac31f1e349a78aa8acdbfa640e7b8aacfa774 (diff)
downloadpsutil-cf5fa7341eb0a05635704f6bbd683c5438d35353.tar.gz
port NtSetInformationProcess
-rw-r--r--psutil/_psutil_windows.c7
-rw-r--r--psutil/arch/windows/global.c3
-rw-r--r--psutil/arch/windows/global.h6
3 files changed, 6 insertions, 10 deletions
diff --git a/psutil/_psutil_windows.c b/psutil/_psutil_windows.c
index c7667d78..118a9e59 100644
--- a/psutil/_psutil_windows.c
+++ b/psutil/_psutil_windows.c
@@ -2143,19 +2143,14 @@ psutil_proc_io_priority_set(PyObject *self, PyObject *args) {
DWORD prio;
HANDLE hProcess;
DWORD access = PROCESS_QUERY_INFORMATION | PROCESS_SET_INFORMATION;
- _NtSetInformationProcess NtSetInformationProcess;
- NtSetInformationProcess = \
- psutil_GetProcAddress("ntdll.dll", "NtSetInformationProcess");
- if (NtSetInformationProcess == NULL)
- return NULL;
if (! PyArg_ParseTuple(args, "li", &pid, &prio))
return NULL;
hProcess = psutil_handle_from_pid(pid, access);
if (hProcess == NULL)
return NULL;
- NtSetInformationProcess(
+ psutil_NtSetInformationProcess(
hProcess,
ProcessIoPriority,
(PVOID)&prio,
diff --git a/psutil/arch/windows/global.c b/psutil/arch/windows/global.c
index ffc29263..cfddcb95 100644
--- a/psutil/arch/windows/global.c
+++ b/psutil/arch/windows/global.c
@@ -63,12 +63,13 @@ psutil_load_globals() {
if (! psutil_NtQueryInformationProcess)
return 1;
-/*
psutil_NtSetInformationProcess = ps_GetProcAddress(
"ntdll.dll", "NtSetInformationProcess");
if (! psutil_NtSetInformationProcess)
return 1;
+
+/*
psutil_WinStationQueryInformationW = ps_GetProcAddressFromLib(
"winsta.dll", "WinStationQueryInformationW");
if (! psutil_WinStationQueryInformationW)
diff --git a/psutil/arch/windows/global.h b/psutil/arch/windows/global.h
index aee5b986..7d14b464 100644
--- a/psutil/arch/windows/global.h
+++ b/psutil/arch/windows/global.h
@@ -31,9 +31,6 @@ _RtlIpv4AddressToStringA \
_RtlIpv6AddressToStringA \
psutil_rtlIpv6AddressToStringA;
-_NtSetInformationProcess
- psutil_NtSetInformationProcess;
-
_GetActiveProcessorCount \
psutil_GetActiveProcessorCount;
@@ -56,5 +53,8 @@ NTQSI_PROC \
_NtQueryInformationProcess \
psutil_NtQueryInformationProcess;
+_NtSetInformationProcess
+ psutil_NtSetInformationProcess;
+
int psutil_load_globals();