@@ -2716,30 +2716,39 @@ MiEnablePagingOfDriver(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
27162716 if (PointerPte ) MiSetPagingOfDriver (PointerPte , LastPte );
27172717}
27182718
2719+ FORCEINLINE
27192720BOOLEAN
2720- NTAPI
2721- MmVerifyImageIsOkForMpUse ( IN PVOID BaseAddress )
2721+ MiVerifyImageIsOkForMpUse (
2722+ _In_ PIMAGE_NT_HEADERS NtHeaders )
27222723{
2723- PIMAGE_NT_HEADERS NtHeader ;
2724- PAGED_CODE ();
2725-
2726- /* Get NT Headers */
2727- NtHeader = RtlImageNtHeader (BaseAddress );
2728- if (NtHeader )
2724+ /* Fail if we have 2+ CPUs, but the image is only safe for UP */
2725+ if ((KeNumberProcessors > 1 ) &&
2726+ (NtHeaders -> FileHeader .Characteristics & IMAGE_FILE_UP_SYSTEM_ONLY ))
27292727 {
2730- /* Check if this image is only safe for UP while we have 2+ CPUs */
2731- if ((KeNumberProcessors > 1 ) &&
2732- (NtHeader -> FileHeader .Characteristics & IMAGE_FILE_UP_SYSTEM_ONLY ))
2733- {
2734- /* Fail */
2735- return FALSE;
2736- }
2728+ return FALSE;
27372729 }
2738-
2739- /* Otherwise, it's safe */
2730+ /* Otherwise, it's safe to use */
27402731 return TRUE;
27412732}
27422733
2734+ // TODO: Use this function to verify that the loaded boot drivers
2735+ // (in ExpLoadBootSymbols) are compatible with MP.
2736+ BOOLEAN
2737+ NTAPI
2738+ MmVerifyImageIsOkForMpUse (
2739+ _In_ PVOID BaseAddress )
2740+ {
2741+ PIMAGE_NT_HEADERS NtHeaders ;
2742+ PAGED_CODE ();
2743+
2744+ /* Get the NT headers. If none, suppose the image
2745+ * is safe to use, otherwise invoke the helper. */
2746+ NtHeaders = RtlImageNtHeader (BaseAddress );
2747+ if (!NtHeaders )
2748+ return TRUE;
2749+ return MiVerifyImageIsOkForMpUse (NtHeaders );
2750+ }
2751+
27432752NTSTATUS
27442753NTAPI
27452754MmCheckSystemImage (IN HANDLE ImageHandle ,
0 commit comments