mrac tries to get function pointers for these functions using MmGetSystemRoutineAddress, I haven't seen them being used by it, but might as well implement it since they are very easy to implement.
-- v7: ntoskrnl.exe: Implement KeQueryActiveProcessorCount. ntoskrnl.exe: implement KeQueryMaximumProcessorCount/Ex.
From: Etaash Mathamsetty etaash.mathamsetty@gmail.com
--- dlls/ntoskrnl.exe/ntoskrnl.c | 16 ++++++++++++++++ dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 4 ++++ include/winbase.h | 1 + 3 files changed, 21 insertions(+)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index 9320e02dca9..ebf15dfc1d1 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -3414,6 +3414,22 @@ ULONG WINAPI KeGetCurrentProcessorNumberEx(PPROCESSOR_NUMBER process_number) return cur_number; }
+/*********************************************************************** + * KeQueryMaximumProcessorCountEx (NTOSKRNL.EXE.@) + */ +ULONG WINAPI KeQueryMaximumProcessorCountEx(USHORT group_number) +{ + return (ULONG) GetMaximumProcessorCount(group_number); +} + +/*********************************************************************** + * KeQueryMaximumProcessorCount (NTOSKRNL.EXE.@) + */ +ULONG WINAPI KeQueryMaximumProcessorCount(void) +{ + return KeQueryActiveProcessorCountEx(ALL_PROCESSOR_GROUPS); +} + /*********************************************************************** * READ_REGISTER_BUFFER_UCHAR (NTOSKRNL.EXE.@) */ diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index 8f8edcac7a0..aaf7fc8ac3d 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -599,12 +599,16 @@ @ stub KePulseEvent @ stdcall KeQueryActiveProcessors() @ stdcall KeQueryActiveProcessorCountEx(long) +@ stdcall KeQueryActiveGroupCount() GetActiveProcessorGroupCount @ stdcall KeQueryInterruptTime() @ stdcall KeQueryPriorityThread(ptr) @ stub KeQueryRuntimeThread @ stdcall KeQuerySystemTime(ptr) @ stdcall KeQueryTickCount(ptr) @ stdcall KeQueryTimeIncrement() +@ stdcall KeQueryMaximumGroupCount() GetMaximumProcessorGroupCount +@ stdcall KeQueryMaximumProcessorCountEx(long) +@ stdcall KeQueryMaximumProcessorCount() @ stub KeRaiseUserException @ stdcall KeReadStateEvent(ptr) @ stub KeReadStateMutant diff --git a/include/winbase.h b/include/winbase.h index 7c0d8afd36c..8357a369564 100644 --- a/include/winbase.h +++ b/include/winbase.h @@ -2201,6 +2201,7 @@ WINBASEAPI DWORD WINAPI GetLongPathNameA(LPCSTR,LPSTR,DWORD); WINBASEAPI DWORD WINAPI GetLongPathNameW(LPCWSTR,LPWSTR,DWORD); #define GetLongPathName WINELIB_NAME_AW(GetLongPathName) WINBASEAPI BOOL WINAPI GetMailslotInfo(HANDLE,LPDWORD,LPDWORD,LPDWORD,LPDWORD); +WINBASEAPI DWORD WINAPI GetMaximumProcessorCount(WORD); WINBASEAPI DWORD WINAPI GetModuleFileNameA(HMODULE,LPSTR,DWORD); WINBASEAPI DWORD WINAPI GetModuleFileNameW(HMODULE,LPWSTR,DWORD); #define GetModuleFileName WINELIB_NAME_AW(GetModuleFileName)
From: Etaash Mathamsetty etaash.mathamsetty@gmail.com
--- dlls/ntoskrnl.exe/ntoskrnl.c | 10 ++++++++++ dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 1 + 2 files changed, 11 insertions(+)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index ebf15dfc1d1..836dec279e4 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -2602,6 +2602,16 @@ ULONG WINAPI KeQueryActiveProcessorCountEx(USHORT group_number) return GetActiveProcessorCount(group_number); }
+ULONG WINAPI KeQueryActiveProcessorCount(PKAFFINITY active_processors) +{ + TRACE("active_processors %p.\n", active_processors); + + if(active_processors) + *active_processors = KeQueryActiveProcessors(); + + return KeQueryActiveProcessorCountEx(ALL_PROCESSOR_GROUPS); +} + /********************************************************************** * KeQueryInterruptTime (NTOSKRNL.EXE.@) * diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index aaf7fc8ac3d..79f48e3eea2 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -599,6 +599,7 @@ @ stub KePulseEvent @ stdcall KeQueryActiveProcessors() @ stdcall KeQueryActiveProcessorCountEx(long) +@ stdcall KeQueryActiveProcessorCount(ptr) @ stdcall KeQueryActiveGroupCount() GetActiveProcessorGroupCount @ stdcall KeQueryInterruptTime() @ stdcall KeQueryPriorityThread(ptr)