theopolis / uefi-firmware-parser

Parse BIOS/Intel ME/UEFI firmware related structures: Volumes, FileSystems, Files, etc
Other
767 stars 154 forks source link

Sync LZMA library with UEFITool #125

Closed yeggor closed 7 months ago

yeggor commented 7 months ago

Hi, I've been trying to figure out why the 0393d0c4-6b0c-4b96-b4c3-8c7eb718f348 file won't decompress (see https://github.com/theopolis/uefi-firmware-parser/pull/124 and https://github.com/theopolis/uefi-firmware-parser/issues/123).

It turned out to be due to using an outdated version of LZMA in uefi-firmware-parser. In this PR, I synchronised the LZMA library with the version used in UEFITool and made the following changes to make it compatible:

diff --color uefi_firmware/compression/LZMA/LzmaCompress.c ../UEFITool/common/LZMA/LzmaCompress.c
61c61
< EFI_STATUS
---
> USTATUS
diff --color uefi_firmware/compression/LZMA/LzmaCompress.h ../UEFITool/common/LZMA/LzmaCompress.h
18c18
< #include "BaseTypes.h"
---
> #include "../basetypes.h"
27c27
<     EFI_STATUS
---
>     USTATUS
diff --color uefi_firmware/compression/LZMA/LzmaDecompress.c ../UEFITool/common/LZMA/LzmaDecompress.c
88c88
< EFI_STATUS
---
> USTATUS
104c104
<         return EFI_SUCCESS;
---
>         return U_SUCCESS;
107c107
<         return EFI_INVALID_PARAMETER;
---
>         return U_INVALID_PARAMETER;
130c130
< EFI_STATUS
---
> USTATUS
159c159
<         return EFI_SUCCESS;
---
>         return U_SUCCESS;
162c162
<         return EFI_INVALID_PARAMETER;
---
>         return U_INVALID_PARAMETER;
diff --color uefi_firmware/compression/LZMA/LzmaDecompress.h ../UEFITool/common/LZMA/LzmaDecompress.h
17c17
< #include "BaseTypes.h"
---
> #include "../basetypes.h"
54c54
<     EFI_STATUS
---
>     USTATUS
81c81
<     EFI_STATUS
---
>     USTATUS
Common subdirectories: uefi_firmware/compression/LZMA/SDK and ../UEFITool/common/LZMA/SDK
diff --color uefi_firmware/compression/LZMA/UefiLzma.h ../UEFITool/common/LZMA/UefiLzma.h
17c17
< #include "BaseTypes.h"
---
> #include "../basetypes.h"