[PATCH v5 0/2] MR914: ntoskrnl.exe: Implement various KeQuery* functions
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. -- v5: ntoskrnl.exe: implement KeQueryMaximumProcessorCount/Ex. ntoskrnl.exe: implement KeQueryActiveProcessorCount. https://gitlab.winehq.org/wine/wine/-/merge_requests/914
From: Etaash Mathamsetty <etaash.mathamsetty(a)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 15236076f8e..836dec279e4 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -3424,6 +3424,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 7c993464ece..79f48e3eea2 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -600,12 +600,16 @@ @ stdcall KeQueryActiveProcessors() @ stdcall KeQueryActiveProcessorCountEx(long) @ stdcall KeQueryActiveProcessorCount(ptr) +@ 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 277f981982d..96db7540f0b 100644 --- a/include/winbase.h +++ b/include/winbase.h @@ -2196,6 +2196,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) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/914
Hi, It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated. The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=125520 Your paranoid android. === debian11 (build log) === error: patch failed: dlls/ntoskrnl.exe/ntoskrnl.c:3424 error: patch failed: dlls/ntoskrnl.exe/ntoskrnl.exe.spec:600 error: patch failed: include/winbase.h:2196 Task: Patch failed to apply === debian11b (build log) === error: patch failed: dlls/ntoskrnl.exe/ntoskrnl.c:3424 error: patch failed: dlls/ntoskrnl.exe/ntoskrnl.exe.spec:600 error: patch failed: include/winbase.h:2196 Task: Patch failed to apply
From: Etaash Mathamsetty <etaash.mathamsetty(a)gmail.com> --- dlls/ntoskrnl.exe/ntoskrnl.c | 26 ++++++++++++++++++++++++++ dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 5 +++++ include/winbase.h | 1 + 3 files changed, 32 insertions(+) diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index fd18ea706c2..7e6be60514a 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -2593,6 +2593,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.@) * @@ -3406,6 +3416,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 a1a42d52fd1..790e11bf3fb 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -599,12 +599,17 @@ @ stub KePulseEvent @ stdcall KeQueryActiveProcessors() @ stdcall KeQueryActiveProcessorCountEx(long) +@ stdcall KeQueryActiveProcessorCount(ptr) +@ 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 3cfc4649c7d..a4d69e85187 100644 --- a/include/winbase.h +++ b/include/winbase.h @@ -2196,6 +2196,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) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/914
participants (3)
-
Etaash Mathamsetty -
Etaash Mathamsetty (@etaash.mathamsetty) -
Marvin