From bc95cf8c844be819e26a58fa76b36357af5aebbb Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Sun, 29 Aug 2004 14:46:02 +0000 Subject: [PATCH] implemented SetProcessPriorityBoost() and GetProcessPriorityBoost() (only the kernel32 part) svn path=/trunk/; revision=10731 --- reactos/lib/kernel32/misc/stubs.c | 30 +--------------- reactos/lib/kernel32/process/proc.c | 54 ++++++++++++++++++++++++++++- 2 files changed, 54 insertions(+), 30 deletions(-) diff --git a/reactos/lib/kernel32/misc/stubs.c b/reactos/lib/kernel32/misc/stubs.c index 5ea04beab63..d47ac31bb45 100644 --- a/reactos/lib/kernel32/misc/stubs.c +++ b/reactos/lib/kernel32/misc/stubs.c @@ -1,4 +1,4 @@ -/* $Id: stubs.c,v 1.81 2004/07/30 19:18:39 jimtabor Exp $ +/* $Id: stubs.c,v 1.82 2004/08/29 14:45:55 weiden Exp $ * * KERNEL32.DLL stubs (unimplemented functions) * Remove from this file, if you implement them. @@ -873,20 +873,6 @@ GetProcessHandleCount( return 0; } -/* - * @unimplemented - */ -BOOL -STDCALL -GetProcessPriorityBoost( - HANDLE hProcess, - PBOOL pDisablePriorityBoost - ) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; -} - /* * @unimplemented */ @@ -1298,20 +1284,6 @@ SetMessageWaitingIndicator( return 0; } -/* - * @unimplemented - */ -BOOL -STDCALL -SetProcessPriorityBoost( - HANDLE hProcess, - BOOL bDisablePriorityBoost - ) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; -} - /* * @unimplemented */ diff --git a/reactos/lib/kernel32/process/proc.c b/reactos/lib/kernel32/process/proc.c index a0fc16931f1..7c4aa317d7c 100644 --- a/reactos/lib/kernel32/process/proc.c +++ b/reactos/lib/kernel32/process/proc.c @@ -1,4 +1,4 @@ -/* $Id: proc.c,v 1.63 2004/07/02 12:18:04 gvg Exp $ +/* $Id: proc.c,v 1.64 2004/08/29 14:46:02 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries @@ -868,4 +868,56 @@ GetProcessIoCounters( return TRUE; } + +/* + * @implemented + */ +BOOL +STDCALL +GetProcessPriorityBoost(HANDLE hProcess, + PBOOL pDisablePriorityBoost) +{ + NTSTATUS Status; + BOOL PriorityBoost; + + Status = NtQueryInformationProcess(hProcess, + ProcessPriorityBoost, + &PriorityBoost, + sizeof(BOOL), + NULL); + if (NT_SUCCESS(Status)) + { + *pDisablePriorityBoost = PriorityBoost; + return TRUE; + } + + SetLastErrorByStatus(Status); + return FALSE; +} + + +/* + * @implemented + */ +BOOL +STDCALL +SetProcessPriorityBoost(HANDLE hProcess, + BOOL bDisablePriorityBoost) +{ + NTSTATUS Status; + BOOL PriorityBoost = (bDisablePriorityBoost ? TRUE : FALSE); /* prevent setting values other than 1 and 0 */ + + Status = NtSetInformationProcess(hProcess, + ProcessPriorityBoost, + &PriorityBoost, + sizeof(BOOL)); + if (!NT_SUCCESS(Status)) + { + SetLastErrorByStatus(Status); + return FALSE; + } + + return TRUE; +} + /* EOF */