Jinoh Kang (@iamahuman) commented about dlls/ntoskrnl.exe/ntoskrnl.c:
+/***********************************************************************
KeGetCurrentProcessorNumberEx (NTOSKRNL.EXE.@)
- */
+ULONG WINAPI KeGetCurrentProcessorNumberEx(PPROCESSOR_NUMBER process_number) +{
- FIXME("%p semi-stub\n", process_number);
- if (process_number)
- {
process_number->Group = 0;
process_number->Reserved = 0;
process_number->Number = NtGetCurrentProcessorNumber();
- }
- return NtGetCurrentProcessorNumber();
You should only call `NtGetCurrentProcessorNumber()` once. Otherwise, the processor number can change if the thread is preempted and then re-scheduled to another processor. This leads to inconsistent values between the return value and the `process_number->Number` output.
In general, you should treat `NtGetCurrentProcessorNumber()` as being volatile.