From 47d309b262b302cb86fe72d689a616bbbde3a7d4 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sat, 17 Nov 2018 15:03:43 +0100 Subject: [PATCH] [NTOSKRNL] Implement ExSizeOfRundownProtectionCacheAware() --- ntoskrnl/ex/rundown.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/ntoskrnl/ex/rundown.c b/ntoskrnl/ex/rundown.c index 5b354857e34..ee1dbadb2b8 100644 --- a/ntoskrnl/ex/rundown.c +++ b/ntoskrnl/ex/rundown.c @@ -606,13 +606,28 @@ ExInitializeRundownProtectionCacheAware(IN PEX_RUNDOWN_REF_CACHE_AWARE RunRefCac } /* - * @unimplemented NT5.2 + * @implemented NT5.2 */ SIZE_T NTAPI ExSizeOfRundownProtectionCacheAware(VOID) { - UNIMPLEMENTED; - return 0; + SIZE_T Size; + + PAGED_CODE(); + + /* Compute the needed size for runrefs */ + if (KeNumberProcessors <= 1) + { + Size = sizeof(EX_RUNDOWN_REF); + } + else + { + /* We +1, to have enough room for alignment */ + Size = (KeNumberProcessors + 1) * KeGetRecommendedSharedDataAlignment(); + } + + /* Return total size (master structure and runrefs) */ + return Size + sizeof(EX_RUNDOWN_REF_CACHE_AWARE); }