[XDK] Fix x64 version of KeGetCurrentProcessorNumber() and add KeGetCurrentProcessorIndex()

This commit is contained in:
Timo Kreuzer 2019-04-21 11:28:58 +02:00
parent 9215413a68
commit e2560a5cad
3 changed files with 26 additions and 14 deletions

View file

@ -152,6 +152,15 @@ KeRestoreFloatingPointState(
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
#if (NTDDI_VERSION >= NTDDI_WIN7)
FORCEINLINE
ULONG
KeGetCurrentProcessorIndex(VOID)
{
return __readgsdword(0x1a4);
}
#endif
/* VOID /* VOID
* KeFlushIoBuffers( * KeFlushIoBuffers(
* IN PMDL Mdl, * IN PMDL Mdl,
@ -320,11 +329,14 @@ KeGetPcr(VOID)
return (PKPCR)__readgsqword(FIELD_OFFSET(KPCR, Self)); return (PKPCR)__readgsqword(FIELD_OFFSET(KPCR, Self));
} }
#if (NTDDI_VERSION >= NTDDI_WIN7)
_CRT_DEPRECATE_TEXT("KeGetCurrentProcessorNumber is deprecated. Use KeGetCurrentProcessorNumberEx or KeGetCurrentProcessorIndex instead.")
#endif
FORCEINLINE FORCEINLINE
ULONG ULONG
KeGetCurrentProcessorNumber(VOID) KeGetCurrentProcessorNumber(VOID)
{ {
return (ULONG)__readgsword(0x184); return __readgsbyte(0x184);
} }
$endif /* _NTDDK_ */ $endif /* _NTDDK_ */

View file

@ -44,19 +44,6 @@ KeInvalidateRangeAllCaches(
_In_ PVOID BaseAddress, _In_ PVOID BaseAddress,
_In_ ULONG Length); _In_ ULONG Length);
$endif (_NTDDK_) $endif (_NTDDK_)
$if (_NTIFS_)
NTSTATUS
NTAPI
KeGetProcessorNumberFromIndex(
_In_ ULONG ProcIndex,
_Out_ PPROCESSOR_NUMBER ProcNumber);
ULONG
NTAPI
KeGetProcessorIndexFromNumber(
_In_ PPROCESSOR_NUMBER ProcNumber);
$endif (_NTIFS_)
#if (NTDDI_VERSION >= NTDDI_WIN2K) #if (NTDDI_VERSION >= NTDDI_WIN2K)

View file

@ -169,6 +169,16 @@ NTAPI
KeRestoreFloatingPointState( KeRestoreFloatingPointState(
_In_ PKFLOATING_SAVE FloatSave); _In_ PKFLOATING_SAVE FloatSave);
#if (NTDDI_VERSION >= NTDDI_WIN7)
FORCEINLINE
ULONG
NTAPI
KeGetCurrentProcessorIndex(VOID)
{
return __readfsbyte(0x51);
}
#endif
/* VOID /* VOID
* KeFlushIoBuffers( * KeFlushIoBuffers(
* IN PMDL Mdl, * IN PMDL Mdl,
@ -315,6 +325,9 @@ typedef struct _KPCR {
ULONG HalReserved[16]; ULONG HalReserved[16];
} KPCR, *PKPCR; } KPCR, *PKPCR;
#if (NTDDI_VERSION >= NTDDI_WIN7)
_CRT_DEPRECATE_TEXT("KeGetCurrentProcessorNumber is deprecated. Use KeGetCurrentProcessorNumberEx or KeGetCurrentProcessorIndex instead.")
#endif
FORCEINLINE FORCEINLINE
ULONG ULONG
KeGetCurrentProcessorNumber(VOID) KeGetCurrentProcessorNumber(VOID)