mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-26 19:33:31 +00:00
[NTOS:EX] Fix swapped values in ExGetCurrentProcessorCounts() (#4565)
The function should return the kernel time for the idle thread in the first argument, and kernel time + user time for the current thread in the second argument. Also retrieve the processor number from the cached PRCB instead of calling KeGetCurrentProcessorNumber() which retrieves the PRCB again since the processor could switch in-between those calls. NdisGetCurrentProcessorCounts() function follows the same prototype which is the correct one.
This commit is contained in:
committed by
Stanislav Motylkov
parent
bc85db7d8c
commit
8e01dee251
@@ -45,8 +45,8 @@
|
||||
VOID
|
||||
NTAPI
|
||||
ExGetCurrentProcessorCounts(
|
||||
PULONG ThreadKernelTime,
|
||||
PULONG TotalCpuTime,
|
||||
PULONG IdleTime,
|
||||
PULONG KernelAndUserTime,
|
||||
PULONG ProcessorNumber);
|
||||
|
||||
VOID
|
||||
|
||||
@@ -342,17 +342,17 @@ ExGetCurrentProcessorCpuUsage(PULONG CpuUsage)
|
||||
*/
|
||||
VOID
|
||||
NTAPI
|
||||
ExGetCurrentProcessorCounts(PULONG ThreadKernelTime,
|
||||
PULONG TotalCpuTime,
|
||||
ExGetCurrentProcessorCounts(PULONG IdleTime,
|
||||
PULONG KernelAndUserTime,
|
||||
PULONG ProcessorNumber)
|
||||
{
|
||||
PKPRCB Prcb;
|
||||
|
||||
Prcb = KeGetCurrentPrcb();
|
||||
|
||||
*ThreadKernelTime = Prcb->KernelTime + Prcb->UserTime;
|
||||
*TotalCpuTime = Prcb->CurrentThread->KernelTime;
|
||||
*ProcessorNumber = KeGetCurrentProcessorNumber();
|
||||
*IdleTime = Prcb->IdleThread->KernelTime;
|
||||
*KernelAndUserTime = Prcb->KernelTime + Prcb->UserTime;
|
||||
*ProcessorNumber = (ULONG)Prcb->Number;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user