recheck DSDT length

Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
SergeySlice 2020-11-06 10:31:30 +03:00
parent 5d91bbe253
commit 30f4fd2d64
2 changed files with 11 additions and 7 deletions

View File

@ -2049,6 +2049,9 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const XString8& OSVersion)
// }
if (gSettings.DebugDSDT) {
TableHeader = (EFI_ACPI_DESCRIPTION_HEADER*)(UINTN)FadtPointer->XDsdt;
bufferLen = TableHeader->Length;
DBG("Output DSDT before patch to %ls\\ACPI\\origin\\DSDT-or.aml\n", selfOem.getConfigDirFullPath().wc_str());
Status = egSaveFile(&selfOem.getConfigDir(), L"ACPI\\origin\\DSDT-or.aml", (UINT8*)(UINTN)FadtPointer->XDsdt, bufferLen);
}

View File

@ -196,14 +196,15 @@ EFI_STATUS egSaveFile(const EFI_FILE* BaseDir OPTIONAL, IN CONST CHAR16 *FileNam
}
} else {
//to write into existing file we must sure it size larger then our data
EFI_FILE_INFO *Info = EfiLibFileInfo(FileHandle);
if (Info) {
if (Info->FileSize < FileDataLength) {
// EFI_FILE_INFO *Info = EfiLibFileInfo(FileHandle);
// if (Info) {
// if (Info->FileSize < FileDataLength) {
// DBG("no old file %s\n", efiStrError(Status));
return EFI_NOT_FOUND;
}
FreePool(Info);
}
// return EFI_NOT_FOUND;
// }
// FreePool(Info);
// }
Status = FileHandle->Delete(FileHandle); //don't write into existing file. Delete it!
}
if (!FileHandle) {