mirror of
https://github.com/reactos/reactos.git
synced 2025-06-01 23:48:12 +00:00
[NTOS:MM]
- Fix bugcheck and unreadable DPRINTs in failure case of MiResolveImageReferences CORE-7571 #resolve svn path=/trunk/; revision=60983
This commit is contained in:
parent
a937b3aad1
commit
591c52308a
1 changed files with 13 additions and 27 deletions
|
@ -1167,23 +1167,17 @@ CheckDllState:
|
||||||
goto Failure;
|
goto Failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup the base length and copy it */
|
/* Add the import name to the base directory */
|
||||||
DllName.Length = ImageFileDirectory->Length;
|
RtlCopyUnicodeString(&DllName, ImageFileDirectory);
|
||||||
RtlCopyMemory(DllName.Buffer,
|
|
||||||
ImageFileDirectory->Buffer,
|
|
||||||
ImageFileDirectory->Length);
|
|
||||||
|
|
||||||
/* Now add the import name and null-terminate it */
|
|
||||||
RtlAppendUnicodeStringToString(&DllName,
|
RtlAppendUnicodeStringToString(&DllName,
|
||||||
&NameString);
|
&NameString);
|
||||||
DllName.Buffer[DllName.Length / sizeof(WCHAR)] = UNICODE_NULL;
|
|
||||||
|
|
||||||
/* Load the image */
|
/* Load the image */
|
||||||
Status = MmLoadSystemImage(&DllName,
|
Status = MmLoadSystemImage(&DllName,
|
||||||
NamePrefix,
|
NamePrefix,
|
||||||
NULL,
|
NULL,
|
||||||
FALSE,
|
FALSE,
|
||||||
(PVOID)&DllEntry,
|
(PVOID *)&DllEntry,
|
||||||
&DllBase);
|
&DllBase);
|
||||||
|
|
||||||
/* win32k / GDI drivers can also import from system32 folder */
|
/* win32k / GDI drivers can also import from system32 folder */
|
||||||
|
@ -1207,25 +1201,19 @@ CheckDllState:
|
||||||
goto Failure;
|
goto Failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the image directory */
|
/* Copy image directory and append 'drivers\' folder name */
|
||||||
RtlCopyMemory(DllName.Buffer,
|
RtlCopyUnicodeString(&DllName, ImageFileDirectory);
|
||||||
ImageFileDirectory->Buffer,
|
|
||||||
ImageFileDirectory->Length);
|
|
||||||
DllName.Length = ImageFileDirectory->Length;
|
|
||||||
|
|
||||||
/* Append 'drivers\' folder name */
|
|
||||||
RtlAppendUnicodeStringToString(&DllName, &DriversFolderName);
|
RtlAppendUnicodeStringToString(&DllName, &DriversFolderName);
|
||||||
|
|
||||||
/* Now add the import name and null-terminate it */
|
/* Now add the import name */
|
||||||
RtlAppendUnicodeStringToString(&DllName, &NameString);
|
RtlAppendUnicodeStringToString(&DllName, &NameString);
|
||||||
DllName.Buffer[DllName.Length / sizeof(WCHAR)] = UNICODE_NULL;
|
|
||||||
|
|
||||||
/* Try once again to load the image */
|
/* Try once again to load the image */
|
||||||
Status = MmLoadSystemImage(&DllName,
|
Status = MmLoadSystemImage(&DllName,
|
||||||
NamePrefix,
|
NamePrefix,
|
||||||
NULL,
|
NULL,
|
||||||
FALSE,
|
FALSE,
|
||||||
(PVOID)&DllEntry,
|
(PVOID *)&DllEntry,
|
||||||
&DllBase);
|
&DllBase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1236,11 +1224,12 @@ CheckDllState:
|
||||||
*(PULONG)MissingDriver |= 1;
|
*(PULONG)MissingDriver |= 1;
|
||||||
*MissingApi = NULL;
|
*MissingApi = NULL;
|
||||||
|
|
||||||
|
DPRINT1("Failed to load dependency: %wZ\n", &DllName);
|
||||||
|
|
||||||
/* Don't free the name */
|
/* Don't free the name */
|
||||||
DllName.Buffer = NULL;
|
DllName.Buffer = NULL;
|
||||||
|
|
||||||
/* Cleanup and return */
|
/* Cleanup and return */
|
||||||
DPRINT1("Failed to load dependency: %wZ\n", &DllName);
|
|
||||||
goto Failure;
|
goto Failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1402,10 +1391,7 @@ CheckDllState:
|
||||||
Failure:
|
Failure:
|
||||||
|
|
||||||
/* Cleanup and return */
|
/* Cleanup and return */
|
||||||
if (NameString.Buffer != NULL)
|
RtlFreeUnicodeString(&NameString);
|
||||||
{
|
|
||||||
ExFreePoolWithTag(NameString.Buffer, TAG_LDR_WSTR);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (LoadedImports)
|
if (LoadedImports)
|
||||||
{
|
{
|
||||||
|
@ -3217,14 +3203,14 @@ LoaderScan:
|
||||||
BOOLEAN NeedToFreeString = FALSE;
|
BOOLEAN NeedToFreeString = FALSE;
|
||||||
|
|
||||||
/* If the lowest bit is set to 1, this is a hint that we need to free */
|
/* If the lowest bit is set to 1, this is a hint that we need to free */
|
||||||
if (*(ULONG_PTR*)MissingDriverName & 1)
|
if (*(ULONG_PTR*)&MissingDriverName & 1)
|
||||||
{
|
{
|
||||||
NeedToFreeString = TRUE;
|
NeedToFreeString = TRUE;
|
||||||
*(ULONG_PTR*)MissingDriverName &= ~1;
|
*(ULONG_PTR*)&MissingDriverName &= ~1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT1("MiResolveImageReferences failed with status 0x%x\n", Status);
|
DPRINT1("MiResolveImageReferences failed with status 0x%x\n", Status);
|
||||||
DPRINT1(" Missing driver '%ws', missing API '%s'\n",
|
DPRINT1(" Missing driver '%ls', missing API '%s'\n",
|
||||||
MissingDriverName, MissingApiName);
|
MissingDriverName, MissingApiName);
|
||||||
|
|
||||||
if (NeedToFreeString)
|
if (NeedToFreeString)
|
||||||
|
|
Loading…
Reference in a new issue