[NTOS:IO] Check RtlAnsiStringToUnicodeString return value when initializing ramdisk

CORE-17637
This commit is contained in:
Jérôme Gardou 2021-06-17 16:33:33 +02:00 committed by Jérôme Gardou
parent e961958823
commit 293f823053
2 changed files with 13 additions and 1 deletions

View file

@ -80,6 +80,10 @@
// Unable to create symbolic link pointing to the RAM disk device
//
#define RD_SYMLINK_CREATE_FAILED 5
//
// Unable to create system root path when creating the RAM disk
//
#define RD_SYSROOT_INIT_FAILED 6
//
// Max traversal of reparse points for a single open in IoParseDevice

View file

@ -262,7 +262,15 @@ IopStartRamdisk(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
RtlInitEmptyUnicodeString(&NtSystemRoot,
SharedUserData->NtSystemRoot,
sizeof(SharedUserData->NtSystemRoot));
RtlAnsiStringToUnicodeString(&NtSystemRoot, &AnsiPath, FALSE);
Status = RtlAnsiStringToUnicodeString(&NtSystemRoot, &AnsiPath, FALSE);
if (!NT_SUCCESS(Status))
{
KeBugCheckEx(RAMDISK_BOOT_INITIALIZATION_FAILED,
RD_SYSROOT_INIT_FAILED,
Status,
0,
0);
}
IoCreateSymbolicLink(&DriveLetter, &DeviceString);
}