From 4e5733c2c5e67d4bbcb1927e0f93806bc542e644 Mon Sep 17 00:00:00 2001 From: Clement Rouault Date: Fri, 10 Nov 2017 14:20:59 +0100 Subject: [PATCH] Process.prioroty now use the FlagMapper --- windows/winobject/process.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/windows/winobject/process.py b/windows/winobject/process.py index cfc1a32..85849de 100644 --- a/windows/winobject/process.py +++ b/windows/winobject/process.py @@ -681,8 +681,18 @@ class Process(AutoHandle): user = (UserTime.dwHighDateTime << 32) + UserTime.dwLowDateTime return TimeInfo(creation, exit, kernel, user) + PRIORITY_CLASS_MAPPER = gdef.FlagMapper( + ABOVE_NORMAL_PRIORITY_CLASS, + BELOW_NORMAL_PRIORITY_CLASS, + HIGH_PRIORITY_CLASS, + IDLE_PRIORITY_CLASS, + NORMAL_PRIORITY_CLASS, + PROCESS_MODE_BACKGROUND_BEGIN, + PROCESS_MODE_BACKGROUND_END, + REALTIME_PRIORITY_CLASS) + def get_priority(self): - return winproxy.GetPriorityClass(self.handle) + return self.PRIORITY_CLASS_MAPPER[winproxy.GetPriorityClass(self.handle)] def set_priority(self, priority): return winproxy.SetPriorityClass(self.handle, priority)