diff --git a/modules/rostests/apitests/ntdll/CMakeLists.txt b/modules/rostests/apitests/ntdll/CMakeLists.txt index a98bce7247b..5c60d004f1c 100644 --- a/modules/rostests/apitests/ntdll/CMakeLists.txt +++ b/modules/rostests/apitests/ntdll/CMakeLists.txt @@ -62,6 +62,7 @@ list(APPEND SOURCE NtDuplicateToken.c NtFilterToken.c NtFreeVirtualMemory.c + NtGetCurrentProcessorNumberEx.c NtImpersonateAnonymousToken.c NtLoadUnloadKey.c NtMapViewOfSection.c diff --git a/modules/rostests/apitests/ntdll/NtGetCurrentProcessorNumberEx.c b/modules/rostests/apitests/ntdll/NtGetCurrentProcessorNumberEx.c new file mode 100644 index 00000000000..c7da6f88152 --- /dev/null +++ b/modules/rostests/apitests/ntdll/NtGetCurrentProcessorNumberEx.c @@ -0,0 +1,44 @@ +/* + * PROJECT: ReactOS api tests + * LICENSE: MIT (https://spdx.org/licenses/MIT) + * PURPOSE: Tests for NtGetCurrentProcessorNumberEx + * COPYRIGHT: Copyright 2025 Timo Kreuzer + */ + +#include "precomp.h" +#include + +typedef +NTSTATUS +NTAPI +FN_NtGetCurrentProcessorNumberEx( + _Out_ PPROCESSOR_NUMBER); + +FN_NtGetCurrentProcessorNumberEx* pNtGetCurrentProcessorNumberEx; + +START_TEST(NtGetCurrentProcessorNumberEx) +{ + PROCESSOR_NUMBER ProcessorNumber; + NTSTATUS Status; + + HINSTANCE hinstNtdll = GetModuleHandleA("ntdll.dll"); + pNtGetCurrentProcessorNumberEx = (FN_NtGetCurrentProcessorNumberEx*)GetProcAddress(hinstNtdll, "NtGetCurrentProcessorNumberEx"); + if (!pNtGetCurrentProcessorNumberEx) + { + skip("NtGetCurrentProcessorNumberEx is not available\n"); + return; + } + + memset(&ProcessorNumber, 0xAA, sizeof(ProcessorNumber)); + Status = pNtGetCurrentProcessorNumberEx(&ProcessorNumber); + ok_eq_hex(Status, STATUS_SUCCESS); + ok(ProcessorNumber.Group < 64, "Processor group is out of range"); + ok(ProcessorNumber.Number < 64, "Processor number is out of range"); + ok(ProcessorNumber.Reserved == 0, "Reserved field is not zero"); + + Status = pNtGetCurrentProcessorNumberEx(NULL); + ok_eq_hex(Status, STATUS_ACCESS_VIOLATION); + + Status = pNtGetCurrentProcessorNumberEx((PVOID)(ULONG_PTR)0xDEADDEADDEADDEADull); + ok_eq_hex(Status, STATUS_ACCESS_VIOLATION); +}