mirror of
https://github.com/reactos/reactos.git
synced 2025-05-08 03:07:05 +00:00
[NTOS:MM] Split MmVerifyImageIsOkForMpUse() into an auxiliary inlined helper.
This helper is used when an existing NtHeader is already available.
This commit is contained in:
parent
ccf1e97aa1
commit
7c23a2e38e
1 changed files with 26 additions and 17 deletions
|
@ -2716,28 +2716,37 @@ MiEnablePagingOfDriver(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
|
||||||
if (PointerPte) MiSetPagingOfDriver(PointerPte, LastPte);
|
if (PointerPte) MiSetPagingOfDriver(PointerPte, LastPte);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FORCEINLINE
|
||||||
|
BOOLEAN
|
||||||
|
MiVerifyImageIsOkForMpUse(
|
||||||
|
_In_ PIMAGE_NT_HEADERS NtHeaders)
|
||||||
|
{
|
||||||
|
/* Fail if we have 2+ CPUs, but the image is only safe for UP */
|
||||||
|
if ((KeNumberProcessors > 1) &&
|
||||||
|
(NtHeaders->FileHeader.Characteristics & IMAGE_FILE_UP_SYSTEM_ONLY))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
/* Otherwise, it's safe to use */
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Use this function to verify that the loaded boot drivers
|
||||||
|
// (in ExpLoadBootSymbols) are compatible with MP.
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
MmVerifyImageIsOkForMpUse(IN PVOID BaseAddress)
|
MmVerifyImageIsOkForMpUse(
|
||||||
|
_In_ PVOID BaseAddress)
|
||||||
{
|
{
|
||||||
PIMAGE_NT_HEADERS NtHeader;
|
PIMAGE_NT_HEADERS NtHeaders;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Get NT Headers */
|
/* Get the NT headers. If none, suppose the image
|
||||||
NtHeader = RtlImageNtHeader(BaseAddress);
|
* is safe to use, otherwise invoke the helper. */
|
||||||
if (NtHeader)
|
NtHeaders = RtlImageNtHeader(BaseAddress);
|
||||||
{
|
if (!NtHeaders)
|
||||||
/* Check if this image is only safe for UP while we have 2+ CPUs */
|
return TRUE;
|
||||||
if ((KeNumberProcessors > 1) &&
|
return MiVerifyImageIsOkForMpUse(NtHeaders);
|
||||||
(NtHeader->FileHeader.Characteristics & IMAGE_FILE_UP_SYSTEM_ONLY))
|
|
||||||
{
|
|
||||||
/* Fail */
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Otherwise, it's safe */
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
|
Loading…
Reference in a new issue