[NTDLL_APITEST] Add test for NtGetCurrentProcessorNumberEx

This commit is contained in:
Timo Kreuzer
2026-07-01 21:45:34 +00:00
parent 098532b9c5
commit aab0eac949
2 changed files with 45 additions and 0 deletions
@@ -62,6 +62,7 @@ list(APPEND SOURCE
NtDuplicateToken.c
NtFilterToken.c
NtFreeVirtualMemory.c
NtGetCurrentProcessorNumberEx.c
NtImpersonateAnonymousToken.c
NtLoadUnloadKey.c
NtMapViewOfSection.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 <[email protected]>
*/
#include "precomp.h"
#include <winnls.h>
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);
}