mirror of
https://codeberg.org/libreboot/UEFITool.git
synced 2025-07-04 08:17:01 +00:00
Compare commits
23 commits
new_engine
...
0.21.5
Author | SHA1 | Date | |
---|---|---|---|
|
d54f215e67 | ||
|
19cc031244 | ||
|
7ebbc58b9b | ||
|
9d0bcd0bed | ||
|
1ab52fde35 | ||
|
388dd25093 | ||
|
ed038c21bf | ||
|
93881e4892 | ||
|
4e8431b169 | ||
|
9c7c94702d | ||
|
e5cf61f89a | ||
|
8a14965463 | ||
|
c286459676 | ||
|
aa80837bf5 | ||
|
9c4ddbec62 | ||
|
63e5a4dd1c | ||
|
1109e44379 | ||
|
c5fec376f7 | ||
|
d78df75de6 | ||
|
3013398a9d | ||
|
b9b5758d2d | ||
|
351285dfbf | ||
|
92c9754c02 |
19 changed files with 885 additions and 346 deletions
14
.travis.yml
Normal file
14
.travis.yml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
language: cpp
|
||||||
|
|
||||||
|
compiler:
|
||||||
|
- clang
|
||||||
|
- gcc
|
||||||
|
|
||||||
|
before_install:
|
||||||
|
- sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa
|
||||||
|
- sudo apt-get update -qq
|
||||||
|
- sudo apt-get install -qq qt5-qmake qtbase5-dev qtdeclarative5-dev libqt5webkit5-dev libsqlite3-dev
|
||||||
|
|
||||||
|
script:
|
||||||
|
- qmake -qt=qt5 uefitool.pro
|
||||||
|
- make
|
23
LICENSE.md
Normal file
23
LICENSE.md
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
Copyright (c) 2015, Nikolaj Schlej
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -31,7 +31,7 @@ int main(int argc, char *argv[])
|
||||||
result = w.patchFromFile(a.arguments().at(1));
|
result = w.patchFromFile(a.arguments().at(1));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
std::cout << "UEFIPatch 0.3.4 - UEFI image file patching utility" << std::endl << std::endl <<
|
std::cout << "UEFIPatch 0.3.9 - UEFI image file patching utility" << std::endl << std::endl <<
|
||||||
"Usage: UEFIPatch image_file" << std::endl << std::endl <<
|
"Usage: UEFIPatch image_file" << std::endl << std::endl <<
|
||||||
"Patches will be read from patches.txt file\n";
|
"Patches will be read from patches.txt file\n";
|
||||||
return ERR_SUCCESS;
|
return ERR_SUCCESS;
|
||||||
|
|
|
@ -85,6 +85,8 @@ typedef unsigned int UINTN;
|
||||||
#define ERR_INVALID_SYMBOL 40
|
#define ERR_INVALID_SYMBOL 40
|
||||||
#define ERR_NOTHING_TO_PATCH 41
|
#define ERR_NOTHING_TO_PATCH 41
|
||||||
#define ERR_DEPEX_PARSE_FAILED 42
|
#define ERR_DEPEX_PARSE_FAILED 42
|
||||||
|
#define ERR_TRUNCATED_IMAGE 43
|
||||||
|
#define ERR_BAD_RELOCATION_ENTRY 44
|
||||||
#define ERR_NOT_IMPLEMENTED 0xFF
|
#define ERR_NOT_IMPLEMENTED 0xFF
|
||||||
|
|
||||||
// UDK porting definitions
|
// UDK porting definitions
|
||||||
|
|
147
descriptor.h
147
descriptor.h
|
@ -17,11 +17,11 @@ WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#include "basetypes.h"
|
#include "basetypes.h"
|
||||||
|
|
||||||
// Make sure we use right packing rules
|
// Make sure we use right packing rules
|
||||||
#pragma pack(push,1)
|
#pragma pack(push, 1)
|
||||||
|
|
||||||
// Flash descriptor header
|
// Flash descriptor header
|
||||||
typedef struct _FLASH_DESCRIPTOR_HEADER {
|
typedef struct _FLASH_DESCRIPTOR_HEADER {
|
||||||
UINT8 FfVector[16]; // Must be 16 0xFFs
|
UINT8 FfVector[16]; // Must be 16 0xFFs
|
||||||
UINT32 Signature; // 0x0FF0A55A
|
UINT32 Signature; // 0x0FF0A55A
|
||||||
} FLASH_DESCRIPTOR_HEADER;
|
} FLASH_DESCRIPTOR_HEADER;
|
||||||
|
|
||||||
|
@ -34,37 +34,41 @@ typedef struct _FLASH_DESCRIPTOR_HEADER {
|
||||||
// Descriptor map
|
// Descriptor map
|
||||||
// Base fields are storing bits [11:4] of actual base addresses, all other bits are 0
|
// Base fields are storing bits [11:4] of actual base addresses, all other bits are 0
|
||||||
typedef struct _FLASH_DESCRIPTOR_MAP {
|
typedef struct _FLASH_DESCRIPTOR_MAP {
|
||||||
UINT8 ComponentBase; // 0x03 on most machines
|
// FLMAP0
|
||||||
UINT8 NumberOfFlashChips; // Zero-based number of flash chips installed on board
|
UINT32 ComponentBase : 8;
|
||||||
UINT8 RegionBase; // 0x04 on most machines
|
UINT32 NumberOfFlashChips : 2; // Zero-based number of flash chips installed on board
|
||||||
UINT8 NumberOfRegions; // Zero-based number of flash regions (descriptor is always included)
|
UINT32 : 6;
|
||||||
UINT8 MasterBase; // 0x06 on most machines
|
UINT32 RegionBase : 8;
|
||||||
UINT8 NumberOfMasters; // Zero-based number of flash masters
|
UINT32 NumberOfRegions : 3; // Reserved in v2 descriptor
|
||||||
UINT8 PchStrapsBase; // 0x10 on most machines
|
UINT32 : 5;
|
||||||
UINT8 NumberOfPchStraps; // One-based number of UINT32s to read as PCH Straps, min=0, max=255 (1 Kb)
|
// FLMAP 1
|
||||||
UINT8 ProcStrapsBase; // 0x20 on most machines
|
UINT32 MasterBase : 8;
|
||||||
UINT8 NumberOfProcStraps; // Number of PROC straps to be read, can be 0 or 1
|
UINT32 NumberOfMasters : 2; // Zero-based number of flash masters
|
||||||
UINT8 IccTableBase; // 0x21 on most machines
|
UINT32 : 6;
|
||||||
UINT8 NumberOfIccTableEntries; // 0x00 on most machines
|
UINT32 PchStrapsBase : 8;
|
||||||
UINT8 DmiTableBase; // 0x25 on most machines
|
UINT32 NumberOfPchStraps : 8; // One-based number of UINT32s to read as PCH straps, min=0, max=255 (1 Kb)
|
||||||
UINT8 NumberOfDmiTableEntries; // 0x00 on most machines
|
// FLMAP 2
|
||||||
UINT16 ReservedZero; // Still unknown, zeros in all descriptors I have seen
|
UINT32 ProcStrapsBase : 8;
|
||||||
|
UINT32 NumberOfProcStraps : 8; // One-based number of UINT32s to read as processor straps, min=0, max=255 (1 Kb)
|
||||||
|
UINT32: 16;
|
||||||
} FLASH_DESCRIPTOR_MAP;
|
} FLASH_DESCRIPTOR_MAP;
|
||||||
|
|
||||||
|
#define FLASH_DESCRIPTOR_MAX_BASE 0xE0
|
||||||
|
|
||||||
// Component section
|
// Component section
|
||||||
// Flash parameters DWORD structure
|
// Flash parameters DWORD structure
|
||||||
typedef struct _FLASH_PARAMETERS {
|
typedef struct _FLASH_PARAMETERS {
|
||||||
UINT8 FirstChipDensity : 3;
|
UINT8 FirstChipDensity : 4;
|
||||||
UINT8 SecondChipDensity : 3;
|
UINT8 SecondChipDensity : 4;
|
||||||
UINT8 ReservedZero0 : 2; // Still unknown, zeros in all descriptors I have seen
|
UINT8 : 8;
|
||||||
UINT8 ReservedZero1 : 8; // Still unknown, zeros in all descriptors I have seen
|
UINT8 : 1;
|
||||||
UINT8 ReservedZero2 : 4; // Still unknown, zeros in all descriptors I have seen
|
UINT8 ReadClockFrequency : 3; // Hardcoded value of 20 Mhz (000b) in v1 descriptors and 17 Mhz (110b) in v2 ones
|
||||||
UINT8 FastReadEnabled : 1;
|
UINT8 FastReadEnabled : 1;
|
||||||
UINT8 FastReadFreqency : 3;
|
UINT8 FastReadFrequency : 3;
|
||||||
UINT8 FlashReadStatusFrequency : 3;
|
|
||||||
UINT8 FlashWriteFrequency : 3;
|
UINT8 FlashWriteFrequency : 3;
|
||||||
|
UINT8 FlashReadStatusFrequency : 3;
|
||||||
UINT8 DualOutputFastReadSupported : 1;
|
UINT8 DualOutputFastReadSupported : 1;
|
||||||
UINT8 ReservedZero3 : 1; // Still unknown, zero in all descriptors I have seen
|
UINT8 : 1;
|
||||||
} FLASH_PARAMETERS;
|
} FLASH_PARAMETERS;
|
||||||
|
|
||||||
// Flash densities
|
// Flash densities
|
||||||
|
@ -74,11 +78,16 @@ typedef struct _FLASH_PARAMETERS {
|
||||||
#define FLASH_DENSITY_4MB 0x03
|
#define FLASH_DENSITY_4MB 0x03
|
||||||
#define FLASH_DENSITY_8MB 0x04
|
#define FLASH_DENSITY_8MB 0x04
|
||||||
#define FLASH_DENSITY_16MB 0x05
|
#define FLASH_DENSITY_16MB 0x05
|
||||||
|
#define FLASH_DENSITY_32MB 0x06
|
||||||
|
#define FLASH_DENSITY_64MB 0x07
|
||||||
|
#define FLASH_DENSITY_UNUSED 0x0F
|
||||||
|
|
||||||
// Flash frequencies
|
// Flash frequencies
|
||||||
#define FLASH_FREQUENCY_20MHZ 0x00
|
#define FLASH_FREQUENCY_20MHZ 0x00
|
||||||
#define FLASH_FREQUENCY_33MHZ 0x01
|
#define FLASH_FREQUENCY_33MHZ 0x01
|
||||||
#define FLASH_FREQUENCY_50MHZ 0x04
|
#define FLASH_FREQUENCY_48MHZ 0x02
|
||||||
|
#define FLASH_FREQUENCY_50MHZ_30MHZ 0x04
|
||||||
|
#define FLASH_FREQUENCY_17MHZ 0x06
|
||||||
|
|
||||||
// Component section structure
|
// Component section structure
|
||||||
typedef struct _FLASH_DESCRIPTOR_COMPONENT_SECTION {
|
typedef struct _FLASH_DESCRIPTOR_COMPONENT_SECTION {
|
||||||
|
@ -87,52 +96,82 @@ typedef struct _FLASH_DESCRIPTOR_COMPONENT_SECTION {
|
||||||
UINT8 InvalidInstruction1; //
|
UINT8 InvalidInstruction1; //
|
||||||
UINT8 InvalidInstruction2; //
|
UINT8 InvalidInstruction2; //
|
||||||
UINT8 InvalidInstruction3; //
|
UINT8 InvalidInstruction3; //
|
||||||
UINT16 PartitionBoundary; // Upper 16 bit of partition boundary address. Default is 0x0000, which makes the boundary to be 0x00001000
|
|
||||||
UINT16 ReservedZero; // Still unknown, zero in all descriptors I have seen
|
|
||||||
} FLASH_DESCRIPTOR_COMPONENT_SECTION;
|
} FLASH_DESCRIPTOR_COMPONENT_SECTION;
|
||||||
|
|
||||||
|
// Component section structure
|
||||||
|
typedef struct _FLASH_DESCRIPTOR_COMPONENT_SECTION_V2 {
|
||||||
|
FLASH_PARAMETERS FlashParameters;
|
||||||
|
UINT8 InvalidInstruction0; // Instructions for SPI chip, that must not be executed, like FLASH ERASE
|
||||||
|
UINT8 InvalidInstruction1; //
|
||||||
|
UINT8 InvalidInstruction2; //
|
||||||
|
UINT8 InvalidInstruction3; //
|
||||||
|
UINT8 InvalidInstruction4; //
|
||||||
|
UINT8 InvalidInstruction5; //
|
||||||
|
UINT8 InvalidInstruction6; //
|
||||||
|
UINT8 InvalidInstruction7; //
|
||||||
|
} FLASH_DESCRIPTOR_COMPONENT_SECTION_V2;
|
||||||
|
|
||||||
// Region section
|
// Region section
|
||||||
// All base and limit register are storing upper part of actual UINT32 base and limit
|
// All base and limit register are storing upper part of actual UINT32 base and limit
|
||||||
// If limit is zero - region is not present
|
// If limit is zero - region is not present
|
||||||
typedef struct _FLASH_DESCRIPTOR_REGION_SECTION {
|
typedef struct _FLASH_DESCRIPTOR_REGION_SECTION {
|
||||||
UINT16 ReservedZero; // Still unknown, zero in all descriptors I have seen
|
UINT16 DescriptorBase; // Descriptor
|
||||||
UINT16 FlashBlockEraseSize; // Size of block erased by single BLOCK ERASE command
|
UINT16 DescriptorLimit; //
|
||||||
UINT16 BiosBase;
|
UINT16 BiosBase; // BIOS
|
||||||
UINT16 BiosLimit;
|
UINT16 BiosLimit; //
|
||||||
UINT16 MeBase;
|
UINT16 MeBase; // ME
|
||||||
UINT16 MeLimit;
|
UINT16 MeLimit; //
|
||||||
UINT16 GbeBase;
|
UINT16 GbeBase; // GbE
|
||||||
UINT16 GbeLimit;
|
UINT16 GbeLimit; //
|
||||||
UINT16 PdrBase;
|
UINT16 PdrBase; // PDR
|
||||||
UINT16 PdrLimit;
|
UINT16 PdrLimit; //
|
||||||
|
UINT16 Region5Base; // Reserved region
|
||||||
|
UINT16 Region5Limit; //
|
||||||
|
UINT16 Region6Base; // Reserved region
|
||||||
|
UINT16 Region6Limit; //
|
||||||
|
UINT16 Region7Base; // Reserved region
|
||||||
|
UINT16 Region7Limit; //
|
||||||
|
UINT16 EcBase; // EC
|
||||||
|
UINT16 EcLimit; //
|
||||||
} FLASH_DESCRIPTOR_REGION_SECTION;
|
} FLASH_DESCRIPTOR_REGION_SECTION;
|
||||||
|
|
||||||
// Flash block erase sizes
|
|
||||||
#define FLASH_BLOCK_ERASE_SIZE_4KB 0x0000
|
|
||||||
#define FLASH_BLOCK_ERASE_SIZE_8KB 0x0001
|
|
||||||
#define FLASH_BLOCK_ERASE_SIZE_64KB 0x000F
|
|
||||||
|
|
||||||
// Master section
|
// Master section
|
||||||
typedef struct _FLASH_DESCRIPTOR_MASTER_SECTION {
|
typedef struct _FLASH_DESCRIPTOR_MASTER_SECTION {
|
||||||
UINT16 BiosId;
|
UINT16 BiosId;
|
||||||
UINT8 BiosRead;
|
UINT8 BiosRead;
|
||||||
UINT8 BiosWrite;
|
UINT8 BiosWrite;
|
||||||
UINT16 MeId;
|
UINT16 MeId;
|
||||||
UINT8 MeRead;
|
UINT8 MeRead;
|
||||||
UINT8 MeWrite;
|
UINT8 MeWrite;
|
||||||
UINT16 GbeId;
|
UINT16 GbeId;
|
||||||
UINT8 GbeRead;
|
UINT8 GbeRead;
|
||||||
UINT8 GbeWrite;
|
UINT8 GbeWrite;
|
||||||
} FLASH_DESCRIPTOR_MASTER_SECTION;
|
} FLASH_DESCRIPTOR_MASTER_SECTION;
|
||||||
|
|
||||||
|
// Master section v2 (Skylake+)
|
||||||
|
typedef struct _FLASH_DESCRIPTOR_MASTER_SECTION_V2 {
|
||||||
|
UINT32 : 8;
|
||||||
|
UINT32 BiosRead : 12;
|
||||||
|
UINT32 BiosWrite : 12;
|
||||||
|
UINT32 : 8;
|
||||||
|
UINT32 MeRead : 12;
|
||||||
|
UINT32 MeWrite : 12;
|
||||||
|
UINT32 : 8;
|
||||||
|
UINT32 GbeRead : 12;
|
||||||
|
UINT32 GbeWrite : 12;
|
||||||
|
UINT32 :32;
|
||||||
|
UINT32 : 8;
|
||||||
|
UINT32 EcRead : 12;
|
||||||
|
UINT32 EcWrite : 12;
|
||||||
|
} FLASH_DESCRIPTOR_MASTER_SECTION_V2;
|
||||||
|
|
||||||
// Region access bits in master section
|
// Region access bits in master section
|
||||||
#define FLASH_DESCRIPTOR_REGION_ACCESS_DESC 0x01
|
#define FLASH_DESCRIPTOR_REGION_ACCESS_DESC 0x01
|
||||||
#define FLASH_DESCRIPTOR_REGION_ACCESS_BIOS 0x02
|
#define FLASH_DESCRIPTOR_REGION_ACCESS_BIOS 0x02
|
||||||
#define FLASH_DESCRIPTOR_REGION_ACCESS_ME 0x04
|
#define FLASH_DESCRIPTOR_REGION_ACCESS_ME 0x04
|
||||||
#define FLASH_DESCRIPTOR_REGION_ACCESS_GBE 0x08
|
#define FLASH_DESCRIPTOR_REGION_ACCESS_GBE 0x08
|
||||||
#define FLASH_DESCRIPTOR_REGION_ACCESS_PDR 0x10
|
#define FLASH_DESCRIPTOR_REGION_ACCESS_PDR 0x10
|
||||||
|
#define FLASH_DESCRIPTOR_REGION_ACCESS_EC 0x20
|
||||||
//!TODO: Describe PCH and PROC straps sections, as well as ICC and DMI tables
|
|
||||||
|
|
||||||
// Base address of descriptor upper map
|
// Base address of descriptor upper map
|
||||||
#define FLASH_DESCRIPTOR_UPPER_MAP_BASE 0x0EFC
|
#define FLASH_DESCRIPTOR_UPPER_MAP_BASE 0x0EFC
|
||||||
|
@ -155,7 +194,7 @@ typedef struct _VSCC_TABLE_ENTRY {
|
||||||
|
|
||||||
// Base address and size of OEM section
|
// Base address and size of OEM section
|
||||||
#define FLASH_DESCRIPTOR_OEM_SECTION_BASE 0x0F00
|
#define FLASH_DESCRIPTOR_OEM_SECTION_BASE 0x0F00
|
||||||
#define FLASH_DESCRIPTOR_OEM_SECTION_SIZE 0xFF
|
#define FLASH_DESCRIPTOR_OEM_SECTION_SIZE 0x100
|
||||||
|
|
||||||
// Restore previous packing rules
|
// Restore previous packing rules
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
2
ffs.cpp
2
ffs.cpp
|
@ -155,7 +155,7 @@ UINT32 sizeOfSectionHeader(const EFI_COMMON_SECTION_HEADER* header)
|
||||||
if (!header)
|
if (!header)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
bool extended = false;
|
const bool extended = false;
|
||||||
/*if (uint24ToUint32(header->Size) == EFI_SECTION2_IS_USED) {
|
/*if (uint24ToUint32(header->Size) == EFI_SECTION2_IS_USED) {
|
||||||
extended = true;
|
extended = true;
|
||||||
}*/
|
}*/
|
||||||
|
|
30
ffs.h
30
ffs.h
|
@ -32,7 +32,7 @@ extern QString sectionTypeToQString(const UINT8 type);
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
// EFI Capsule
|
// EFI Capsule
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
// Capsule header
|
// Standard EFI Capsule header
|
||||||
typedef struct _EFI_CAPSULE_HEADER {
|
typedef struct _EFI_CAPSULE_HEADER {
|
||||||
EFI_GUID CapsuleGuid;
|
EFI_GUID CapsuleGuid;
|
||||||
UINT32 HeaderSize;
|
UINT32 HeaderSize;
|
||||||
|
@ -49,16 +49,32 @@ typedef struct _EFI_CAPSULE_HEADER {
|
||||||
const QByteArray EFI_CAPSULE_GUID
|
const QByteArray EFI_CAPSULE_GUID
|
||||||
("\xBD\x86\x66\x3B\x76\x0D\x30\x40\xB7\x0E\xB5\x51\x9E\x2F\xC5\xA0", 16);
|
("\xBD\x86\x66\x3B\x76\x0D\x30\x40\xB7\x0E\xB5\x51\x9E\x2F\xC5\xA0", 16);
|
||||||
|
|
||||||
|
// Intel capsule GUID
|
||||||
|
const QByteArray INTEL_CAPSULE_GUID
|
||||||
|
("\xB9\x82\x91\x53\xB5\xAB\x91\x43\xB6\x9A\xE3\xA9\x43\xF7\x2F\xCC", 16);
|
||||||
|
|
||||||
|
// Toshiba EFI Capsule header
|
||||||
|
typedef struct _TOSHIBA_CAPSULE_HEADER {
|
||||||
|
EFI_GUID CapsuleGuid;
|
||||||
|
UINT32 HeaderSize;
|
||||||
|
UINT32 FullSize;
|
||||||
|
UINT32 Flags;
|
||||||
|
} TOSHIBA_CAPSULE_HEADER;
|
||||||
|
|
||||||
|
// Toshiba capsule GUID
|
||||||
|
const QByteArray TOSHIBA_CAPSULE_GUID
|
||||||
|
("\x62\x70\xE0\x3B\x51\x1D\xD2\x45\x83\x2B\xF0\x93\x25\x7E\xD4\x61", 16);
|
||||||
|
|
||||||
// AMI Aptio extended capsule header
|
// AMI Aptio extended capsule header
|
||||||
typedef struct _APTIO_CAPSULE_HEADER {
|
typedef struct _APTIO_CAPSULE_HEADER {
|
||||||
EFI_CAPSULE_HEADER CapsuleHeader;
|
EFI_CAPSULE_HEADER CapsuleHeader;
|
||||||
UINT16 RomImageOffset; // offset in bytes from the beginning of the capsule header to the start of
|
UINT16 RomImageOffset; // offset in bytes from the beginning of the capsule header to the start of
|
||||||
// the capsule volume
|
// the capsule volume
|
||||||
//!TODO: Enable certificate and ROM layout reading
|
//!TODO: Enable certificate and ROM layout reading
|
||||||
//UINT16 RomLayoutOffset; // offset to the table of the module descriptors in the capsule's volume
|
//UINT16 RomLayoutOffset; // offset to the table of the module descriptors in the capsule's volume
|
||||||
// that are included in the signature calculation
|
// that are included in the signature calculation
|
||||||
//FW_CERTIFICATE FWCert;
|
//FW_CERTIFICATE FWCert;
|
||||||
//ROM_AREA RomAreaMap[1];
|
//ROM_AREA RomAreaMap[1];
|
||||||
} APTIO_CAPSULE_HEADER;
|
} APTIO_CAPSULE_HEADER;
|
||||||
|
|
||||||
// AMI Aptio signed extended capsule GUID
|
// AMI Aptio signed extended capsule GUID
|
||||||
|
@ -93,7 +109,7 @@ typedef struct _EFI_FIRMWARE_VOLUME_HEADER {
|
||||||
UINT16 ExtHeaderOffset; //Reserved in Revision 1
|
UINT16 ExtHeaderOffset; //Reserved in Revision 1
|
||||||
UINT8 Reserved;
|
UINT8 Reserved;
|
||||||
UINT8 Revision;
|
UINT8 Revision;
|
||||||
//EFI_FV_BLOCK_MAP_ENTRY FvBlockMap[1];
|
//EFI_FV_BLOCK_MAP_ENTRY FvBlockMap[2];
|
||||||
} EFI_FIRMWARE_VOLUME_HEADER;
|
} EFI_FIRMWARE_VOLUME_HEADER;
|
||||||
|
|
||||||
// Standard file system GUIDs
|
// Standard file system GUIDs
|
||||||
|
@ -252,8 +268,8 @@ extern UINT16 calculateChecksum16(const UINT16* buffer, UINT32 bufferSize);
|
||||||
// Integrity check
|
// Integrity check
|
||||||
typedef union {
|
typedef union {
|
||||||
struct {
|
struct {
|
||||||
UINT8 Header;
|
UINT8 Header;
|
||||||
UINT8 File;
|
UINT8 File;
|
||||||
} Checksum;
|
} Checksum;
|
||||||
UINT16 TailReference; // Revision 1
|
UINT16 TailReference; // Revision 1
|
||||||
UINT16 Checksum16; // Revision 2
|
UINT16 Checksum16; // Revision 2
|
||||||
|
|
790
ffsengine.cpp
790
ffsengine.cpp
File diff suppressed because it is too large
Load diff
|
@ -67,6 +67,7 @@ public:
|
||||||
UINT8 parseMeRegion(const QByteArray & me, QModelIndex & index, const QModelIndex & parent, const UINT8 mode = CREATE_MODE_APPEND);
|
UINT8 parseMeRegion(const QByteArray & me, QModelIndex & index, const QModelIndex & parent, const UINT8 mode = CREATE_MODE_APPEND);
|
||||||
UINT8 parseBiosRegion(const QByteArray & bios, QModelIndex & index, const QModelIndex & parent, const UINT8 mode = CREATE_MODE_APPEND);
|
UINT8 parseBiosRegion(const QByteArray & bios, QModelIndex & index, const QModelIndex & parent, const UINT8 mode = CREATE_MODE_APPEND);
|
||||||
UINT8 parsePdrRegion(const QByteArray & pdr, QModelIndex & index, const QModelIndex & parent, const UINT8 mode = CREATE_MODE_APPEND);
|
UINT8 parsePdrRegion(const QByteArray & pdr, QModelIndex & index, const QModelIndex & parent, const UINT8 mode = CREATE_MODE_APPEND);
|
||||||
|
UINT8 parseEcRegion(const QByteArray & ec, QModelIndex & index, const QModelIndex & parent, const UINT8 mode = CREATE_MODE_APPEND);
|
||||||
UINT8 parseBios(const QByteArray & bios, const QModelIndex & parent = QModelIndex());
|
UINT8 parseBios(const QByteArray & bios, const QModelIndex & parent = QModelIndex());
|
||||||
UINT8 parseVolume(const QByteArray & volume, QModelIndex & index, const QModelIndex & parent = QModelIndex(), const UINT8 mode = CREATE_MODE_APPEND);
|
UINT8 parseVolume(const QByteArray & volume, QModelIndex & index, const QModelIndex & parent = QModelIndex(), const UINT8 mode = CREATE_MODE_APPEND);
|
||||||
UINT8 parseFile(const QByteArray & file, QModelIndex & index, const UINT8 erasePolarity = ERASE_POLARITY_UNKNOWN, const QModelIndex & parent = QModelIndex(), const UINT8 mode = CREATE_MODE_APPEND);
|
UINT8 parseFile(const QByteArray & file, QModelIndex & index, const UINT8 erasePolarity = ERASE_POLARITY_UNKNOWN, const QModelIndex & parent = QModelIndex(), const UINT8 mode = CREATE_MODE_APPEND);
|
||||||
|
@ -81,7 +82,8 @@ public:
|
||||||
UINT8 reconstructImageFile(QByteArray &reconstructed);
|
UINT8 reconstructImageFile(QByteArray &reconstructed);
|
||||||
UINT8 reconstruct(const QModelIndex &index, QByteArray & reconstructed);
|
UINT8 reconstruct(const QModelIndex &index, QByteArray & reconstructed);
|
||||||
UINT8 reconstructIntelImage(const QModelIndex& index, QByteArray & reconstructed);
|
UINT8 reconstructIntelImage(const QModelIndex& index, QByteArray & reconstructed);
|
||||||
UINT8 reconstructRegion(const QModelIndex& index, QByteArray & reconstructed);
|
UINT8 reconstructRegion(const QModelIndex& index, QByteArray & reconstructed, bool includeHeader = true);
|
||||||
|
UINT8 reconstructPadding(const QModelIndex& index, QByteArray & reconstructed);
|
||||||
UINT8 reconstructBios(const QModelIndex& index, QByteArray & reconstructed);
|
UINT8 reconstructBios(const QModelIndex& index, QByteArray & reconstructed);
|
||||||
UINT8 reconstructVolume(const QModelIndex& index, QByteArray & reconstructed);
|
UINT8 reconstructVolume(const QModelIndex& index, QByteArray & reconstructed);
|
||||||
UINT8 reconstructFile(const QModelIndex& index, const UINT8 revision, const UINT8 erasePolarity, const UINT32 base, QByteArray& reconstructed);
|
UINT8 reconstructFile(const QModelIndex& index, const UINT8 revision, const UINT8 erasePolarity, const UINT32 base, QByteArray& reconstructed);
|
||||||
|
|
18
treeitem.cpp
18
treeitem.cpp
|
@ -17,7 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
TreeItem::TreeItem(const UINT8 type, const UINT8 subtype, const UINT8 compression,
|
TreeItem::TreeItem(const UINT8 type, const UINT8 subtype, const UINT8 compression,
|
||||||
const QString & name, const QString & text, const QString & info,
|
const QString & name, const QString & text, const QString & info,
|
||||||
const QByteArray & header, const QByteArray & body, const QByteArray & parsingData,
|
const QByteArray & header, const QByteArray & body,
|
||||||
TreeItem *parent) :
|
TreeItem *parent) :
|
||||||
itemAction(Actions::NoAction),
|
itemAction(Actions::NoAction),
|
||||||
itemType(type),
|
itemType(type),
|
||||||
|
@ -28,7 +28,6 @@ TreeItem::TreeItem(const UINT8 type, const UINT8 subtype, const UINT8 compressio
|
||||||
itemInfo(info),
|
itemInfo(info),
|
||||||
itemHeader(header),
|
itemHeader(header),
|
||||||
itemBody(body),
|
itemBody(body),
|
||||||
itemParsingData(parsingData),
|
|
||||||
parentItem(parent)
|
parentItem(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -184,11 +183,6 @@ QByteArray TreeItem::body() const
|
||||||
return itemBody;
|
return itemBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray TreeItem::parsingData() const
|
|
||||||
{
|
|
||||||
return itemParsingData;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TreeItem::hasEmptyHeader() const
|
bool TreeItem::hasEmptyHeader() const
|
||||||
{
|
{
|
||||||
return itemHeader.isEmpty();
|
return itemHeader.isEmpty();
|
||||||
|
@ -199,16 +193,6 @@ bool TreeItem::hasEmptyBody() const
|
||||||
return itemBody.isEmpty();
|
return itemBody.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TreeItem::hasEmptyParsingData() const
|
|
||||||
{
|
|
||||||
return itemParsingData.isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TreeItem::setParsingData(const QByteArray & data)
|
|
||||||
{
|
|
||||||
itemParsingData = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
UINT8 TreeItem::action() const
|
UINT8 TreeItem::action() const
|
||||||
{
|
{
|
||||||
return itemAction;
|
return itemAction;
|
||||||
|
|
|
@ -26,7 +26,7 @@ class TreeItem
|
||||||
public:
|
public:
|
||||||
TreeItem(const UINT8 type, const UINT8 subtype = 0, const UINT8 compression = COMPRESSION_ALGORITHM_NONE,
|
TreeItem(const UINT8 type, const UINT8 subtype = 0, const UINT8 compression = COMPRESSION_ALGORITHM_NONE,
|
||||||
const QString &name = QString(), const QString &text = QString(), const QString &info = QString(),
|
const QString &name = QString(), const QString &text = QString(), const QString &info = QString(),
|
||||||
const QByteArray & header = QByteArray(), const QByteArray & body = QByteArray(), const QByteArray & parsingData = QByteArray(),
|
const QByteArray & header = QByteArray(), const QByteArray & body = QByteArray(),
|
||||||
TreeItem *parent = 0);
|
TreeItem *parent = 0);
|
||||||
~TreeItem();
|
~TreeItem();
|
||||||
|
|
||||||
|
@ -63,10 +63,6 @@ public:
|
||||||
QByteArray body() const;
|
QByteArray body() const;
|
||||||
bool hasEmptyBody() const;
|
bool hasEmptyBody() const;
|
||||||
|
|
||||||
QByteArray parsingData() const;
|
|
||||||
bool hasEmptyParsingData() const;
|
|
||||||
void setParsingData(const QByteArray & data);
|
|
||||||
|
|
||||||
QString info() const;
|
QString info() const;
|
||||||
void addInfo(const QString &info);
|
void addInfo(const QString &info);
|
||||||
void setInfo(const QString &info);
|
void setInfo(const QString &info);
|
||||||
|
@ -87,7 +83,6 @@ private:
|
||||||
QString itemInfo;
|
QString itemInfo;
|
||||||
QByteArray itemHeader;
|
QByteArray itemHeader;
|
||||||
QByteArray itemBody;
|
QByteArray itemBody;
|
||||||
QByteArray itemParsingData;
|
|
||||||
TreeItem *parentItem;
|
TreeItem *parentItem;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -178,22 +178,6 @@ bool TreeModel::hasEmptyBody(const QModelIndex &index) const
|
||||||
return item->hasEmptyBody();
|
return item->hasEmptyBody();
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray TreeModel::parsingData(const QModelIndex &index) const
|
|
||||||
{
|
|
||||||
if (!index.isValid())
|
|
||||||
return QByteArray();
|
|
||||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
|
||||||
return item->parsingData();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TreeModel::hasEmptyParsingData(const QModelIndex &index) const
|
|
||||||
{
|
|
||||||
if (!index.isValid())
|
|
||||||
return true;
|
|
||||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
|
||||||
return item->hasEmptyParsingData();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString TreeModel::name(const QModelIndex &index) const
|
QString TreeModel::name(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
|
@ -284,20 +268,9 @@ void TreeModel::setAction(const QModelIndex &index, const UINT8 action)
|
||||||
emit dataChanged(this->index(0, 0), index);
|
emit dataChanged(this->index(0, 0), index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TreeModel::setParsingData(const QModelIndex &index, const QByteArray &data)
|
|
||||||
{
|
|
||||||
if (!index.isValid())
|
|
||||||
return;
|
|
||||||
|
|
||||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
|
||||||
item->setParsingData(data);
|
|
||||||
emit dataChanged(this->index(0, 0), index);
|
|
||||||
}
|
|
||||||
|
|
||||||
QModelIndex TreeModel::addItem(const UINT8 type, const UINT8 subtype, const UINT8 compression,
|
QModelIndex TreeModel::addItem(const UINT8 type, const UINT8 subtype, const UINT8 compression,
|
||||||
const QString & name, const QString & text, const QString & info,
|
const QString & name, const QString & text, const QString & info,
|
||||||
const QByteArray & header, const QByteArray & body, const QByteArray & parsingData,
|
const QByteArray & header, const QByteArray & body, const QModelIndex & parent, const UINT8 mode)
|
||||||
const QModelIndex & parent, const UINT8 mode)
|
|
||||||
{
|
{
|
||||||
TreeItem *item = 0;
|
TreeItem *item = 0;
|
||||||
TreeItem *parentItem = 0;
|
TreeItem *parentItem = 0;
|
||||||
|
@ -318,7 +291,7 @@ QModelIndex TreeModel::addItem(const UINT8 type, const UINT8 subtype, const UINT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TreeItem *newItem = new TreeItem(type, subtype, compression, name, text, info, header, body, parsingData, parentItem);
|
TreeItem *newItem = new TreeItem(type, subtype, compression, name, text, info, header, body, parentItem);
|
||||||
if (mode == CREATE_MODE_APPEND) {
|
if (mode == CREATE_MODE_APPEND) {
|
||||||
emit layoutAboutToBeChanged();
|
emit layoutAboutToBeChanged();
|
||||||
parentItem->appendChild(newItem);
|
parentItem->appendChild(newItem);
|
||||||
|
|
|
@ -65,7 +65,7 @@ public:
|
||||||
|
|
||||||
QModelIndex addItem(const UINT8 type, const UINT8 subtype = 0, const UINT8 compression = COMPRESSION_ALGORITHM_NONE,
|
QModelIndex addItem(const UINT8 type, const UINT8 subtype = 0, const UINT8 compression = COMPRESSION_ALGORITHM_NONE,
|
||||||
const QString & name = QString(), const QString & text = QString(), const QString & info = QString(),
|
const QString & name = QString(), const QString & text = QString(), const QString & info = QString(),
|
||||||
const QByteArray & header = QByteArray(), const QByteArray & body = QByteArray(), const QByteArray & parsingData = QByteArray(),
|
const QByteArray & header = QByteArray(), const QByteArray & body = QByteArray(),
|
||||||
const QModelIndex & parent = QModelIndex(), const UINT8 mode = CREATE_MODE_APPEND);
|
const QModelIndex & parent = QModelIndex(), const UINT8 mode = CREATE_MODE_APPEND);
|
||||||
|
|
||||||
QModelIndex findParentOfType(const QModelIndex & index, UINT8 type) const;
|
QModelIndex findParentOfType(const QModelIndex & index, UINT8 type) const;
|
||||||
|
|
|
@ -24,11 +24,13 @@ QString regionTypeToQString(const UINT8 type)
|
||||||
case Subtypes::GbeRegion:
|
case Subtypes::GbeRegion:
|
||||||
return QObject::tr("GbE");
|
return QObject::tr("GbE");
|
||||||
case Subtypes::MeRegion:
|
case Subtypes::MeRegion:
|
||||||
return QObject::tr("ME/TXE");
|
return QObject::tr("ME");
|
||||||
case Subtypes::BiosRegion:
|
case Subtypes::BiosRegion:
|
||||||
return QObject::tr("BIOS");
|
return QObject::tr("BIOS");
|
||||||
case Subtypes::PdrRegion:
|
case Subtypes::PdrRegion:
|
||||||
return QObject::tr("PDR");
|
return QObject::tr("PDR");
|
||||||
|
case Subtypes::EcRegion:
|
||||||
|
return QObject::tr("EC");
|
||||||
default:
|
default:
|
||||||
return QObject::tr("Unknown");
|
return QObject::tr("Unknown");
|
||||||
};
|
};
|
||||||
|
@ -95,7 +97,9 @@ QString itemSubtypeToQString(const UINT8 type, const UINT8 subtype)
|
||||||
else if (subtype == Subtypes::AptioUnsignedCapsule)
|
else if (subtype == Subtypes::AptioUnsignedCapsule)
|
||||||
return QObject::tr("Aptio unsigned");
|
return QObject::tr("Aptio unsigned");
|
||||||
else if (subtype == Subtypes::UefiCapsule)
|
else if (subtype == Subtypes::UefiCapsule)
|
||||||
return QObject::tr("UEFI 2.0 ");
|
return QObject::tr("UEFI 2.0");
|
||||||
|
else if (subtype == Subtypes::ToshibaCapsule)
|
||||||
|
return QObject::tr("Toshiba");
|
||||||
else
|
else
|
||||||
return QObject::tr("Unknown subtype");
|
return QObject::tr("Unknown subtype");
|
||||||
case Types::Region:
|
case Types::Region:
|
||||||
|
|
27
types.h
27
types.h
|
@ -54,7 +54,8 @@ namespace Subtypes {
|
||||||
enum CapsuleSubtypes {
|
enum CapsuleSubtypes {
|
||||||
AptioSignedCapsule = 80,
|
AptioSignedCapsule = 80,
|
||||||
AptioUnsignedCapsule,
|
AptioUnsignedCapsule,
|
||||||
UefiCapsule
|
UefiCapsule,
|
||||||
|
ToshibaCapsule
|
||||||
};
|
};
|
||||||
|
|
||||||
enum VolumeSubtypes {
|
enum VolumeSubtypes {
|
||||||
|
@ -68,7 +69,8 @@ namespace Subtypes {
|
||||||
GbeRegion,
|
GbeRegion,
|
||||||
MeRegion,
|
MeRegion,
|
||||||
BiosRegion,
|
BiosRegion,
|
||||||
PdrRegion
|
PdrRegion,
|
||||||
|
EcRegion
|
||||||
};
|
};
|
||||||
|
|
||||||
enum PaddingSubtypes {
|
enum PaddingSubtypes {
|
||||||
|
@ -85,25 +87,4 @@ extern QString itemSubtypeToQString(const UINT8 type, const UINT8 subtype);
|
||||||
extern QString compressionTypeToQString(const UINT8 algorithm);
|
extern QString compressionTypeToQString(const UINT8 algorithm);
|
||||||
extern QString regionTypeToQString(const UINT8 type);
|
extern QString regionTypeToQString(const UINT8 type);
|
||||||
|
|
||||||
enum ParsingDataTypes {
|
|
||||||
UnknownParsingData,
|
|
||||||
VolumeParsingData,
|
|
||||||
FileParsingData
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef union _PARSING_DATA_UNION {
|
|
||||||
struct _PARSING_DATA_UNION_VOLUME {
|
|
||||||
bool HasZeroVectorCRC;
|
|
||||||
} Volume;
|
|
||||||
|
|
||||||
struct _PARSING_DATA_UNION_FILE {
|
|
||||||
UINT32 Offset;
|
|
||||||
} File;
|
|
||||||
} PARSING_DATA_UNION;
|
|
||||||
|
|
||||||
typedef struct _PARSING_DATA {
|
|
||||||
UINT8 Type;
|
|
||||||
PARSING_DATA_UNION Data;
|
|
||||||
} PARSING_DATA;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
31
uefitool.cpp
31
uefitool.cpp
|
@ -17,7 +17,7 @@
|
||||||
UEFITool::UEFITool(QWidget *parent) :
|
UEFITool::UEFITool(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
ui(new Ui::UEFITool),
|
ui(new Ui::UEFITool),
|
||||||
version(tr("0.20.4"))
|
version(tr("0.21.5"))
|
||||||
{
|
{
|
||||||
clipboard = QApplication::clipboard();
|
clipboard = QApplication::clipboard();
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ version(tr("0.20.4"))
|
||||||
|
|
||||||
// Connect signals to slots
|
// Connect signals to slots
|
||||||
connect(ui->actionOpenImageFile, SIGNAL(triggered()), this, SLOT(openImageFile()));
|
connect(ui->actionOpenImageFile, SIGNAL(triggered()), this, SLOT(openImageFile()));
|
||||||
|
connect(ui->actionOpenImageFileInNewWindow, SIGNAL(triggered()), this, SLOT(openImageFileInNewWindow()));
|
||||||
connect(ui->actionSaveImageFile, SIGNAL(triggered()), this, SLOT(saveImageFile()));
|
connect(ui->actionSaveImageFile, SIGNAL(triggered()), this, SLOT(saveImageFile()));
|
||||||
connect(ui->actionSearch, SIGNAL(triggered()), this, SLOT(search()));
|
connect(ui->actionSearch, SIGNAL(triggered()), this, SLOT(search()));
|
||||||
connect(ui->actionExtract, SIGNAL(triggered()), this, SLOT(extractAsIs()));
|
connect(ui->actionExtract, SIGNAL(triggered()), this, SLOT(extractAsIs()));
|
||||||
|
@ -83,6 +84,11 @@ UEFITool::~UEFITool()
|
||||||
delete searchDialog;
|
delete searchDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UEFITool::setProgramPath(QString path)
|
||||||
|
{
|
||||||
|
currentProgramPath = path;
|
||||||
|
};
|
||||||
|
|
||||||
void UEFITool::init()
|
void UEFITool::init()
|
||||||
{
|
{
|
||||||
// Clear components
|
// Clear components
|
||||||
|
@ -147,7 +153,7 @@ void UEFITool::populateUi(const QModelIndex ¤t)
|
||||||
(type == Types::Section && (subtype == EFI_SECTION_COMPRESSION || subtype == EFI_SECTION_GUID_DEFINED || subtype == EFI_SECTION_DISPOSABLE)));
|
(type == Types::Section && (subtype == EFI_SECTION_COMPRESSION || subtype == EFI_SECTION_GUID_DEFINED || subtype == EFI_SECTION_DISPOSABLE)));
|
||||||
ui->actionInsertBefore->setEnabled(type == Types::File || type == Types::Section);
|
ui->actionInsertBefore->setEnabled(type == Types::File || type == Types::Section);
|
||||||
ui->actionInsertAfter->setEnabled(type == Types::File || type == Types::Section);
|
ui->actionInsertAfter->setEnabled(type == Types::File || type == Types::Section);
|
||||||
ui->actionReplace->setEnabled((type == Types::Region && subtype != Subtypes::DescriptorRegion) || type == Types::Volume || type == Types::File || type == Types::Section);
|
ui->actionReplace->setEnabled((type == Types::Region && subtype != Subtypes::DescriptorRegion) || type == Types::Padding || type == Types::Volume || type == Types::File || type == Types::Section);
|
||||||
ui->actionReplaceBody->setEnabled(type == Types::Volume || type == Types::File || type == Types::Section);
|
ui->actionReplaceBody->setEnabled(type == Types::Volume || type == Types::File || type == Types::Section);
|
||||||
ui->actionMessagesCopy->setEnabled(false);
|
ui->actionMessagesCopy->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
@ -321,6 +327,13 @@ void UEFITool::replace(const UINT8 mode)
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (model->type(index) == Types::Padding) {
|
||||||
|
if (mode == REPLACE_MODE_AS_IS) {
|
||||||
|
path = QFileDialog::getOpenFileName(this, tr("Select padding file to replace selected object"), currentDir, "Padding files (*.pad *.bin);;All files (*)");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
}
|
||||||
else if (model->type(index) == Types::Volume) {
|
else if (model->type(index) == Types::Volume) {
|
||||||
if (mode == REPLACE_MODE_AS_IS) {
|
if (mode == REPLACE_MODE_AS_IS) {
|
||||||
path = QFileDialog::getOpenFileName(this, tr("Select volume file to replace selected object"), currentDir, "Volume files (*.vol *.bin);;All files (*)");
|
path = QFileDialog::getOpenFileName(this, tr("Select volume file to replace selected object"), currentDir, "Volume files (*.vol *.bin);;All files (*)");
|
||||||
|
@ -358,6 +371,8 @@ void UEFITool::replace(const UINT8 mode)
|
||||||
path = QFileDialog::getOpenFileName(this, tr("Select volume file to replace body"), currentDir, "Volume files (*.vol *.bin);;All files (*)");
|
path = QFileDialog::getOpenFileName(this, tr("Select volume file to replace body"), currentDir, "Volume files (*.vol *.bin);;All files (*)");
|
||||||
else if (model->subtype(index) == EFI_SECTION_RAW)
|
else if (model->subtype(index) == EFI_SECTION_RAW)
|
||||||
path = QFileDialog::getOpenFileName(this, tr("Select raw file to replace body"), currentDir, "Raw files (*.raw *.bin);;All files (*)");
|
path = QFileDialog::getOpenFileName(this, tr("Select raw file to replace body"), currentDir, "Raw files (*.raw *.bin);;All files (*)");
|
||||||
|
else if (model->subtype(index) == EFI_SECTION_PE32 || model->subtype(index) == EFI_SECTION_TE || model->subtype(index) == EFI_SECTION_PIC)
|
||||||
|
path = QFileDialog::getOpenFileName(this, tr("Select EFI executable file to replace body"), currentDir, "EFI executable files (*.efi *.dxe *.pei *.bin);;All files (*)");
|
||||||
else
|
else
|
||||||
path = QFileDialog::getOpenFileName(this, tr("Select file to replace body"), currentDir, "Binary files (*.bin);;All files (*)");
|
path = QFileDialog::getOpenFileName(this, tr("Select file to replace body"), currentDir, "Binary files (*.bin);;All files (*)");
|
||||||
}
|
}
|
||||||
|
@ -521,7 +536,7 @@ void UEFITool::exit()
|
||||||
|
|
||||||
void UEFITool::saveImageFile()
|
void UEFITool::saveImageFile()
|
||||||
{
|
{
|
||||||
QString path = QFileDialog::getSaveFileName(this, tr("Save BIOS image file"), currentDir, "BIOS image files (*.rom *.bin *.cap *.bio *.fd *.wph *.efi *.dec);;All files (*)");
|
QString path = QFileDialog::getSaveFileName(this, tr("Save BIOS image file"), currentDir, "BIOS image files (*.rom *.bin *.cap *.bio *.fd *.wph *.dec);;All files (*)");
|
||||||
|
|
||||||
if (path.isEmpty())
|
if (path.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
@ -552,10 +567,18 @@ void UEFITool::saveImageFile()
|
||||||
|
|
||||||
void UEFITool::openImageFile()
|
void UEFITool::openImageFile()
|
||||||
{
|
{
|
||||||
QString path = QFileDialog::getOpenFileName(this, tr("Open BIOS image file"), currentDir, "BIOS image files (*.rom *.bin *.cap *.bio *.fd *.wph *.efi *.dec);;All files (*)");
|
QString path = QFileDialog::getOpenFileName(this, tr("Open BIOS image file"), currentDir, "BIOS image files (*.rom *.bin *.cap *.bio *.fd *.wph *.dec);;All files (*)");
|
||||||
openImageFile(path);
|
openImageFile(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UEFITool::openImageFileInNewWindow()
|
||||||
|
{
|
||||||
|
QString path = QFileDialog::getOpenFileName(this, tr("Open BIOS image file in new window"), currentDir, "BIOS image files (*.rom *.bin *.cap *.bio *.fd *.wph *.dec);;All files (*)");
|
||||||
|
if (path.trimmed().isEmpty())
|
||||||
|
return;
|
||||||
|
QProcess::startDetached(currentProgramPath, QStringList(path));
|
||||||
|
}
|
||||||
|
|
||||||
void UEFITool::openImageFile(QString path)
|
void UEFITool::openImageFile(QString path)
|
||||||
{
|
{
|
||||||
if (path.trimmed().isEmpty())
|
if (path.trimmed().isEmpty())
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
|
#include <QProcess>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QSplitter>
|
#include <QSplitter>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
@ -51,6 +52,7 @@ public:
|
||||||
~UEFITool();
|
~UEFITool();
|
||||||
|
|
||||||
void openImageFile(QString path);
|
void openImageFile(QString path);
|
||||||
|
void setProgramPath(QString path);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void init();
|
void init();
|
||||||
|
@ -58,6 +60,7 @@ public:
|
||||||
void scrollTreeView(QListWidgetItem* item);
|
void scrollTreeView(QListWidgetItem* item);
|
||||||
|
|
||||||
void openImageFile();
|
void openImageFile();
|
||||||
|
void openImageFileInNewWindow();
|
||||||
void saveImageFile();
|
void saveImageFile();
|
||||||
void search();
|
void search();
|
||||||
|
|
||||||
|
@ -95,6 +98,7 @@ private:
|
||||||
SearchDialog* searchDialog;
|
SearchDialog* searchDialog;
|
||||||
QClipboard* clipboard;
|
QClipboard* clipboard;
|
||||||
QString currentDir;
|
QString currentDir;
|
||||||
|
QString currentProgramPath;
|
||||||
QQueue<MessageListItem> messageItems;
|
QQueue<MessageListItem> messageItems;
|
||||||
const QString version;
|
const QString version;
|
||||||
|
|
||||||
|
|
14
uefitool.ui
14
uefitool.ui
|
@ -188,6 +188,7 @@
|
||||||
<string>&File</string>
|
<string>&File</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="actionOpenImageFile"/>
|
<addaction name="actionOpenImageFile"/>
|
||||||
|
<addaction name="actionOpenImageFileInNewWindow"/>
|
||||||
<addaction name="actionSaveImageFile"/>
|
<addaction name="actionSaveImageFile"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionSearch"/>
|
<addaction name="actionSearch"/>
|
||||||
|
@ -231,6 +232,8 @@
|
||||||
<string>&Padding</string>
|
<string>&Padding</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="actionExtract"/>
|
<addaction name="actionExtract"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
<addaction name="actionReplace"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuVolumeActions">
|
<widget class="QMenu" name="menuVolumeActions">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
@ -522,6 +525,17 @@
|
||||||
<string>Ctrl+Alt+C</string>
|
<string>Ctrl+Alt+C</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionOpenImageFileInNewWindow">
|
||||||
|
<property name="text">
|
||||||
|
<string>&Open image file in new window...</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Open image file in new window</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+Shift+O</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|
|
@ -23,6 +23,7 @@ int main(int argc, char *argv[])
|
||||||
a.setApplicationName("UEFITool");
|
a.setApplicationName("UEFITool");
|
||||||
|
|
||||||
UEFITool w;
|
UEFITool w;
|
||||||
|
w.setProgramPath(a.arguments().at(0));
|
||||||
if (a.arguments().length() > 1)
|
if (a.arguments().length() > 1)
|
||||||
w.openImageFile(a.arguments().at(1));
|
w.openImageFile(a.arguments().at(1));
|
||||||
w.show();
|
w.show();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue