mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-22 16:08:23 +08:00
Display non-ASCII-named FPT partition table entry names as hex (fixing #215)
This commit is contained in:
parent
5967865028
commit
115d338a70
@ -2,20 +2,6 @@
|
|||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>NSPrincipalClass</key>
|
|
||||||
<string>NSApplication</string>
|
|
||||||
<key>CFBundleIconFile</key>
|
|
||||||
<string>uefitool</string>
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>APPL</string>
|
|
||||||
<key>CFBundleGetInfoString</key>
|
|
||||||
<string>UEFITool NE</string>
|
|
||||||
<key>CFBundleSignature</key>
|
|
||||||
<string>????</string>
|
|
||||||
<key>CFBundleExecutable</key>
|
|
||||||
<string>UEFITool</string>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>org.longsoft.UEFITool</string>
|
|
||||||
<key>CFBundleDocumentTypes</key>
|
<key>CFBundleDocumentTypes</key>
|
||||||
<array>
|
<array>
|
||||||
<dict>
|
<dict>
|
||||||
@ -29,5 +15,19 @@
|
|||||||
<string>None</string>
|
<string>None</string>
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>UEFITool</string>
|
||||||
|
<key>CFBundleGetInfoString</key>
|
||||||
|
<string>UEFITool NE</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>uefitool</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>NSPrincipalClass</key>
|
||||||
|
<string>NSApplication</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
@ -171,7 +171,7 @@ USTATUS MeParser::parseFptRegion(const UByteArray & region, const UModelIndex &
|
|||||||
const FPT_HEADER_ENTRY* ptEntry = firstPtEntry + i;
|
const FPT_HEADER_ENTRY* ptEntry = firstPtEntry + i;
|
||||||
|
|
||||||
// Get info
|
// Get info
|
||||||
name = usprintf("%c%c%c%c", ptEntry->Name[0], ptEntry->Name[1], ptEntry->Name[2], ptEntry->Name[3]);
|
name = visibleAsciiOrHex((UINT8*)ptEntry->Name, 4);
|
||||||
info = usprintf("Full size: %Xh (%u)\nPartition offset: %Xh\nPartition length: %Xh\nPartition type: %02Xh",
|
info = usprintf("Full size: %Xh (%u)\nPartition offset: %Xh\nPartition length: %Xh\nPartition type: %02Xh",
|
||||||
sizeof(FPT_HEADER_ENTRY), sizeof(FPT_HEADER_ENTRY),
|
sizeof(FPT_HEADER_ENTRY), sizeof(FPT_HEADER_ENTRY),
|
||||||
ptEntry->Offset,
|
ptEntry->Offset,
|
||||||
@ -275,7 +275,7 @@ make_partition_table_consistent:
|
|||||||
if (partitions[i].type == Types::FptPartition) {
|
if (partitions[i].type == Types::FptPartition) {
|
||||||
UModelIndex partitionIndex;
|
UModelIndex partitionIndex;
|
||||||
// Get info
|
// Get info
|
||||||
name = usprintf("%c%c%c%c", partitions[i].ptEntry.Name[0], partitions[i].ptEntry.Name[1], partitions[i].ptEntry.Name[2], partitions[i].ptEntry.Name[3]);
|
name = visibleAsciiOrHex((UINT8*) partitions[i].ptEntry.Name, 4);
|
||||||
info = usprintf("Full size: %Xh (%u)\nPartition type: %02Xh\n",
|
info = usprintf("Full size: %Xh (%u)\nPartition type: %02Xh\n",
|
||||||
partition.size(), partition.size(),
|
partition.size(), partition.size(),
|
||||||
partitions[i].ptEntry.Type);
|
partitions[i].ptEntry.Type);
|
||||||
|
@ -23,6 +23,32 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#include "LZMA/LzmaCompress.h"
|
#include "LZMA/LzmaCompress.h"
|
||||||
#include "LZMA/LzmaDecompress.h"
|
#include "LZMA/LzmaDecompress.h"
|
||||||
|
|
||||||
|
// Returns bytes as string when all bytes are ascii visible, hex representation otherwise
|
||||||
|
UString visibleAsciiOrHex(UINT8* bytes, UINT32 length)
|
||||||
|
{
|
||||||
|
bool ascii = true;
|
||||||
|
UString asciiString;
|
||||||
|
UString hexString;
|
||||||
|
|
||||||
|
for (UINT32 i = 0; i < length; i++) {
|
||||||
|
hexString += usprintf("%02X", bytes[i]);
|
||||||
|
|
||||||
|
if (bytes[i] < '\x20' || bytes[i] > '\x7E') { // Explicit ascii codes to avoid locale dependency
|
||||||
|
ascii = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ascii) {
|
||||||
|
asciiString += usprintf("%c", bytes[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ascii) {
|
||||||
|
return asciiString;
|
||||||
|
}
|
||||||
|
|
||||||
|
return hexString;
|
||||||
|
}
|
||||||
|
|
||||||
// Returns unique name string based for tree item
|
// Returns unique name string based for tree item
|
||||||
UString uniqueItemName(const UModelIndex & index)
|
UString uniqueItemName(const UModelIndex & index)
|
||||||
{
|
{
|
||||||
|
@ -23,6 +23,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#include "treemodel.h"
|
#include "treemodel.h"
|
||||||
#include "parsingdata.h"
|
#include "parsingdata.h"
|
||||||
|
|
||||||
|
// Returns bytes as string when all bytes are ascii visible, hex representation otherwise
|
||||||
|
UString visibleAsciiOrHex(UINT8* bytes, UINT32 length);
|
||||||
|
|
||||||
// Returns unique name for tree item
|
// Returns unique name for tree item
|
||||||
UString uniqueItemName(const UModelIndex & index);
|
UString uniqueItemName(const UModelIndex & index);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user