Skip to content

Commit

Permalink
[NTDLL] Halfplement LdrpValidateImageForMp
Browse files Browse the repository at this point in the history
This avoids debug spam.
  • Loading branch information
tkreuzer committed Jan 19, 2025
1 parent dc25409 commit 93ad123
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion dll/ntdll/ldr/ldrinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1538,7 +1538,36 @@ VOID
NTAPI
LdrpValidateImageForMp(IN PLDR_DATA_TABLE_ENTRY LdrDataTableEntry)
{
UNIMPLEMENTED;
PIMAGE_NT_HEADERS NtHeaders;
NTSTATUS Status;

/* Get the NT Headers */
NtHeaders = RtlImageNtHeader(LdrDataTableEntry->DllBase);
if (NtHeaders == NULL)
{
RtlRaiseStatus(STATUS_INVALID_IMAGE_FORMAT);
}

/* Check if the image is UP only */
if (NtHeaders->FileHeader.Characteristics & IMAGE_FILE_UP_SYSTEM_ONLY)
{
/* Set process affinity to 1 */
DPRINT1("LDR: Image is UP only, setting process affinity to 1\n");
KAFFINITY AffinityMask = 1;
Status = NtSetInformationProcess(NtCurrentProcess(),
ProcessAffinityMask,
&AffinityMask,
sizeof(AffinityMask));
if (!NT_SUCCESS(Status))
{
RtlRaiseStatus(Status);
}

/* Save it in the PEB */
NtCurrentPeb()->NumberOfProcessors = 1;
}

// FIXME: Anything else to do?
}

BOOLEAN
Expand Down

0 comments on commit 93ad123

Please sign in to comment.