Index: ntoskrnl/io/iomgr/driver.c =================================================================== --- ntoskrnl/io/iomgr/driver.c (revision 74478) +++ ntoskrnl/io/iomgr/driver.c (working copy) @@ -884,7 +884,7 @@ PDEVICE_NODE DeviceNode; PDRIVER_OBJECT DriverObject; NTSTATUS Status; - PWCHAR FileNameWithoutPath; + PWCHAR Buffer, FileNameWithoutPath; LPWSTR FileExtension; PUNICODE_STRING ModuleName = &BootLdrEntry->BaseDllName; PLDR_DATA_TABLE_ENTRY LdrEntry; @@ -898,13 +898,19 @@ IopDisplayLoadingMessage(ModuleName); InbvIndicateProgress(); + Buffer = ExAllocatePool(PagedPool, ModuleName->Length + sizeof(UNICODE_NULL)); + ASSERT(Buffer); + + RtlCopyMemory(Buffer, ModuleName->Buffer, ModuleName->Length); + Buffer[ModuleName->Length / sizeof(WCHAR)] = UNICODE_NULL; + /* * Generate filename without path (not needed by freeldr) */ - FileNameWithoutPath = wcsrchr(ModuleName->Buffer, L'\\'); + FileNameWithoutPath = wcsrchr(Buffer, L'\\'); if (FileNameWithoutPath == NULL) { - FileNameWithoutPath = ModuleName->Buffer; + FileNameWithoutPath = Buffer; } else { @@ -915,16 +921,17 @@ * Strip the file extension from ServiceName */ Success = RtlCreateUnicodeString(&ServiceName, FileNameWithoutPath); + ExFreePool(Buffer); if (!Success) { return STATUS_INSUFFICIENT_RESOURCES; } - - FileExtension = wcsrchr(ServiceName.Buffer, '.'); + + FileExtension = wcsrchr(ServiceName.Buffer, L'.'); if (FileExtension != NULL) { ServiceName.Length -= (USHORT)wcslen(FileExtension) * sizeof(WCHAR); - FileExtension[0] = 0; + FileExtension[0] = UNICODE_NULL; } /*