diff --git a/Library/OcVirtualFsLib/VirtualFile.c b/Library/OcVirtualFsLib/VirtualFile.c index a82ce158fc0b930c4c1cb5bd128bea2e6ca9f722..1f5aff9728b6b01d266a54d8b6e5138201bebf8a 100644 --- a/Library/OcVirtualFsLib/VirtualFile.c +++ b/Library/OcVirtualFsLib/VirtualFile.c @@ -652,13 +652,13 @@ CreateVirtualFileFileNameCopy ( FileNameCopy = AllocateCopyPool (StrSize (FileName), FileName); if (FileNameCopy == NULL) { - DEBUG ((DEBUG_WARN, "OCVFS: Failed to allocate file name (%a) copy\n", FileName)); + DEBUG ((DEBUG_WARN, "OCVFS: Failed to allocate file name (%s) copy\n", FileName)); return EFI_OUT_OF_RESOURCES; } Status = CreateVirtualFile (FileNameCopy, FileBuffer, FileSize, ModificationTime, File); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_WARN, "OCVFS: Failed to virtualise file (%a)\n", FileName)); + DEBUG ((DEBUG_WARN, "OCVFS: Failed to virtualise file (%s)\n", FileName)); FreePool (FileNameCopy); return EFI_OUT_OF_RESOURCES; } diff --git a/Platform/OpenCore/OpenCoreKernel.c b/Platform/OpenCore/OpenCoreKernel.c index 5d5dd130d6e46267755dbc0dd195635bb37689c9..954d8b575fd20fbe848d584d863cfb0dd411355a 100644 --- a/Platform/OpenCore/OpenCoreKernel.c +++ b/Platform/OpenCore/OpenCoreKernel.c @@ -825,7 +825,6 @@ OcKernelFileOpen ( UINT8 *Kernel; UINT32 KernelSize; UINT32 AllocatedSize; - CHAR16 *FileNameCopy; EFI_FILE_PROTOCOL *VirtualFileHandle; EFI_STATUS PrelinkedStatus; EFI_TIME ModificationTime; @@ -974,20 +973,12 @@ OcKernelFileOpen ( (*NewHandle)->Close(*NewHandle); // - // This was our file, yet firmware is dying. + // Virtualise newly created kernel. // - FileNameCopy = AllocateCopyPool (StrSize (FileName), FileName); - if (FileNameCopy == NULL) { - DEBUG ((DEBUG_WARN, "OC: Failed to allocate kernel name (%a) copy\n", FileName)); - FreePool (Kernel); - return EFI_OUT_OF_RESOURCES; - } - - Status = CreateVirtualFile (FileNameCopy, Kernel, KernelSize, &ModificationTime, &VirtualFileHandle); + Status = CreateVirtualFileFileNameCopy (FileName, Kernel, KernelSize, &ModificationTime, &VirtualFileHandle); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_WARN, "OC: Failed to virtualise kernel file (%a)\n", FileName)); + DEBUG ((DEBUG_WARN, "OC: Failed to virtualise kernel file (%s) - %r\n", FileName, Status)); FreePool (Kernel); - FreePool (FileNameCopy); return EFI_OUT_OF_RESOURCES; } @@ -1059,9 +1050,12 @@ OcKernelFileOpen ( (*NewHandle)->Close(*NewHandle); + // + // Virtualise newly created mkext. + // Status = CreateVirtualFileFileNameCopy (FileName, Kernel, KernelSize, &ModificationTime, &VirtualFileHandle); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_WARN, "OC: Failed to virtualise mkext file (%a) - %r\n", FileName, Status)); + DEBUG ((DEBUG_WARN, "OC: Failed to virtualise mkext file (%s) - %r\n", FileName, Status)); FreePool (Kernel); return EFI_OUT_OF_RESOURCES; }