Fix the issue of generating incorrect GPT backup #130
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello dear author! I have noticed an issue with this tool, where when I use it to resize the USER partition, the GPT backup it generates is incorrect. The partition table entries are still the same, including the LBA_END parameter of the USER partition. The GPT header backup is also incorrect. MY_LBA and ALT_LBA need to be swapped, and PARTITION_ENTRIES_LBA should be set to MY_LBA-32. Additionally, the CRC32 hash of the GPT header backup needs to be recomputed.
The reason why I found this problem is because I encountered an error when opening the virtual disk file RAWNAND.bin using DiskGenius. Later, I opened RAWNAND.bin with WinHex and analyzed the GPT backup, finally identifying the cause of the problem.
Later, I found the source code of this project on GitHub and fixed the issue. This pull request is intended to fix this issue. Please review it.