mirror of
https://github.com/LongSoft/UEFITool.git
synced 2025-02-13 15:22:42 +08:00
UEFITool 0.18.4 / UEFIExtract 0.2.2
- added new FFS GUID found new in Apple EFI images - added PDR region parsing as BIOS space (Apple feature again) - changed default directory for saving to the directory containing opened file - focus and cursor position are now set properly for GUID tab in search dialog - search dialog resized to fit the whole GUID - codebase cleaned form unnecessary spaces
This commit is contained in:
parent
6e1f226aa0
commit
534f01fcd5
@ -31,26 +31,26 @@ SRes OnProgress(void *p, UInt64 inSize, UInt64 outSize)
|
|||||||
static ICompressProgress g_ProgressCallback = { &OnProgress };
|
static ICompressProgress g_ProgressCallback = { &OnProgress };
|
||||||
|
|
||||||
STATIC
|
STATIC
|
||||||
UINT64
|
UINT64
|
||||||
EFIAPI
|
EFIAPI
|
||||||
RShiftU64 (
|
RShiftU64(
|
||||||
UINT64 Operand,
|
UINT64 Operand,
|
||||||
UINT32 Count
|
UINT32 Count
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return Operand >> Count;
|
return Operand >> Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
SetEncodedSizeOfBuf(
|
SetEncodedSizeOfBuf(
|
||||||
UINT64 EncodedSize,
|
UINT64 EncodedSize,
|
||||||
UINT8 *EncodedData
|
UINT8 *EncodedData
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
INT32 Index;
|
INT32 Index;
|
||||||
|
|
||||||
EncodedData[LZMA_PROPS_SIZE] = EncodedSize & 0xFF;
|
EncodedData[LZMA_PROPS_SIZE] = EncodedSize & 0xFF;
|
||||||
for (Index = LZMA_PROPS_SIZE+1; Index <= LZMA_PROPS_SIZE + 7; Index++)
|
for (Index = LZMA_PROPS_SIZE + 1; Index <= LZMA_PROPS_SIZE + 7; Index++)
|
||||||
{
|
{
|
||||||
EncodedSize = RShiftU64(EncodedSize, 8);
|
EncodedSize = RShiftU64(EncodedSize, 8);
|
||||||
EncodedData[Index] = EncodedSize & 0xFF;
|
EncodedData[Index] = EncodedSize & 0xFF;
|
||||||
@ -58,13 +58,13 @@ VOID
|
|||||||
}
|
}
|
||||||
|
|
||||||
INT32
|
INT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
LzmaCompress (
|
LzmaCompress(
|
||||||
CONST UINT8 *Source,
|
CONST UINT8 *Source,
|
||||||
UINT32 SourceSize,
|
UINT32 SourceSize,
|
||||||
UINT8 *Destination,
|
UINT8 *Destination,
|
||||||
UINT32 *DestinationSize
|
UINT32 *DestinationSize
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
SRes LzmaResult;
|
SRes LzmaResult;
|
||||||
CLzmaEncProps props;
|
CLzmaEncProps props;
|
||||||
@ -101,10 +101,8 @@ INT32
|
|||||||
|
|
||||||
if (LzmaResult == SZ_OK) {
|
if (LzmaResult == SZ_OK) {
|
||||||
return ERR_SUCCESS;
|
return ERR_SUCCESS;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return ERR_INVALID_PARAMETER;
|
return ERR_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __LZMACOMPRESS_H__
|
#ifndef __LZMACOMPRESS_H__
|
||||||
#define __LZMACOMPRESS_H__
|
#define __LZMACOMPRESS_H__
|
||||||
@ -24,9 +24,9 @@ extern "C" {
|
|||||||
#define LZMA_DICTIONARY_SIZE 0x800000
|
#define LZMA_DICTIONARY_SIZE 0x800000
|
||||||
#define _LZMA_SIZE_OPT
|
#define _LZMA_SIZE_OPT
|
||||||
|
|
||||||
INT32
|
INT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
LzmaCompress (
|
LzmaCompress(
|
||||||
const UINT8 *Source,
|
const UINT8 *Source,
|
||||||
UINT32 SourceSize,
|
UINT32 SourceSize,
|
||||||
UINT8 *Destination,
|
UINT8 *Destination,
|
||||||
|
@ -18,11 +18,11 @@ WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
UINT64
|
UINT64
|
||||||
EFIAPI
|
EFIAPI
|
||||||
LShiftU64 (
|
LShiftU64(
|
||||||
UINT64 Operand,
|
UINT64 Operand,
|
||||||
UINT32 Count
|
UINT32 Count
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return Operand << Count;
|
return Operand << Count;
|
||||||
}
|
}
|
||||||
@ -39,9 +39,9 @@ Get the size of the uncompressed buffer by parsing EncodeData header.
|
|||||||
@return The size of the uncompressed buffer.
|
@return The size of the uncompressed buffer.
|
||||||
*/
|
*/
|
||||||
UINT64
|
UINT64
|
||||||
GetDecodedSizeOfBuf(
|
GetDecodedSizeOfBuf(
|
||||||
UINT8 *EncodedData
|
UINT8 *EncodedData
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT64 DecodedSize;
|
UINT64 DecodedSize;
|
||||||
INT32 Index;
|
INT32 Index;
|
||||||
@ -86,12 +86,12 @@ buffer was returned ScratchSize.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
INT32
|
INT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
LzmaGetInfo (
|
LzmaGetInfo(
|
||||||
CONST VOID *Source,
|
CONST VOID *Source,
|
||||||
UINT32 SourceSize,
|
UINT32 SourceSize,
|
||||||
UINT32 *DestinationSize
|
UINT32 *DestinationSize
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UInt64 DecodedSize;
|
UInt64 DecodedSize;
|
||||||
|
|
||||||
@ -123,12 +123,12 @@ The source buffer specified by Source is corrupted
|
|||||||
(not a valid compressed format).
|
(not a valid compressed format).
|
||||||
*/
|
*/
|
||||||
INT32
|
INT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
LzmaDecompress (
|
LzmaDecompress(
|
||||||
CONST VOID *Source,
|
CONST VOID *Source,
|
||||||
UINT32 SourceSize,
|
UINT32 SourceSize,
|
||||||
VOID *Destination
|
VOID *Destination
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
SRes LzmaResult;
|
SRes LzmaResult;
|
||||||
ELzmaStatus Status;
|
ELzmaStatus Status;
|
||||||
@ -136,10 +136,10 @@ INT32
|
|||||||
SizeT EncodedDataSize;
|
SizeT EncodedDataSize;
|
||||||
|
|
||||||
DecodedBufSize = (SizeT)GetDecodedSizeOfBuf((UINT8*)Source);
|
DecodedBufSize = (SizeT)GetDecodedSizeOfBuf((UINT8*)Source);
|
||||||
EncodedDataSize = (SizeT) (SourceSize - LZMA_HEADER_SIZE);
|
EncodedDataSize = (SizeT)(SourceSize - LZMA_HEADER_SIZE);
|
||||||
|
|
||||||
LzmaResult = LzmaDecode(
|
LzmaResult = LzmaDecode(
|
||||||
(Byte*) Destination,
|
(Byte*)Destination,
|
||||||
&DecodedBufSize,
|
&DecodedBufSize,
|
||||||
(Byte*)((UINT8*)Source + LZMA_HEADER_SIZE),
|
(Byte*)((UINT8*)Source + LZMA_HEADER_SIZE),
|
||||||
&EncodedDataSize,
|
&EncodedDataSize,
|
||||||
@ -152,8 +152,8 @@ INT32
|
|||||||
|
|
||||||
if (LzmaResult == SZ_OK) {
|
if (LzmaResult == SZ_OK) {
|
||||||
return ERR_SUCCESS;
|
return ERR_SUCCESS;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return ERR_INVALID_PARAMETER;
|
return ERR_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __LZMADECOMPRESS_H__
|
#ifndef __LZMADECOMPRESS_H__
|
||||||
#define __LZMADECOMPRESS_H__
|
#define __LZMADECOMPRESS_H__
|
||||||
@ -23,14 +23,14 @@ extern "C" {
|
|||||||
|
|
||||||
#define LZMA_HEADER_SIZE (LZMA_PROPS_SIZE + 8)
|
#define LZMA_HEADER_SIZE (LZMA_PROPS_SIZE + 8)
|
||||||
|
|
||||||
UINT64
|
UINT64
|
||||||
EFIAPI
|
EFIAPI
|
||||||
LShiftU64 (
|
LShiftU64(
|
||||||
UINT64 Operand,
|
UINT64 Operand,
|
||||||
UINT32 Count
|
UINT32 Count
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Given a Lzma compressed source buffer, this function retrieves the size of
|
Given a Lzma compressed source buffer, this function retrieves the size of
|
||||||
the uncompressed buffer and the size of the scratch buffer required
|
the uncompressed buffer and the size of the scratch buffer required
|
||||||
to decompress the compressed source buffer.
|
to decompress the compressed source buffer.
|
||||||
@ -56,16 +56,16 @@ LShiftU64 (
|
|||||||
DestinationSize and the size of the scratch
|
DestinationSize and the size of the scratch
|
||||||
buffer was returned ScratchSize.
|
buffer was returned ScratchSize.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
INT32
|
INT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
LzmaGetInfo (
|
LzmaGetInfo(
|
||||||
const VOID *Source,
|
const VOID *Source,
|
||||||
UINT32 SourceSize,
|
UINT32 SourceSize,
|
||||||
UINT32 *DestinationSize
|
UINT32 *DestinationSize
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Decompresses a Lzma compressed source buffer.
|
Decompresses a Lzma compressed source buffer.
|
||||||
|
|
||||||
Extracts decompressed data to its original form.
|
Extracts decompressed data to its original form.
|
||||||
@ -83,10 +83,10 @@ LzmaGetInfo (
|
|||||||
@retval EFI_INVALID_PARAMETER
|
@retval EFI_INVALID_PARAMETER
|
||||||
The source buffer specified by Source is corrupted
|
The source buffer specified by Source is corrupted
|
||||||
(not a valid compressed format).
|
(not a valid compressed format).
|
||||||
*/
|
*/
|
||||||
INT32
|
INT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
LzmaDecompress (
|
LzmaDecompress(
|
||||||
const VOID *Source,
|
const VOID *Source,
|
||||||
UINT32 SourceSize,
|
UINT32 SourceSize,
|
||||||
VOID *Destination
|
VOID *Destination
|
||||||
@ -96,4 +96,3 @@ LzmaDecompress (
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -516,7 +516,6 @@ static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
|
|||||||
p->hash[hash2Value] =
|
p->hash[hash2Value] =
|
||||||
p->hash[kFix3HashSize + hashValue] = p->pos;
|
p->hash[kFix3HashSize + hashValue] = p->pos;
|
||||||
|
|
||||||
|
|
||||||
maxLen = 2;
|
maxLen = 2;
|
||||||
offset = 0;
|
offset = 0;
|
||||||
if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
|
if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
|
||||||
@ -543,11 +542,11 @@ static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
|
|||||||
|
|
||||||
HASH4_CALC;
|
HASH4_CALC;
|
||||||
|
|
||||||
delta2 = p->pos - p->hash[ hash2Value];
|
delta2 = p->pos - p->hash[hash2Value];
|
||||||
delta3 = p->pos - p->hash[kFix3HashSize + hash3Value];
|
delta3 = p->pos - p->hash[kFix3HashSize + hash3Value];
|
||||||
curMatch = p->hash[kFix4HashSize + hashValue];
|
curMatch = p->hash[kFix4HashSize + hashValue];
|
||||||
|
|
||||||
p->hash[ hash2Value] =
|
p->hash[hash2Value] =
|
||||||
p->hash[kFix3HashSize + hash3Value] =
|
p->hash[kFix3HashSize + hash3Value] =
|
||||||
p->hash[kFix4HashSize + hashValue] = p->pos;
|
p->hash[kFix4HashSize + hashValue] = p->pos;
|
||||||
|
|
||||||
@ -590,11 +589,11 @@ static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
|
|||||||
|
|
||||||
HASH4_CALC;
|
HASH4_CALC;
|
||||||
|
|
||||||
delta2 = p->pos - p->hash[ hash2Value];
|
delta2 = p->pos - p->hash[hash2Value];
|
||||||
delta3 = p->pos - p->hash[kFix3HashSize + hash3Value];
|
delta3 = p->pos - p->hash[kFix3HashSize + hash3Value];
|
||||||
curMatch = p->hash[kFix4HashSize + hashValue];
|
curMatch = p->hash[kFix4HashSize + hashValue];
|
||||||
|
|
||||||
p->hash[ hash2Value] =
|
p->hash[hash2Value] =
|
||||||
p->hash[kFix3HashSize + hash3Value] =
|
p->hash[kFix3HashSize + hash3Value] =
|
||||||
p->hash[kFix4HashSize + hashValue] = p->pos;
|
p->hash[kFix4HashSize + hashValue] = p->pos;
|
||||||
|
|
||||||
@ -653,8 +652,7 @@ static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
|
|||||||
curMatch = p->hash[hashValue];
|
curMatch = p->hash[hashValue];
|
||||||
p->hash[hashValue] = p->pos;
|
p->hash[hashValue] = p->pos;
|
||||||
SKIP_FOOTER
|
SKIP_FOOTER
|
||||||
}
|
} while (--num != 0);
|
||||||
while (--num != 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
|
void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
|
||||||
@ -666,8 +664,7 @@ void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
|
|||||||
curMatch = p->hash[hashValue];
|
curMatch = p->hash[hashValue];
|
||||||
p->hash[hashValue] = p->pos;
|
p->hash[hashValue] = p->pos;
|
||||||
SKIP_FOOTER
|
SKIP_FOOTER
|
||||||
}
|
} while (--num != 0);
|
||||||
while (--num != 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
|
static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
|
||||||
@ -681,8 +678,7 @@ static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
|
|||||||
p->hash[hash2Value] =
|
p->hash[hash2Value] =
|
||||||
p->hash[kFix3HashSize + hashValue] = p->pos;
|
p->hash[kFix3HashSize + hashValue] = p->pos;
|
||||||
SKIP_FOOTER
|
SKIP_FOOTER
|
||||||
}
|
} while (--num != 0);
|
||||||
while (--num != 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
|
static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
|
||||||
@ -693,12 +689,11 @@ static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
|
|||||||
SKIP_HEADER(4)
|
SKIP_HEADER(4)
|
||||||
HASH4_CALC;
|
HASH4_CALC;
|
||||||
curMatch = p->hash[kFix4HashSize + hashValue];
|
curMatch = p->hash[kFix4HashSize + hashValue];
|
||||||
p->hash[ hash2Value] =
|
p->hash[hash2Value] =
|
||||||
p->hash[kFix3HashSize + hash3Value] = p->pos;
|
p->hash[kFix3HashSize + hash3Value] = p->pos;
|
||||||
p->hash[kFix4HashSize + hashValue] = p->pos;
|
p->hash[kFix4HashSize + hashValue] = p->pos;
|
||||||
SKIP_FOOTER
|
SKIP_FOOTER
|
||||||
}
|
} while (--num != 0);
|
||||||
while (--num != 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
|
static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
|
||||||
@ -709,13 +704,12 @@ static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
|
|||||||
SKIP_HEADER(4)
|
SKIP_HEADER(4)
|
||||||
HASH4_CALC;
|
HASH4_CALC;
|
||||||
curMatch = p->hash[kFix4HashSize + hashValue];
|
curMatch = p->hash[kFix4HashSize + hashValue];
|
||||||
p->hash[ hash2Value] =
|
p->hash[hash2Value] =
|
||||||
p->hash[kFix3HashSize + hash3Value] =
|
p->hash[kFix3HashSize + hash3Value] =
|
||||||
p->hash[kFix4HashSize + hashValue] = p->pos;
|
p->hash[kFix4HashSize + hashValue] = p->pos;
|
||||||
p->son[p->cyclicBufferPos] = curMatch;
|
p->son[p->cyclicBufferPos] = curMatch;
|
||||||
MOVE_POS
|
MOVE_POS
|
||||||
}
|
} while (--num != 0);
|
||||||
while (--num != 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
|
void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
|
||||||
@ -728,8 +722,7 @@ void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
|
|||||||
p->hash[hashValue] = p->pos;
|
p->hash[hashValue] = p->pos;
|
||||||
p->son[p->cyclicBufferPos] = curMatch;
|
p->son[p->cyclicBufferPos] = curMatch;
|
||||||
MOVE_POS
|
MOVE_POS
|
||||||
}
|
} while (--num != 0);
|
||||||
while (--num != 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable)
|
void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable)
|
||||||
|
@ -56,7 +56,6 @@
|
|||||||
#define TREE_DECODE_CHECK(probs, limit, i) \
|
#define TREE_DECODE_CHECK(probs, limit, i) \
|
||||||
{ i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; }
|
{ i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; }
|
||||||
|
|
||||||
|
|
||||||
#define kNumPosBitsMax 4
|
#define kNumPosBitsMax 4
|
||||||
#define kNumPosStatesMax (1 << kNumPosBitsMax)
|
#define kNumPosStatesMax (1 << kNumPosBitsMax)
|
||||||
|
|
||||||
@ -74,7 +73,6 @@
|
|||||||
#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
|
#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
|
||||||
#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
|
#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
|
||||||
|
|
||||||
|
|
||||||
#define kNumStates 12
|
#define kNumStates 12
|
||||||
#define kNumLitStates 7
|
#define kNumLitStates 7
|
||||||
|
|
||||||
@ -118,14 +116,14 @@ StopCompilingDueBUG
|
|||||||
/* First LZMA-symbol is always decoded.
|
/* First LZMA-symbol is always decoded.
|
||||||
And it decodes new LZMA-symbols while (buf < bufLimit), but "buf" is with last normalization
|
And it decodes new LZMA-symbols while (buf < bufLimit), but "buf" is with last normalization
|
||||||
Out:
|
Out:
|
||||||
Result:
|
Result:
|
||||||
SZ_OK - OK
|
SZ_OK - OK
|
||||||
SZ_ERROR_DATA - Error
|
SZ_ERROR_DATA - Error
|
||||||
p->remainLen:
|
p->remainLen:
|
||||||
< kMatchSpecLenStart : normal remain
|
< kMatchSpecLenStart : normal remain
|
||||||
= kMatchSpecLenStart : finished
|
= kMatchSpecLenStart : finished
|
||||||
= kMatchSpecLenStart + 1 : Flush marker
|
= kMatchSpecLenStart + 1 : Flush marker
|
||||||
= kMatchSpecLenStart + 2 : State Init Marker
|
= kMatchSpecLenStart + 2 : State Init Marker
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
|
static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
|
||||||
@ -187,15 +185,14 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte
|
|||||||
bit = (matchByte & offs);
|
bit = (matchByte & offs);
|
||||||
probLit = prob + offs + bit + symbol;
|
probLit = prob + offs + bit + symbol;
|
||||||
GET_BIT2(probLit, symbol, offs &= ~bit, offs &= bit)
|
GET_BIT2(probLit, symbol, offs &= ~bit, offs &= bit)
|
||||||
}
|
} while (symbol < 0x100);
|
||||||
while (symbol < 0x100);
|
|
||||||
}
|
}
|
||||||
dic[dicPos++] = (Byte)symbol;
|
dic[dicPos++] = (Byte)symbol;
|
||||||
processedPos++;
|
processedPos++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UPDATE_1(prob);
|
UPDATE_1(prob);
|
||||||
prob = probs + IsRep + state;
|
prob = probs + IsRep + state;
|
||||||
IF_BIT_0(prob)
|
IF_BIT_0(prob)
|
||||||
@ -204,8 +201,8 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte
|
|||||||
state += kNumStates;
|
state += kNumStates;
|
||||||
prob = probs + LenCoder;
|
prob = probs + LenCoder;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UPDATE_1(prob);
|
UPDATE_1(prob);
|
||||||
if (checkDicSize == 0 && processedPos == 0)
|
if (checkDicSize == 0 && processedPos == 0)
|
||||||
return SZ_ERROR_DATA;
|
return SZ_ERROR_DATA;
|
||||||
@ -257,7 +254,7 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte
|
|||||||
}
|
}
|
||||||
state = state < kNumLitStates ? 8 : 11;
|
state = state < kNumLitStates ? 8 : 11;
|
||||||
prob = probs + RepLenCoder;
|
prob = probs + RepLenCoder;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
unsigned limit, offset;
|
unsigned limit, offset;
|
||||||
CLzmaProb *probLen = prob + LenChoice;
|
CLzmaProb *probLen = prob + LenChoice;
|
||||||
@ -291,8 +288,8 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte
|
|||||||
len += offset;
|
len += offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state >= kNumStates)
|
if (state >= kNumStates)
|
||||||
{
|
{
|
||||||
UInt32 distance;
|
UInt32 distance;
|
||||||
prob = probs + PosSlot +
|
prob = probs + PosSlot +
|
||||||
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits);
|
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits);
|
||||||
@ -311,10 +308,9 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte
|
|||||||
unsigned i = 1;
|
unsigned i = 1;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
GET_BIT2(prob + i, i, ; , distance |= mask);
|
GET_BIT2(prob + i, i, ;, distance |= mask);
|
||||||
mask <<= 1;
|
mask <<= 1;
|
||||||
}
|
} while (--numDirectBits != 0);
|
||||||
while (--numDirectBits != 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -340,16 +336,15 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte
|
|||||||
distance |= 1;
|
distance |= 1;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
} while (--numDirectBits != 0);
|
||||||
while (--numDirectBits != 0);
|
|
||||||
prob = probs + Align;
|
prob = probs + Align;
|
||||||
distance <<= kNumAlignBits;
|
distance <<= kNumAlignBits;
|
||||||
{
|
{
|
||||||
unsigned i = 1;
|
unsigned i = 1;
|
||||||
GET_BIT2(prob + i, i, ; , distance |= 1);
|
GET_BIT2(prob + i, i, ;, distance |= 1);
|
||||||
GET_BIT2(prob + i, i, ; , distance |= 2);
|
GET_BIT2(prob + i, i, ;, distance |= 2);
|
||||||
GET_BIT2(prob + i, i, ; , distance |= 4);
|
GET_BIT2(prob + i, i, ;, distance |= 4);
|
||||||
GET_BIT2(prob + i, i, ; , distance |= 8);
|
GET_BIT2(prob + i, i, ;, distance |= 8);
|
||||||
}
|
}
|
||||||
if (distance == (UInt32)0xFFFFFFFF)
|
if (distance == (UInt32)0xFFFFFFFF)
|
||||||
{
|
{
|
||||||
@ -371,13 +366,13 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte
|
|||||||
else if (distance >= checkDicSize)
|
else if (distance >= checkDicSize)
|
||||||
return SZ_ERROR_DATA;
|
return SZ_ERROR_DATA;
|
||||||
state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3;
|
state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
len += kMatchMinLen;
|
len += kMatchMinLen;
|
||||||
|
|
||||||
if (limit == dicPos)
|
if (limit == dicPos)
|
||||||
return SZ_ERROR_DATA;
|
return SZ_ERROR_DATA;
|
||||||
{
|
{
|
||||||
SizeT rem = limit - dicPos;
|
SizeT rem = limit - dicPos;
|
||||||
unsigned curLen = ((rem < len) ? (unsigned)rem : len);
|
unsigned curLen = ((rem < len) ? (unsigned)rem : len);
|
||||||
SizeT pos = (dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0);
|
SizeT pos = (dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0);
|
||||||
@ -402,13 +397,11 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte
|
|||||||
dic[dicPos++] = dic[pos];
|
dic[dicPos++] = dic[pos];
|
||||||
if (++pos == dicBufSize)
|
if (++pos == dicBufSize)
|
||||||
pos = 0;
|
pos = 0;
|
||||||
|
} while (--curLen != 0);
|
||||||
}
|
}
|
||||||
while (--curLen != 0);
|
}
|
||||||
}
|
}
|
||||||
}
|
} while (dicPos < limit && buf < bufLimit);
|
||||||
}
|
|
||||||
}
|
|
||||||
while (dicPos < limit && buf < bufLimit);
|
|
||||||
NORMALIZE;
|
NORMALIZE;
|
||||||
p->buf = buf;
|
p->buf = buf;
|
||||||
p->range = range;
|
p->range = range;
|
||||||
@ -466,8 +459,7 @@ static int MY_FAST_CALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte
|
|||||||
if (p->processedPos >= p->prop.dicSize)
|
if (p->processedPos >= p->prop.dicSize)
|
||||||
p->checkDicSize = p->prop.dicSize;
|
p->checkDicSize = p->prop.dicSize;
|
||||||
LzmaDec_WriteRem(p, limit);
|
LzmaDec_WriteRem(p, limit);
|
||||||
}
|
} while (p->dicPos < limit && p->buf < bufLimit && p->remainLen < kMatchSpecLenStart);
|
||||||
while (p->dicPos < limit && p->buf < bufLimit && p->remainLen < kMatchSpecLenStart);
|
|
||||||
|
|
||||||
if (p->remainLen > kMatchSpecLenStart)
|
if (p->remainLen > kMatchSpecLenStart)
|
||||||
{
|
{
|
||||||
@ -531,13 +523,12 @@ static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inS
|
|||||||
bit = (matchByte & offs);
|
bit = (matchByte & offs);
|
||||||
probLit = prob + offs + bit + symbol;
|
probLit = prob + offs + bit + symbol;
|
||||||
GET_BIT2_CHECK(probLit, symbol, offs &= ~bit, offs &= bit)
|
GET_BIT2_CHECK(probLit, symbol, offs &= ~bit, offs &= bit)
|
||||||
}
|
} while (symbol < 0x100);
|
||||||
while (symbol < 0x100);
|
|
||||||
}
|
}
|
||||||
res = DUMMY_LIT;
|
res = DUMMY_LIT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned len;
|
unsigned len;
|
||||||
UPDATE_1_CHECK;
|
UPDATE_1_CHECK;
|
||||||
|
|
||||||
@ -549,8 +540,8 @@ static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inS
|
|||||||
prob = probs + LenCoder;
|
prob = probs + LenCoder;
|
||||||
res = DUMMY_MATCH;
|
res = DUMMY_MATCH;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UPDATE_1_CHECK;
|
UPDATE_1_CHECK;
|
||||||
res = DUMMY_REP;
|
res = DUMMY_REP;
|
||||||
prob = probs + IsRepG0 + state;
|
prob = probs + IsRepG0 + state;
|
||||||
@ -593,7 +584,7 @@ static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inS
|
|||||||
}
|
}
|
||||||
state = kNumStates;
|
state = kNumStates;
|
||||||
prob = probs + RepLenCoder;
|
prob = probs + RepLenCoder;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
unsigned limit, offset;
|
unsigned limit, offset;
|
||||||
CLzmaProb *probLen = prob + LenChoice;
|
CLzmaProb *probLen = prob + LenChoice;
|
||||||
@ -627,8 +618,8 @@ static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inS
|
|||||||
len += offset;
|
len += offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state < 4)
|
if (state < 4)
|
||||||
{
|
{
|
||||||
unsigned posSlot;
|
unsigned posSlot;
|
||||||
prob = probs + PosSlot +
|
prob = probs + PosSlot +
|
||||||
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
|
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
|
||||||
@ -653,8 +644,7 @@ static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inS
|
|||||||
range >>= 1;
|
range >>= 1;
|
||||||
code -= range & (((code - range) >> 31) - 1);
|
code -= range & (((code - range) >> 31) - 1);
|
||||||
/* if (code >= range) code -= range; */
|
/* if (code >= range) code -= range; */
|
||||||
}
|
} while (--numDirectBits != 0);
|
||||||
while (--numDirectBits != 0);
|
|
||||||
prob = probs + Align;
|
prob = probs + Align;
|
||||||
numDirectBits = kNumAlignBits;
|
numDirectBits = kNumAlignBits;
|
||||||
}
|
}
|
||||||
@ -663,18 +653,16 @@ static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inS
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
GET_BIT_CHECK(prob + i, i);
|
GET_BIT_CHECK(prob + i, i);
|
||||||
}
|
} while (--numDirectBits != 0);
|
||||||
while (--numDirectBits != 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
NORMALIZE_CHECK;
|
NORMALIZE_CHECK;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void LzmaDec_InitRc(CLzmaDec *p, const Byte *data)
|
static void LzmaDec_InitRc(CLzmaDec *p, const Byte *data)
|
||||||
{
|
{
|
||||||
p->code = ((UInt32)data[1] << 24) | ((UInt32)data[2] << 16) | ((UInt32)data[3] << 8) | ((UInt32)data[4]);
|
p->code = ((UInt32)data[1] << 24) | ((UInt32)data[2] << 16) | ((UInt32)data[3] << 8) | ((UInt32)data[4]);
|
||||||
|
@ -66,11 +66,11 @@ void LzmaEncProps_Normalize(CLzmaEncProps *p)
|
|||||||
if (p->mc == 0) p->mc = (16 + (p->fb >> 1)) >> (p->btMode ? 0 : 1);
|
if (p->mc == 0) p->mc = (16 + (p->fb >> 1)) >> (p->btMode ? 0 : 1);
|
||||||
if (p->numThreads < 0)
|
if (p->numThreads < 0)
|
||||||
p->numThreads =
|
p->numThreads =
|
||||||
#ifndef _7ZIP_ST
|
#ifndef _7ZIP_ST
|
||||||
((p->btMode && p->algo) ? 2 : 1);
|
((p->btMode && p->algo) ? 2 : 1);
|
||||||
#else
|
#else
|
||||||
1;
|
1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2)
|
UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2)
|
||||||
@ -83,7 +83,6 @@ UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2)
|
|||||||
/* #define LZMA_LOG_BSR */
|
/* #define LZMA_LOG_BSR */
|
||||||
/* Define it for Intel's CPU */
|
/* Define it for Intel's CPU */
|
||||||
|
|
||||||
|
|
||||||
#ifdef LZMA_LOG_BSR
|
#ifdef LZMA_LOG_BSR
|
||||||
|
|
||||||
#define kDicLogSizeMaxCompress 30
|
#define kDicLogSizeMaxCompress 30
|
||||||
@ -126,7 +125,7 @@ void LzmaEnc_FastPosInit(Byte *g_FastPos)
|
|||||||
#define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \
|
#define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \
|
||||||
p->g_FastPos[pos >> 6] + 12 : \
|
p->g_FastPos[pos >> 6] + 12 : \
|
||||||
p->g_FastPos[pos >> (6 + kNumLogBits - 1)] + (6 + (kNumLogBits - 1)) * 2; }
|
p->g_FastPos[pos >> (6 + kNumLogBits - 1)] + (6 + (kNumLogBits - 1)) * 2; }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define GetPosSlot1(pos) p->g_FastPos[pos]
|
#define GetPosSlot1(pos) p->g_FastPos[pos]
|
||||||
#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); }
|
#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); }
|
||||||
@ -134,7 +133,6 @@ void LzmaEnc_FastPosInit(Byte *g_FastPos)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define LZMA_NUM_REPS 4
|
#define LZMA_NUM_REPS 4
|
||||||
|
|
||||||
typedef unsigned CState;
|
typedef unsigned CState;
|
||||||
@ -163,7 +161,6 @@ typedef struct
|
|||||||
#define kDicLogSizeMax 32
|
#define kDicLogSizeMax 32
|
||||||
#define kDistTableSizeMax (kDicLogSizeMax * 2)
|
#define kDistTableSizeMax (kDicLogSizeMax * 2)
|
||||||
|
|
||||||
|
|
||||||
#define kNumAlignBits 4
|
#define kNumAlignBits 4
|
||||||
#define kAlignTableSize (1 << kNumAlignBits)
|
#define kAlignTableSize (1 << kNumAlignBits)
|
||||||
#define kAlignMask (kAlignTableSize - 1)
|
#define kAlignMask (kAlignTableSize - 1)
|
||||||
@ -186,7 +183,6 @@ typedef struct
|
|||||||
|
|
||||||
#define LZMA_NUM_PB_STATES_MAX (1 << LZMA_PB_MAX)
|
#define LZMA_NUM_PB_STATES_MAX (1 << LZMA_PB_MAX)
|
||||||
|
|
||||||
|
|
||||||
#define kLenNumLowBits 3
|
#define kLenNumLowBits 3
|
||||||
#define kLenNumLowSymbols (1 << kLenNumLowBits)
|
#define kLenNumLowSymbols (1 << kLenNumLowBits)
|
||||||
#define kLenNumMidBits 3
|
#define kLenNumMidBits 3
|
||||||
@ -259,16 +255,16 @@ typedef struct
|
|||||||
IMatchFinder matchFinder;
|
IMatchFinder matchFinder;
|
||||||
void *matchFinderObj;
|
void *matchFinderObj;
|
||||||
|
|
||||||
#ifndef _7ZIP_ST
|
#ifndef _7ZIP_ST
|
||||||
Bool mtMode;
|
Bool mtMode;
|
||||||
CMatchFinderMt matchFinderMt;
|
CMatchFinderMt matchFinderMt;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CMatchFinder matchFinderBase;
|
CMatchFinder matchFinderBase;
|
||||||
|
|
||||||
#ifndef _7ZIP_ST
|
#ifndef _7ZIP_ST
|
||||||
Byte pad[128];
|
Byte pad[128];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
UInt32 optimumEndIndex;
|
UInt32 optimumEndIndex;
|
||||||
UInt32 optimumCurrentIndex;
|
UInt32 optimumCurrentIndex;
|
||||||
@ -278,9 +274,9 @@ typedef struct
|
|||||||
UInt32 numAvail;
|
UInt32 numAvail;
|
||||||
COptimal opt[kNumOpts];
|
COptimal opt[kNumOpts];
|
||||||
|
|
||||||
#ifndef LZMA_LOG_BSR
|
#ifndef LZMA_LOG_BSR
|
||||||
Byte g_FastPos[1 << kNumLogBits];
|
Byte g_FastPos[1 << kNumLogBits];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
UInt32 ProbPrices[kBitModelTotal >> kNumMoveReducingBits];
|
UInt32 ProbPrices[kBitModelTotal >> kNumMoveReducingBits];
|
||||||
UInt32 matches[LZMA_MATCH_LEN_MAX * 2 + 2 + 1];
|
UInt32 matches[LZMA_MATCH_LEN_MAX * 2 + 2 + 1];
|
||||||
@ -428,7 +424,7 @@ SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2)
|
|||||||
|
|
||||||
p->writeEndMark = props.writeEndMark;
|
p->writeEndMark = props.writeEndMark;
|
||||||
|
|
||||||
#ifndef _7ZIP_ST
|
#ifndef _7ZIP_ST
|
||||||
/*
|
/*
|
||||||
if (newMultiThread != _multiThread)
|
if (newMultiThread != _multiThread)
|
||||||
{
|
{
|
||||||
@ -437,15 +433,15 @@ SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
p->multiThread = (props.numThreads > 1);
|
p->multiThread = (props.numThreads > 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return SZ_OK;
|
return SZ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int kLiteralNextStates[kNumStates] = {0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5};
|
static const int kLiteralNextStates[kNumStates] = { 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5 };
|
||||||
static const int kMatchNextStates[kNumStates] = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10};
|
static const int kMatchNextStates[kNumStates] = { 7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10 };
|
||||||
static const int kRepNextStates[kNumStates] = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11};
|
static const int kRepNextStates[kNumStates] = { 8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11 };
|
||||||
static const int kShortRepNextStates[kNumStates]= {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11};
|
static const int kShortRepNextStates[kNumStates] = { 9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11 };
|
||||||
|
|
||||||
#define IsCharState(s) ((s) < 7)
|
#define IsCharState(s) ((s) < 7)
|
||||||
|
|
||||||
@ -519,8 +515,7 @@ static void MY_FAST_CALL RangeEnc_ShiftLow(CRangeEnc *p)
|
|||||||
if (buf == p->bufLim)
|
if (buf == p->bufLim)
|
||||||
RangeEnc_FlushStream(p);
|
RangeEnc_FlushStream(p);
|
||||||
temp = 0xFF;
|
temp = 0xFF;
|
||||||
}
|
} while (--p->cacheSize != 0);
|
||||||
while (--p->cacheSize != 0);
|
|
||||||
p->cache = (Byte)((UInt32)p->low >> 24);
|
p->cache = (Byte)((UInt32)p->low >> 24);
|
||||||
}
|
}
|
||||||
p->cacheSize++;
|
p->cacheSize++;
|
||||||
@ -545,8 +540,7 @@ static void RangeEnc_EncodeDirectBits(CRangeEnc *p, UInt32 value, int numBits)
|
|||||||
p->range <<= 8;
|
p->range <<= 8;
|
||||||
RangeEnc_ShiftLow(p);
|
RangeEnc_ShiftLow(p);
|
||||||
}
|
}
|
||||||
}
|
} while (numBits != 0);
|
||||||
while (numBits != 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void RangeEnc_EncodeBit(CRangeEnc *p, CLzmaProb *prob, UInt32 symbol)
|
static void RangeEnc_EncodeBit(CRangeEnc *p, CLzmaProb *prob, UInt32 symbol)
|
||||||
@ -579,8 +573,7 @@ static void LitEnc_Encode(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol)
|
|||||||
{
|
{
|
||||||
RangeEnc_EncodeBit(p, probs + (symbol >> 8), (symbol >> 7) & 1);
|
RangeEnc_EncodeBit(p, probs + (symbol >> 8), (symbol >> 7) & 1);
|
||||||
symbol <<= 1;
|
symbol <<= 1;
|
||||||
}
|
} while (symbol < 0x10000);
|
||||||
while (symbol < 0x10000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LitEnc_EncodeMatched(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol, UInt32 matchByte)
|
static void LitEnc_EncodeMatched(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol, UInt32 matchByte)
|
||||||
@ -593,8 +586,7 @@ static void LitEnc_EncodeMatched(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol,
|
|||||||
RangeEnc_EncodeBit(p, probs + (offs + (matchByte & offs) + (symbol >> 8)), (symbol >> 7) & 1);
|
RangeEnc_EncodeBit(p, probs + (offs + (matchByte & offs) + (symbol >> 8)), (symbol >> 7) & 1);
|
||||||
symbol <<= 1;
|
symbol <<= 1;
|
||||||
offs &= ~(matchByte ^ symbol);
|
offs &= ~(matchByte ^ symbol);
|
||||||
}
|
} while (symbol < 0x10000);
|
||||||
while (symbol < 0x10000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LzmaEnc_InitPriceTables(UInt32 *ProbPrices)
|
void LzmaEnc_InitPriceTables(UInt32 *ProbPrices)
|
||||||
@ -620,7 +612,6 @@ void LzmaEnc_InitPriceTables(UInt32 *ProbPrices)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define GET_PRICE(prob, symbol) \
|
#define GET_PRICE(prob, symbol) \
|
||||||
p->ProbPrices[((prob) ^ (((-(int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits];
|
p->ProbPrices[((prob) ^ (((-(int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits];
|
||||||
|
|
||||||
@ -641,8 +632,7 @@ static UInt32 LitEnc_GetPrice(const CLzmaProb *probs, UInt32 symbol, UInt32 *Pro
|
|||||||
{
|
{
|
||||||
price += GET_PRICEa(probs[symbol >> 8], (symbol >> 7) & 1);
|
price += GET_PRICEa(probs[symbol >> 8], (symbol >> 7) & 1);
|
||||||
symbol <<= 1;
|
symbol <<= 1;
|
||||||
}
|
} while (symbol < 0x10000);
|
||||||
while (symbol < 0x10000);
|
|
||||||
return price;
|
return price;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -657,12 +647,10 @@ static UInt32 LitEnc_GetPriceMatched(const CLzmaProb *probs, UInt32 symbol, UInt
|
|||||||
price += GET_PRICEa(probs[offs + (matchByte & offs) + (symbol >> 8)], (symbol >> 7) & 1);
|
price += GET_PRICEa(probs[offs + (matchByte & offs) + (symbol >> 8)], (symbol >> 7) & 1);
|
||||||
symbol <<= 1;
|
symbol <<= 1;
|
||||||
offs &= ~(matchByte ^ symbol);
|
offs &= ~(matchByte ^ symbol);
|
||||||
}
|
} while (symbol < 0x10000);
|
||||||
while (symbol < 0x10000);
|
|
||||||
return price;
|
return price;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void RcTree_Encode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol)
|
static void RcTree_Encode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol)
|
||||||
{
|
{
|
||||||
UInt32 m = 1;
|
UInt32 m = 1;
|
||||||
@ -717,7 +705,6 @@ static UInt32 RcTree_ReverseGetPrice(const CLzmaProb *probs, int numBitLevels, U
|
|||||||
return price;
|
return price;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void LenEnc_Init(CLenEnc *p)
|
static void LenEnc_Init(CLenEnc *p)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
@ -797,15 +784,12 @@ static void LenEnc_Encode2(CLenPriceEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32
|
|||||||
LenPriceEnc_UpdateTable(p, posState, ProbPrices);
|
LenPriceEnc_UpdateTable(p, posState, ProbPrices);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void MovePos(CLzmaEnc *p, UInt32 num)
|
static void MovePos(CLzmaEnc *p, UInt32 num)
|
||||||
{
|
{
|
||||||
#ifdef SHOW_STAT
|
#ifdef SHOW_STAT
|
||||||
ttt += num;
|
ttt += num;
|
||||||
printf("\n MovePos %d", num);
|
printf("\n MovePos %d", num);
|
||||||
#endif
|
#endif
|
||||||
if (num != 0)
|
if (num != 0)
|
||||||
{
|
{
|
||||||
p->additionalOffset += num;
|
p->additionalOffset += num;
|
||||||
@ -818,7 +802,7 @@ static UInt32 ReadMatchDistances(CLzmaEnc *p, UInt32 *numDistancePairsRes)
|
|||||||
UInt32 lenRes = 0, numPairs;
|
UInt32 lenRes = 0, numPairs;
|
||||||
p->numAvail = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
|
p->numAvail = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
|
||||||
numPairs = p->matchFinder.GetMatches(p->matchFinderObj, p->matches);
|
numPairs = p->matchFinder.GetMatches(p->matchFinderObj, p->matches);
|
||||||
#ifdef SHOW_STAT
|
#ifdef SHOW_STAT
|
||||||
printf("\n i = %d numPairs = %d ", ttt, numPairs / 2);
|
printf("\n i = %d numPairs = %d ", ttt, numPairs / 2);
|
||||||
ttt++;
|
ttt++;
|
||||||
{
|
{
|
||||||
@ -826,7 +810,7 @@ static UInt32 ReadMatchDistances(CLzmaEnc *p, UInt32 *numDistancePairsRes)
|
|||||||
for (i = 0; i < numPairs; i += 2)
|
for (i = 0; i < numPairs; i += 2)
|
||||||
printf("%2d %6d | ", p->matches[i], p->matches[i + 1]);
|
printf("%2d %6d | ", p->matches[i], p->matches[i + 1]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (numPairs > 0)
|
if (numPairs > 0)
|
||||||
{
|
{
|
||||||
lenRes = p->matches[numPairs - 2];
|
lenRes = p->matches[numPairs - 2];
|
||||||
@ -848,7 +832,6 @@ static UInt32 ReadMatchDistances(CLzmaEnc *p, UInt32 *numDistancePairsRes)
|
|||||||
return lenRes;
|
return lenRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define MakeAsChar(p) (p)->backPrev = (UInt32)(-1); (p)->prev1IsChar = False;
|
#define MakeAsChar(p) (p)->backPrev = (UInt32)(-1); (p)->prev1IsChar = False;
|
||||||
#define MakeAsShortRep(p) (p)->backPrev = 0; (p)->prev1IsChar = False;
|
#define MakeAsShortRep(p) (p)->backPrev = 0; (p)->prev1IsChar = False;
|
||||||
#define IsShortRep(p) ((p)->backPrev == 0)
|
#define IsShortRep(p) ((p)->backPrev == 0)
|
||||||
@ -917,8 +900,7 @@ static UInt32 Backward(CLzmaEnc *p, UInt32 *backRes, UInt32 cur)
|
|||||||
p->opt[posPrev].posPrev = cur;
|
p->opt[posPrev].posPrev = cur;
|
||||||
cur = posPrev;
|
cur = posPrev;
|
||||||
}
|
}
|
||||||
}
|
} while (cur != 0);
|
||||||
while (cur != 0);
|
|
||||||
*backRes = p->opt[0].backPrev;
|
*backRes = p->opt[0].backPrev;
|
||||||
p->optimumCurrentIndex = p->opt[0].posPrev;
|
p->optimumCurrentIndex = p->opt[0].posPrev;
|
||||||
return p->optimumCurrentIndex;
|
return p->optimumCurrentIndex;
|
||||||
@ -1065,8 +1047,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
|
|||||||
opt->backPrev = i;
|
opt->backPrev = i;
|
||||||
opt->prev1IsChar = False;
|
opt->prev1IsChar = False;
|
||||||
}
|
}
|
||||||
}
|
} while (--repLen >= 2);
|
||||||
while (--repLen >= 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[p->state]);
|
normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[p->state]);
|
||||||
@ -1077,7 +1058,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
|
|||||||
UInt32 offs = 0;
|
UInt32 offs = 0;
|
||||||
while (len > matches[offs])
|
while (len > matches[offs])
|
||||||
offs += 2;
|
offs += 2;
|
||||||
for (; ; len++)
|
for (;; len++)
|
||||||
{
|
{
|
||||||
COptimal *opt;
|
COptimal *opt;
|
||||||
UInt32 distance = matches[offs + 1];
|
UInt32 distance = matches[offs + 1];
|
||||||
@ -1111,7 +1092,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
|
|||||||
|
|
||||||
cur = 0;
|
cur = 0;
|
||||||
|
|
||||||
#ifdef SHOW_STAT2
|
#ifdef SHOW_STAT2
|
||||||
if (position >= 0)
|
if (position >= 0)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
@ -1119,7 +1100,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
|
|||||||
for (i = cur; i <= lenEnd; i++)
|
for (i = cur; i <= lenEnd; i++)
|
||||||
printf("\nprice[%4X] = %d", position - cur + i, p->opt[i].price);
|
printf("\nprice[%4X] = %d", position - cur + i, p->opt[i].price);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
@ -1331,8 +1312,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
|
|||||||
opt->backPrev = repIndex;
|
opt->backPrev = repIndex;
|
||||||
opt->prev1IsChar = False;
|
opt->prev1IsChar = False;
|
||||||
}
|
}
|
||||||
}
|
} while (--lenTest >= 2);
|
||||||
while (--lenTest >= 2);
|
|
||||||
lenTest = lenTestTemp;
|
lenTest = lenTestTemp;
|
||||||
|
|
||||||
if (repIndex == 0)
|
if (repIndex == 0)
|
||||||
@ -1407,7 +1387,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
|
|||||||
offs += 2;
|
offs += 2;
|
||||||
curBack = matches[offs + 1];
|
curBack = matches[offs + 1];
|
||||||
GetPosSlot2(curBack, posSlot);
|
GetPosSlot2(curBack, posSlot);
|
||||||
for (lenTest = /*2*/ startLen; ; lenTest++)
|
for (lenTest = /*2*/ startLen;; lenTest++)
|
||||||
{
|
{
|
||||||
UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][lenTest - LZMA_MATCH_LEN_MIN];
|
UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][lenTest - LZMA_MATCH_LEN_MIN];
|
||||||
UInt32 lenToPosState = GetLenToPosState(lenTest);
|
UInt32 lenToPosState = GetLenToPosState(lenTest);
|
||||||
@ -1677,10 +1657,10 @@ void LzmaEnc_Construct(CLzmaEnc *p)
|
|||||||
{
|
{
|
||||||
RangeEnc_Construct(&p->rc);
|
RangeEnc_Construct(&p->rc);
|
||||||
MatchFinder_Construct(&p->matchFinderBase);
|
MatchFinder_Construct(&p->matchFinderBase);
|
||||||
#ifndef _7ZIP_ST
|
#ifndef _7ZIP_ST
|
||||||
MatchFinderMt_Construct(&p->matchFinderMt);
|
MatchFinderMt_Construct(&p->matchFinderMt);
|
||||||
p->matchFinderMt.MatchFinder = &p->matchFinderBase;
|
p->matchFinderMt.MatchFinder = &p->matchFinderBase;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
CLzmaEncProps props;
|
CLzmaEncProps props;
|
||||||
@ -1688,9 +1668,9 @@ void LzmaEnc_Construct(CLzmaEnc *p)
|
|||||||
LzmaEnc_SetProps(p, &props);
|
LzmaEnc_SetProps(p, &props);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef LZMA_LOG_BSR
|
#ifndef LZMA_LOG_BSR
|
||||||
LzmaEnc_FastPosInit(p->g_FastPos);
|
LzmaEnc_FastPosInit(p->g_FastPos);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LzmaEnc_InitPriceTables(p->ProbPrices);
|
LzmaEnc_InitPriceTables(p->ProbPrices);
|
||||||
p->litProbs = 0;
|
p->litProbs = 0;
|
||||||
@ -1716,9 +1696,9 @@ void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc)
|
|||||||
|
|
||||||
void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig)
|
void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig)
|
||||||
{
|
{
|
||||||
#ifndef _7ZIP_ST
|
#ifndef _7ZIP_ST
|
||||||
MatchFinderMt_Destruct(&p->matchFinderMt, allocBig);
|
MatchFinderMt_Destruct(&p->matchFinderMt, allocBig);
|
||||||
#endif
|
#endif
|
||||||
MatchFinder_Free(&p->matchFinderBase, allocBig);
|
MatchFinder_Free(&p->matchFinderBase, allocBig);
|
||||||
LzmaEnc_FreeLits(p, alloc);
|
LzmaEnc_FreeLits(p, alloc);
|
||||||
RangeEnc_Free(&p->rc, alloc);
|
RangeEnc_Free(&p->rc, alloc);
|
||||||
@ -1771,9 +1751,9 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize
|
|||||||
else
|
else
|
||||||
len = GetOptimum(p, nowPos32, &pos);
|
len = GetOptimum(p, nowPos32, &pos);
|
||||||
|
|
||||||
#ifdef SHOW_STAT2
|
#ifdef SHOW_STAT2
|
||||||
printf("\n pos = %4X, len = %d pos = %d", nowPos32, len, pos);
|
printf("\n pos = %4X, len = %d pos = %d", nowPos32, len, pos);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
posState = nowPos32 & p->pbMask;
|
posState = nowPos32 & p->pbMask;
|
||||||
if (len == 1 && pos == (UInt32)-1)
|
if (len == 1 && pos == (UInt32)-1)
|
||||||
@ -1901,9 +1881,9 @@ static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, I
|
|||||||
if (!RangeEnc_Alloc(&p->rc, alloc))
|
if (!RangeEnc_Alloc(&p->rc, alloc))
|
||||||
return SZ_ERROR_MEM;
|
return SZ_ERROR_MEM;
|
||||||
btMode = (p->matchFinderBase.btMode != 0);
|
btMode = (p->matchFinderBase.btMode != 0);
|
||||||
#ifndef _7ZIP_ST
|
#ifndef _7ZIP_ST
|
||||||
p->mtMode = (p->multiThread && !p->fastMode && btMode);
|
p->mtMode = (p->multiThread && !p->fastMode && btMode);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
unsigned lclp = p->lc + p->lp;
|
unsigned lclp = p->lc + p->lp;
|
||||||
@ -1926,7 +1906,7 @@ static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, I
|
|||||||
if (beforeSize + p->dictSize < keepWindowSize)
|
if (beforeSize + p->dictSize < keepWindowSize)
|
||||||
beforeSize = keepWindowSize - p->dictSize;
|
beforeSize = keepWindowSize - p->dictSize;
|
||||||
|
|
||||||
#ifndef _7ZIP_ST
|
#ifndef _7ZIP_ST
|
||||||
if (p->mtMode)
|
if (p->mtMode)
|
||||||
{
|
{
|
||||||
RINOK(MatchFinderMt_Create(&p->matchFinderMt, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig));
|
RINOK(MatchFinderMt_Create(&p->matchFinderMt, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig));
|
||||||
@ -1934,7 +1914,7 @@ static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, I
|
|||||||
MatchFinderMt_CreateVTable(&p->matchFinderMt, &p->matchFinder);
|
MatchFinderMt_CreateVTable(&p->matchFinderMt, &p->matchFinder);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (!MatchFinder_Create(&p->matchFinderBase, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig))
|
if (!MatchFinder_Create(&p->matchFinderBase, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig))
|
||||||
return SZ_ERROR_MEM;
|
return SZ_ERROR_MEM;
|
||||||
@ -1948,12 +1928,11 @@ void LzmaEnc_Init(CLzmaEnc *p)
|
|||||||
{
|
{
|
||||||
UInt32 i;
|
UInt32 i;
|
||||||
p->state = 0;
|
p->state = 0;
|
||||||
for (i = 0 ; i < LZMA_NUM_REPS; i++)
|
for (i = 0; i < LZMA_NUM_REPS; i++)
|
||||||
p->reps[i] = 0;
|
p->reps[i] = 0;
|
||||||
|
|
||||||
RangeEnc_Init(&p->rc);
|
RangeEnc_Init(&p->rc);
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < kNumStates; i++)
|
for (i = 0; i < kNumStates; i++)
|
||||||
{
|
{
|
||||||
UInt32 j;
|
UInt32 j;
|
||||||
@ -2073,13 +2052,13 @@ SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen,
|
|||||||
|
|
||||||
void LzmaEnc_Finish(CLzmaEncHandle pp)
|
void LzmaEnc_Finish(CLzmaEncHandle pp)
|
||||||
{
|
{
|
||||||
#ifndef _7ZIP_ST
|
#ifndef _7ZIP_ST
|
||||||
CLzmaEnc *p = (CLzmaEnc *)pp;
|
CLzmaEnc *p = (CLzmaEnc *)pp;
|
||||||
if (p->mtMode)
|
if (p->mtMode)
|
||||||
MatchFinderMt_ReleaseStream(&p->matchFinderMt);
|
MatchFinderMt_ReleaseStream(&p->matchFinderMt);
|
||||||
#else
|
#else
|
||||||
//pp = pp;
|
//pp = pp;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -2104,7 +2083,6 @@ static size_t MyWrite(void *pp, const void *data, size_t size)
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp)
|
UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp)
|
||||||
{
|
{
|
||||||
const CLzmaEnc *p = (CLzmaEnc *)pp;
|
const CLzmaEnc *p = (CLzmaEnc *)pp;
|
||||||
@ -2155,12 +2133,12 @@ static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress)
|
|||||||
{
|
{
|
||||||
SRes res = SZ_OK;
|
SRes res = SZ_OK;
|
||||||
|
|
||||||
#ifndef _7ZIP_ST
|
#ifndef _7ZIP_ST
|
||||||
Byte allocaDummy[0x300];
|
Byte allocaDummy[0x300];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
allocaDummy[i] = (Byte)i;
|
allocaDummy[i] = (Byte)i;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
@ -500,7 +500,6 @@ VOID
|
|||||||
// Special usage of 'next'
|
// Special usage of 'next'
|
||||||
//
|
//
|
||||||
mNext[LoopVar4] = mPos;
|
mNext[LoopVar4] = mPos;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -914,7 +913,6 @@ IN UINT32 x
|
|||||||
mSubBitBuf |= x << (mBitCount -= LoopVar8);
|
mSubBitBuf |= x << (mBitCount -= LoopVar8);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Temp = (UINT8)(mSubBitBuf | (x >> (LoopVar8 -= mBitCount)));
|
Temp = (UINT8)(mSubBitBuf | (x >> (LoopVar8 -= mBitCount)));
|
||||||
if (mDst < mDstUpperLimit) {
|
if (mDst < mDstUpperLimit) {
|
||||||
*mDst++ = Temp;
|
*mDst++ = Temp;
|
||||||
@ -925,7 +923,6 @@ IN UINT32 x
|
|||||||
mSubBitBuf = x << (mBitCount = UINT8_BIT - LoopVar8);
|
mSubBitBuf = x << (mBitCount = UINT8_BIT - LoopVar8);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Temp = (UINT8)(x >> (LoopVar8 - UINT8_BIT));
|
Temp = (UINT8)(x >> (LoopVar8 - UINT8_BIT));
|
||||||
if (mDst < mDstUpperLimit) {
|
if (mDst < mDstUpperLimit) {
|
||||||
*mDst++ = Temp;
|
*mDst++ = Temp;
|
||||||
@ -1031,7 +1028,7 @@ VOID
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ASSERT((LoopVar3 + 2)<(2 * NT - 1));
|
ASSERT((LoopVar3 + 2) < (2 * NT - 1));
|
||||||
mTFreq[LoopVar3 + 2]++;
|
mTFreq[LoopVar3 + 2]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1135,7 +1132,7 @@ VOID
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ASSERT((LoopVar3 + 2)<NPT);
|
ASSERT((LoopVar3 + 2) < NPT);
|
||||||
PutBits(mPTLen[LoopVar3 + 2], mPTCode[LoopVar3 + 2]);
|
PutBits(mPTLen[LoopVar3 + 2], mPTCode[LoopVar3 + 2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1456,7 +1453,6 @@ IN OUT UINT64 *DstSize
|
|||||||
*DstSize = mCompSize + 1 + 8;
|
*DstSize = mCompSize + 1 + 8;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT8 EfiCompress(CONST VOID* SrcBuffer, CONST UINT64 SrcSize, VOID* DstBuffer, UINT64* DstSize)
|
UINT8 EfiCompress(CONST VOID* SrcBuffer, CONST UINT64 SrcSize, VOID* DstBuffer, UINT64* DstSize)
|
||||||
|
@ -12,11 +12,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
Module Name:
|
Module Name:
|
||||||
|
|
||||||
TianoCompress.h
|
TianoCompress.h
|
||||||
|
|
||||||
Abstract:
|
Abstract:
|
||||||
|
|
||||||
Header file for compression routine.
|
Header file for compression routine.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -32,13 +32,13 @@ Abstract:
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
Tiano compression routine.
|
Tiano compression routine.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
SrcBuffer - The buffer storing the source data
|
SrcBuffer - The buffer storing the source data
|
||||||
SrcSize - The size of source data
|
SrcSize - The size of source data
|
||||||
@ -46,7 +46,7 @@ Arguments:
|
|||||||
DstSize - On input, the size of DstBuffer; On output,
|
DstSize - On input, the size of DstBuffer; On output,
|
||||||
the size of the actual compressed data.
|
the size of the actual compressed data.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
EFI_BUFFER_TOO_SMALL - The DstBuffer is too small. this case,
|
EFI_BUFFER_TOO_SMALL - The DstBuffer is too small. this case,
|
||||||
DstSize contains the size needed.
|
DstSize contains the size needed.
|
||||||
@ -54,23 +54,23 @@ Returns:
|
|||||||
EFI_OUT_OF_RESOURCES - No resource to complete function.
|
EFI_OUT_OF_RESOURCES - No resource to complete function.
|
||||||
EFI_INVALID_PARAMETER - Parameter supplied is wrong.
|
EFI_INVALID_PARAMETER - Parameter supplied is wrong.
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
UINT8
|
UINT8
|
||||||
TianoCompress (
|
TianoCompress(
|
||||||
CONST VOID *SrcBuffer,
|
CONST VOID *SrcBuffer,
|
||||||
CONST UINT64 SrcSize,
|
CONST UINT64 SrcSize,
|
||||||
VOID *DstBuffer,
|
VOID *DstBuffer,
|
||||||
UINT64 *DstSize
|
UINT64 *DstSize
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
EFI 1.1 compression routine.
|
EFI 1.1 compression routine.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
SrcBuffer - The buffer storing the source data
|
SrcBuffer - The buffer storing the source data
|
||||||
SrcSize - The size of source data
|
SrcSize - The size of source data
|
||||||
@ -78,7 +78,7 @@ Arguments:
|
|||||||
DstSize - On input, the size of DstBuffer; On output,
|
DstSize - On input, the size of DstBuffer; On output,
|
||||||
the size of the actual compressed data.
|
the size of the actual compressed data.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
EFI_BUFFER_TOO_SMALL - The DstBuffer is too small. this case,
|
EFI_BUFFER_TOO_SMALL - The DstBuffer is too small. this case,
|
||||||
DstSize contains the size needed.
|
DstSize contains the size needed.
|
||||||
@ -86,15 +86,15 @@ Returns:
|
|||||||
EFI_OUT_OF_RESOURCES - No resource to complete function.
|
EFI_OUT_OF_RESOURCES - No resource to complete function.
|
||||||
EFI_INVALID_PARAMETER - Parameter supplied is wrong.
|
EFI_INVALID_PARAMETER - Parameter supplied is wrong.
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
UINT8
|
UINT8
|
||||||
EfiCompress (
|
EfiCompress(
|
||||||
CONST VOID *SrcBuffer,
|
CONST VOID *SrcBuffer,
|
||||||
CONST UINT64 SrcSize,
|
CONST UINT64 SrcSize,
|
||||||
VOID *DstBuffer,
|
VOID *DstBuffer,
|
||||||
UINT64 *DstSize
|
UINT64 *DstSize
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,6 @@ Returns: (VOID)
|
|||||||
Sd->mBitBuf = (UINT32)(Sd->mBitBuf << NumOfBits);
|
Sd->mBitBuf = (UINT32)(Sd->mBitBuf << NumOfBits);
|
||||||
|
|
||||||
while (NumOfBits > Sd->mBitCount) {
|
while (NumOfBits > Sd->mBitCount) {
|
||||||
|
|
||||||
Sd->mBitBuf |= (UINT32)(Sd->mSubBitBuf << (NumOfBits = (UINT16)(NumOfBits - Sd->mBitCount)));
|
Sd->mBitBuf |= (UINT32)(Sd->mSubBitBuf << (NumOfBits = (UINT16)(NumOfBits - Sd->mBitCount)));
|
||||||
|
|
||||||
if (Sd->mCompSize > 0) {
|
if (Sd->mCompSize > 0) {
|
||||||
@ -114,7 +113,6 @@ Returns: (VOID)
|
|||||||
Sd->mSubBitBuf = 0;
|
Sd->mSubBitBuf = 0;
|
||||||
Sd->mSubBitBuf = Sd->mSrcBase[Sd->mInBuf++];
|
Sd->mSubBitBuf = Sd->mSrcBase[Sd->mInBuf++];
|
||||||
Sd->mBitCount = 8;
|
Sd->mBitCount = 8;
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//
|
//
|
||||||
@ -122,7 +120,6 @@ Returns: (VOID)
|
|||||||
//
|
//
|
||||||
Sd->mSubBitBuf = 0;
|
Sd->mSubBitBuf = 0;
|
||||||
Sd->mBitCount = 8;
|
Sd->mBitCount = 8;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,7 +267,6 @@ BAD_TABLE - The table is corrupted.
|
|||||||
Mask = (UINT16)(1U << (15 - TableBits));
|
Mask = (UINT16)(1U << (15 - TableBits));
|
||||||
|
|
||||||
for (Char = 0; Char < NumOfChar; Char++) {
|
for (Char = 0; Char < NumOfChar; Char++) {
|
||||||
|
|
||||||
Len = BitLen[Char];
|
Len = BitLen[Char];
|
||||||
if (Len == 0 || Len >= 17) {
|
if (Len == 0 || Len >= 17) {
|
||||||
continue;
|
continue;
|
||||||
@ -279,17 +275,14 @@ BAD_TABLE - The table is corrupted.
|
|||||||
NextCode = (UINT16)(Start[Len] + Weight[Len]);
|
NextCode = (UINT16)(Start[Len] + Weight[Len]);
|
||||||
|
|
||||||
if (Len <= TableBits) {
|
if (Len <= TableBits) {
|
||||||
|
|
||||||
for (Index = Start[Len]; Index < NextCode; Index++) {
|
for (Index = Start[Len]; Index < NextCode; Index++) {
|
||||||
// Check to prevent possible heap corruption
|
// Check to prevent possible heap corruption
|
||||||
if (Index >= (UINT16)(1U << TableBits))
|
if (Index >= (UINT16)(1U << TableBits))
|
||||||
return (UINT16)BAD_TABLE;
|
return (UINT16)BAD_TABLE;
|
||||||
Table[Index] = Char;
|
Table[Index] = Char;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Index3 = Start[Len];
|
Index3 = Start[Len];
|
||||||
Pointer = &Table[Index3 >> JuBits];
|
Pointer = &Table[Index3 >> JuBits];
|
||||||
Index = (UINT16)(Len - TableBits);
|
Index = (UINT16)(Len - TableBits);
|
||||||
@ -318,7 +311,6 @@ BAD_TABLE - The table is corrupted.
|
|||||||
}
|
}
|
||||||
|
|
||||||
*Pointer = Char;
|
*Pointer = Char;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Start[Len] = NextCode;
|
Start[Len] = NextCode;
|
||||||
@ -360,7 +352,6 @@ The position value decoded.
|
|||||||
Mask = 1U << (BITBUFSIZ - 1 - 8);
|
Mask = 1U << (BITBUFSIZ - 1 - 8);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
if (Sd->mBitBuf & Mask) {
|
if (Sd->mBitBuf & Mask) {
|
||||||
Val = Sd->mRight[Val];
|
Val = Sd->mRight[Val];
|
||||||
}
|
}
|
||||||
@ -443,7 +434,6 @@ BAD_TABLE - Table is corrupted.
|
|||||||
Index = 0;
|
Index = 0;
|
||||||
|
|
||||||
while (Index < Number) {
|
while (Index < Number) {
|
||||||
|
|
||||||
CharC = (UINT16)(Sd->mBitBuf >> (BITBUFSIZ - 3));
|
CharC = (UINT16)(Sd->mBitBuf >> (BITBUFSIZ - 3));
|
||||||
|
|
||||||
if (CharC == 7) {
|
if (CharC == 7) {
|
||||||
@ -521,13 +511,11 @@ Returns: (VOID)
|
|||||||
|
|
||||||
Index = 0;
|
Index = 0;
|
||||||
while (Index < Number) {
|
while (Index < Number) {
|
||||||
|
|
||||||
CharC = Sd->mPTTable[Sd->mBitBuf >> (BITBUFSIZ - 8)];
|
CharC = Sd->mPTTable[Sd->mBitBuf >> (BITBUFSIZ - 8)];
|
||||||
if (CharC >= NT) {
|
if (CharC >= NT) {
|
||||||
Mask = 1U << (BITBUFSIZ - 1 - 8);
|
Mask = 1U << (BITBUFSIZ - 1 - 8);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
if (Mask & Sd->mBitBuf) {
|
if (Mask & Sd->mBitBuf) {
|
||||||
CharC = Sd->mRight[CharC];
|
CharC = Sd->mRight[CharC];
|
||||||
}
|
}
|
||||||
@ -536,7 +524,6 @@ Returns: (VOID)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Mask >>= 1;
|
Mask >>= 1;
|
||||||
|
|
||||||
} while (CharC >= NT);
|
} while (CharC >= NT);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -545,7 +532,6 @@ Returns: (VOID)
|
|||||||
FillBuf(Sd, Sd->mPTLen[CharC]);
|
FillBuf(Sd, Sd->mPTLen[CharC]);
|
||||||
|
|
||||||
if (CharC <= 2) {
|
if (CharC <= 2) {
|
||||||
|
|
||||||
if (CharC == 0) {
|
if (CharC == 0) {
|
||||||
CharC = 1;
|
CharC = 1;
|
||||||
}
|
}
|
||||||
@ -559,12 +545,9 @@ Returns: (VOID)
|
|||||||
while ((INT16)(--CharC) >= 0) {
|
while ((INT16)(--CharC) >= 0) {
|
||||||
Sd->mCLen[Index++] = 0;
|
Sd->mCLen[Index++] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Sd->mCLen[Index++] = (UINT8)(CharC - 2);
|
Sd->mCLen[Index++] = (UINT8)(CharC - 2);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -687,7 +670,6 @@ Returns: (VOID)
|
|||||||
else {
|
else {
|
||||||
Sd->mDstBase[Sd->mOutBuf++] = (UINT8)CharC;
|
Sd->mDstBase[Sd->mOutBuf++] = (UINT8)CharC;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//
|
//
|
||||||
|
@ -12,12 +12,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
Module Name:
|
Module Name:
|
||||||
|
|
||||||
Decompress.h
|
Decompress.h
|
||||||
|
|
||||||
Abstract:
|
Abstract:
|
||||||
|
|
||||||
Header file for decompression routine.
|
Header file for decompression routine.
|
||||||
Providing both EFI and Tiano decompress algorithms.
|
Providing both EFI and Tiano decompress algorithms.
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
@ -32,108 +32,108 @@ Abstract:
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT32 CompSize;
|
UINT32 CompSize;
|
||||||
UINT32 OrigSize;
|
UINT32 OrigSize;
|
||||||
} EFI_TIANO_HEADER;
|
} EFI_TIANO_HEADER;
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
EfiTianoGetInfo (
|
EfiTianoGetInfo(
|
||||||
VOID *Source,
|
VOID *Source,
|
||||||
UINT32 SrcSize,
|
UINT32 SrcSize,
|
||||||
UINT32 *DstSize,
|
UINT32 *DstSize,
|
||||||
UINT32 *ScratchSize
|
UINT32 *ScratchSize
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
The implementation is same as that of EFI_DECOMPRESS_PROTOCOL.GetInfo().
|
The implementation is same as that of EFI_DECOMPRESS_PROTOCOL.GetInfo().
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
This - The protocol instance pointer
|
This - The protocol instance pointer
|
||||||
Source - The source buffer containing the compressed data.
|
Source - The source buffer containing the compressed data.
|
||||||
SrcSize - The size of source buffer
|
SrcSize - The size of source buffer
|
||||||
DstSize - The size of destination buffer.
|
DstSize - The size of destination buffer.
|
||||||
ScratchSize - The size of scratch buffer.
|
ScratchSize - The size of scratch buffer.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
EFI_SUCCESS - The size of destination buffer and the size of scratch buffer are successfully retrieved.
|
EFI_SUCCESS - The size of destination buffer and the size of scratch buffer are successfully retrieved.
|
||||||
EFI_INVALID_PARAMETER - The source data is corrupted
|
EFI_INVALID_PARAMETER - The source data is corrupted
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
;
|
;
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
EfiDecompress (
|
EfiDecompress(
|
||||||
VOID *Source,
|
VOID *Source,
|
||||||
UINT32 SrcSize,
|
UINT32 SrcSize,
|
||||||
VOID *Destination,
|
VOID *Destination,
|
||||||
UINT32 DstSize,
|
UINT32 DstSize,
|
||||||
VOID *Scratch,
|
VOID *Scratch,
|
||||||
UINT32 ScratchSize
|
UINT32 ScratchSize
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
The implementation is same as that of EFI_DECOMPRESS_PROTOCOL.Decompress().
|
The implementation is same as that of EFI_DECOMPRESS_PROTOCOL.Decompress().
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
This - The protocol instance pointer
|
This - The protocol instance pointer
|
||||||
Source - The source buffer containing the compressed data.
|
Source - The source buffer containing the compressed data.
|
||||||
SrcSize - The size of source buffer
|
SrcSize - The size of source buffer
|
||||||
Destination - The destination buffer to store the decompressed data
|
Destination - The destination buffer to store the decompressed data
|
||||||
DstSize - The size of destination buffer.
|
DstSize - The size of destination buffer.
|
||||||
Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
|
Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
|
||||||
ScratchSize - The size of scratch buffer.
|
ScratchSize - The size of scratch buffer.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
EFI_SUCCESS - Decompression is successful
|
EFI_SUCCESS - Decompression is successful
|
||||||
EFI_INVALID_PARAMETER - The source data is corrupted
|
EFI_INVALID_PARAMETER - The source data is corrupted
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
;
|
;
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
TianoDecompress (
|
TianoDecompress(
|
||||||
VOID *Source,
|
VOID *Source,
|
||||||
UINT32 SrcSize,
|
UINT32 SrcSize,
|
||||||
VOID *Destination,
|
VOID *Destination,
|
||||||
UINT32 DstSize,
|
UINT32 DstSize,
|
||||||
VOID *Scratch,
|
VOID *Scratch,
|
||||||
UINT32 ScratchSize
|
UINT32 ScratchSize
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
The implementation is same as that of EFI_TIANO_DECOMPRESS_PROTOCOL.Decompress().
|
The implementation is same as that of EFI_TIANO_DECOMPRESS_PROTOCOL.Decompress().
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
This - The protocol instance pointer
|
This - The protocol instance pointer
|
||||||
Source - The source buffer containing the compressed data.
|
Source - The source buffer containing the compressed data.
|
||||||
SrcSize - The size of source buffer
|
SrcSize - The size of source buffer
|
||||||
Destination - The destination buffer to store the decompressed data
|
Destination - The destination buffer to store the decompressed data
|
||||||
DstSize - The size of destination buffer.
|
DstSize - The size of destination buffer.
|
||||||
Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
|
Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
|
||||||
ScratchSize - The size of scratch buffer.
|
ScratchSize - The size of scratch buffer.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
EFI_SUCCESS - Decompression is successful
|
EFI_SUCCESS - Decompression is successful
|
||||||
EFI_INVALID_PARAMETER - The source data is corrupted
|
EFI_INVALID_PARAMETER - The source data is corrupted
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
;
|
;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result = ERR_INVALID_PARAMETER;
|
result = ERR_INVALID_PARAMETER;
|
||||||
std::cout << "UEFIExtract 0.2.1" << std::endl << std::endl <<
|
std::cout << "UEFIExtract 0.2.2" << std::endl << std::endl <<
|
||||||
"Usage: uefiextract imagefile\n" << std::endl;
|
"Usage: uefiextract imagefile\n" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,10 +41,6 @@ typedef uint16_t CHAR16;
|
|||||||
#define FALSE ((BOOLEAN)(0==1))
|
#define FALSE ((BOOLEAN)(0==1))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NULL
|
|
||||||
#define NULL ((VOID *) 0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ERR_SUCCESS 0
|
#define ERR_SUCCESS 0
|
||||||
#define ERR_INVALID_PARAMETER 1
|
#define ERR_INVALID_PARAMETER 1
|
||||||
#define ERR_BUFFER_TOO_SMALL 2
|
#define ERR_BUFFER_TOO_SMALL 2
|
||||||
|
@ -51,7 +51,6 @@ typedef struct {
|
|||||||
UINT16 ReservedZero; // Still unknown, zeros in all descriptors I have seen
|
UINT16 ReservedZero; // Still unknown, zeros in all descriptors I have seen
|
||||||
} FLASH_DESCRIPTOR_MAP;
|
} FLASH_DESCRIPTOR_MAP;
|
||||||
|
|
||||||
|
|
||||||
// Component section
|
// Component section
|
||||||
// Flash parameters DWORD structure
|
// Flash parameters DWORD structure
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
22
ffs.cpp
22
ffs.cpp
@ -14,24 +14,24 @@ WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#include "ffs.h"
|
#include "ffs.h"
|
||||||
|
|
||||||
const UINT8 ffsAlignmentTable[] =
|
const UINT8 ffsAlignmentTable[] =
|
||||||
{0, 4, 7, 9, 10, 12, 15, 16};
|
{ 0, 4, 7, 9, 10, 12, 15, 16 };
|
||||||
|
|
||||||
UINT8 calculateChecksum8(UINT8* buffer, UINT32 bufferSize)
|
UINT8 calculateChecksum8(UINT8* buffer, UINT32 bufferSize)
|
||||||
{
|
{
|
||||||
if(!buffer)
|
if (!buffer)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
UINT8 counter = 0;
|
UINT8 counter = 0;
|
||||||
|
|
||||||
while(bufferSize--)
|
while (bufferSize--)
|
||||||
counter += buffer[bufferSize];
|
counter += buffer[bufferSize];
|
||||||
|
|
||||||
return (UINT8) 0x100 - counter;
|
return (UINT8)0x100 - counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT16 calculateChecksum16(UINT16* buffer, UINT32 bufferSize)
|
UINT16 calculateChecksum16(UINT16* buffer, UINT32 bufferSize)
|
||||||
{
|
{
|
||||||
if(!buffer)
|
if (!buffer)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
UINT16 counter = 0;
|
UINT16 counter = 0;
|
||||||
@ -40,17 +40,17 @@ UINT16 calculateChecksum16(UINT16* buffer, UINT32 bufferSize)
|
|||||||
bufferSize /= sizeof(UINT16);
|
bufferSize /= sizeof(UINT16);
|
||||||
|
|
||||||
for (; index < bufferSize; index++) {
|
for (; index < bufferSize; index++) {
|
||||||
counter = (UINT16) (counter + buffer[index]);
|
counter = (UINT16)(counter + buffer[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (UINT16) 0x10000 - counter;
|
return (UINT16)0x10000 - counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID uint32ToUint24(UINT32 size, UINT8* ffsSize)
|
VOID uint32ToUint24(UINT32 size, UINT8* ffsSize)
|
||||||
{
|
{
|
||||||
ffsSize[2] = (UINT8) ((size) >> 16);
|
ffsSize[2] = (UINT8)((size) >> 16);
|
||||||
ffsSize[1] = (UINT8) ((size) >> 8);
|
ffsSize[1] = (UINT8)((size) >> 8);
|
||||||
ffsSize[0] = (UINT8) ((size) );
|
ffsSize[0] = (UINT8)((size));
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT32 uint24ToUint32(UINT8* ffsSize)
|
UINT32 uint24ToUint32(UINT8* ffsSize)
|
||||||
@ -62,7 +62,7 @@ UINT32 uint24ToUint32(UINT8* ffsSize)
|
|||||||
|
|
||||||
QString guidToQString(const EFI_GUID& guid)
|
QString guidToQString(const EFI_GUID& guid)
|
||||||
{
|
{
|
||||||
QByteArray baGuid = QByteArray::fromRawData((const char*) guid.Data, sizeof(EFI_GUID));
|
QByteArray baGuid = QByteArray::fromRawData((const char*)guid.Data, sizeof(EFI_GUID));
|
||||||
UINT32 i32 = *(UINT32*)baGuid.left(4).constData();
|
UINT32 i32 = *(UINT32*)baGuid.left(4).constData();
|
||||||
UINT16 i16_0 = *(UINT16*)baGuid.mid(4, 2).constData();
|
UINT16 i16_0 = *(UINT16*)baGuid.mid(4, 2).constData();
|
||||||
UINT16 i16_1 = *(UINT16*)baGuid.mid(6, 2).constData();
|
UINT16 i16_1 = *(UINT16*)baGuid.mid(6, 2).constData();
|
||||||
|
2
ffs.h
2
ffs.h
@ -97,6 +97,8 @@ const QByteArray EFI_FIRMWARE_FILE_SYSTEM_GUID
|
|||||||
("\xD9\x54\x93\x7A\x68\x04\x4A\x44\x81\xCE\x0B\xF6\x17\xD8\x90\xDF", 16);
|
("\xD9\x54\x93\x7A\x68\x04\x4A\x44\x81\xCE\x0B\xF6\x17\xD8\x90\xDF", 16);
|
||||||
const QByteArray EFI_APPLE_BOOT_VOLUME_FILE_SYSTEM_GUID
|
const QByteArray EFI_APPLE_BOOT_VOLUME_FILE_SYSTEM_GUID
|
||||||
("\xAD\xEE\xAD\x04\xFF\x61\x31\x4D\xB6\xBA\x64\xF8\xBF\x90\x1F\x5A", 16);
|
("\xAD\xEE\xAD\x04\xFF\x61\x31\x4D\xB6\xBA\x64\xF8\xBF\x90\x1F\x5A", 16);
|
||||||
|
const QByteArray EFI_APPLE_BOOT_VOLUME_FILE_SYSTEM2_GUID
|
||||||
|
("\x8C\x1B\x00\xBD\x71\x6A\x7B\x48\xA1\x4F\x0C\x2A\x2D\xCF\x7A\x5D", 16);
|
||||||
const QByteArray EFI_FIRMWARE_FILE_SYSTEM2_GUID
|
const QByteArray EFI_FIRMWARE_FILE_SYSTEM2_GUID
|
||||||
("\x78\xE5\x8C\x8C\x3D\x8A\x1C\x4F\x99\x35\x89\x61\x85\xC3\x2D\xD3", 16);
|
("\x78\xE5\x8C\x8C\x3D\x8A\x1C\x4F\x99\x35\x89\x61\x85\xC3\x2D\xD3", 16);
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ QString errorMessage(UINT8 errorCode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
FfsEngine::FfsEngine(QObject *parent)
|
FfsEngine::FfsEngine(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
model = new TreeModel();
|
model = new TreeModel();
|
||||||
oldPeiCoreEntryPoint = 0;
|
oldPeiCoreEntryPoint = 0;
|
||||||
@ -606,6 +606,11 @@ UINT8 FfsEngine::parsePdrRegion(const QByteArray & pdr, QModelIndex & index, con
|
|||||||
// Add tree item
|
// Add tree item
|
||||||
index = model->addItem(Types::Region, Subtypes::PdrRegion, COMPRESSION_ALGORITHM_NONE, name, "", info, QByteArray(), pdr, QByteArray(), parent, mode);
|
index = model->addItem(Types::Region, Subtypes::PdrRegion, COMPRESSION_ALGORITHM_NONE, name, "", info, QByteArray(), pdr, QByteArray(), parent, mode);
|
||||||
|
|
||||||
|
// Parse PDR region as BIOS space
|
||||||
|
UINT8 result = parseBios(pdr, index);
|
||||||
|
if (result && result != ERR_VOLUMES_NOT_FOUND)
|
||||||
|
return result;
|
||||||
|
|
||||||
return ERR_SUCCESS;
|
return ERR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -737,7 +742,6 @@ UINT8 FfsEngine::parseBios(const QByteArray & bios, const QModelIndex & parent)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ERR_SUCCESS;
|
return ERR_SUCCESS;
|
||||||
@ -817,6 +821,10 @@ UINT8 FfsEngine::parseVolume(const QByteArray & volume, QModelIndex & index, co
|
|||||||
else if (QByteArray((const char*)&volumeHeader->FileSystemGuid, sizeof(EFI_GUID)) == EFI_APPLE_BOOT_VOLUME_FILE_SYSTEM_GUID) {
|
else if (QByteArray((const char*)&volumeHeader->FileSystemGuid, sizeof(EFI_GUID)) == EFI_APPLE_BOOT_VOLUME_FILE_SYSTEM_GUID) {
|
||||||
// Code can be added here
|
// Code can be added here
|
||||||
}
|
}
|
||||||
|
// Apple Boot Volume FFS GUID
|
||||||
|
else if (QByteArray((const char*)&volumeHeader->FileSystemGuid, sizeof(EFI_GUID)) == EFI_APPLE_BOOT_VOLUME_FILE_SYSTEM2_GUID) {
|
||||||
|
// Code can be added here
|
||||||
|
}
|
||||||
// FFS GUID v2
|
// FFS GUID v2
|
||||||
else if (QByteArray((const char*)&volumeHeader->FileSystemGuid, sizeof(EFI_GUID)) == EFI_FIRMWARE_FILE_SYSTEM2_GUID) {
|
else if (QByteArray((const char*)&volumeHeader->FileSystemGuid, sizeof(EFI_GUID)) == EFI_FIRMWARE_FILE_SYSTEM2_GUID) {
|
||||||
// Code can be added here
|
// Code can be added here
|
||||||
@ -976,7 +984,7 @@ UINT8 FfsEngine::parseFile(const QByteArray & file, QModelIndex & index, const U
|
|||||||
EFI_FFS_FILE_HEADER* tempFileHeader = (EFI_FFS_FILE_HEADER*)(tempHeader.data());
|
EFI_FFS_FILE_HEADER* tempFileHeader = (EFI_FFS_FILE_HEADER*)(tempHeader.data());
|
||||||
tempFileHeader->IntegrityCheck.Checksum.Header = 0;
|
tempFileHeader->IntegrityCheck.Checksum.Header = 0;
|
||||||
tempFileHeader->IntegrityCheck.Checksum.File = 0;
|
tempFileHeader->IntegrityCheck.Checksum.File = 0;
|
||||||
UINT8 calculated = calculateChecksum8((UINT8*)tempFileHeader, sizeof(EFI_FFS_FILE_HEADER)-1);
|
UINT8 calculated = calculateChecksum8((UINT8*)tempFileHeader, sizeof(EFI_FFS_FILE_HEADER) - 1);
|
||||||
if (fileHeader->IntegrityCheck.Checksum.Header != calculated)
|
if (fileHeader->IntegrityCheck.Checksum.Header != calculated)
|
||||||
{
|
{
|
||||||
msg(tr("parseFile: %1, stored header checksum %2 differs from calculated %3")
|
msg(tr("parseFile: %1, stored header checksum %2 differs from calculated %3")
|
||||||
@ -1504,12 +1512,12 @@ UINT8 FfsEngine::create(const QModelIndex & index, const UINT8 type, const QByte
|
|||||||
|
|
||||||
// Correct file size
|
// Correct file size
|
||||||
UINT8 tailSize = fileHeader->Attributes & FFS_ATTRIB_TAIL_PRESENT ? sizeof(UINT16) : 0;
|
UINT8 tailSize = fileHeader->Attributes & FFS_ATTRIB_TAIL_PRESENT ? sizeof(UINT16) : 0;
|
||||||
uint32ToUint24(sizeof(EFI_FFS_FILE_HEADER)+body.size() + tailSize, fileHeader->Size);
|
uint32ToUint24(sizeof(EFI_FFS_FILE_HEADER) + body.size() + tailSize, fileHeader->Size);
|
||||||
|
|
||||||
// Recalculate header checksum
|
// Recalculate header checksum
|
||||||
fileHeader->IntegrityCheck.Checksum.Header = 0;
|
fileHeader->IntegrityCheck.Checksum.Header = 0;
|
||||||
fileHeader->IntegrityCheck.Checksum.File = 0;
|
fileHeader->IntegrityCheck.Checksum.File = 0;
|
||||||
fileHeader->IntegrityCheck.Checksum.Header = calculateChecksum8((UINT8*)fileHeader, sizeof(EFI_FFS_FILE_HEADER)-1);
|
fileHeader->IntegrityCheck.Checksum.Header = calculateChecksum8((UINT8*)fileHeader, sizeof(EFI_FFS_FILE_HEADER) - 1);
|
||||||
|
|
||||||
// Recalculate data checksum, if needed
|
// Recalculate data checksum, if needed
|
||||||
if (fileHeader->Attributes & FFS_ATTRIB_CHECKSUM)
|
if (fileHeader->Attributes & FFS_ATTRIB_CHECKSUM)
|
||||||
@ -1760,7 +1768,6 @@ UINT8 FfsEngine::replace(const QModelIndex & index, const QByteArray & object, c
|
|||||||
return ERR_SUCCESS;
|
return ERR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UINT8 FfsEngine::extract(const QModelIndex & index, QByteArray & extracted, const UINT8 mode)
|
UINT8 FfsEngine::extract(const QModelIndex & index, QByteArray & extracted, const UINT8 mode)
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
@ -2085,7 +2092,7 @@ UINT8 FfsEngine::constructPadFile(const QByteArray &guid, const UINT32 size, con
|
|||||||
// Calculate header checksum
|
// Calculate header checksum
|
||||||
header->IntegrityCheck.Checksum.Header = 0;
|
header->IntegrityCheck.Checksum.Header = 0;
|
||||||
header->IntegrityCheck.Checksum.File = 0;
|
header->IntegrityCheck.Checksum.File = 0;
|
||||||
header->IntegrityCheck.Checksum.Header = calculateChecksum8((UINT8*)header, sizeof(EFI_FFS_FILE_HEADER)-1);
|
header->IntegrityCheck.Checksum.Header = calculateChecksum8((UINT8*)header, sizeof(EFI_FFS_FILE_HEADER) - 1);
|
||||||
|
|
||||||
// Set data checksum
|
// Set data checksum
|
||||||
if (revision == 1)
|
if (revision == 1)
|
||||||
@ -2136,7 +2143,7 @@ UINT8 FfsEngine::reconstructIntelImage(const QModelIndex& index, QByteArray& rec
|
|||||||
|
|
||||||
UINT32 offset = descriptor.size();
|
UINT32 offset = descriptor.size();
|
||||||
// Reconstruct other regions
|
// Reconstruct other regions
|
||||||
char empty = '\xFF'; //!TODO: determine empty char using one of reserved descriptor fields
|
char empty = '\xFF';
|
||||||
for (int i = 1; i < model->rowCount(index); i++) {
|
for (int i = 1; i < model->rowCount(index); i++) {
|
||||||
QByteArray region;
|
QByteArray region;
|
||||||
result = reconstructRegion(index.child(i, 0), region);
|
result = reconstructRegion(index.child(i, 0), region);
|
||||||
@ -2280,7 +2287,6 @@ UINT8 FfsEngine::reconstructVolume(const QModelIndex & index, QByteArray & recon
|
|||||||
}
|
}
|
||||||
else if (model->action(index) == Actions::Rebuild) {
|
else if (model->action(index) == Actions::Rebuild) {
|
||||||
//!TODO: add check for weak aligned volume
|
//!TODO: add check for weak aligned volume
|
||||||
//!TODO: better return codes
|
|
||||||
QByteArray header = model->header(index);
|
QByteArray header = model->header(index);
|
||||||
EFI_FIRMWARE_VOLUME_HEADER* volumeHeader = (EFI_FIRMWARE_VOLUME_HEADER*)header.data();
|
EFI_FIRMWARE_VOLUME_HEADER* volumeHeader = (EFI_FIRMWARE_VOLUME_HEADER*)header.data();
|
||||||
|
|
||||||
@ -2311,7 +2317,7 @@ UINT8 FfsEngine::reconstructVolume(const QModelIndex & index, QByteArray & recon
|
|||||||
// VTF found
|
// VTF found
|
||||||
if (file.left(sizeof(EFI_GUID)) == EFI_FFS_VOLUME_TOP_FILE_GUID) {
|
if (file.left(sizeof(EFI_GUID)) == EFI_FFS_VOLUME_TOP_FILE_GUID) {
|
||||||
baseFound = true;
|
baseFound = true;
|
||||||
volumeBase = (UINT32) (0x100000000 - volumeSize);
|
volumeBase = (UINT32)(0x100000000 - volumeSize);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2631,7 +2637,7 @@ UINT8 FfsEngine::reconstructFile(const QModelIndex& index, const UINT8 revision,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calculate section base
|
// Calculate section base
|
||||||
UINT32 sectionBase = base ? base + sizeof(EFI_FFS_FILE_HEADER)+offset : 0;
|
UINT32 sectionBase = base ? base + sizeof(EFI_FFS_FILE_HEADER) + offset : 0;
|
||||||
|
|
||||||
// Reconstruct section
|
// Reconstruct section
|
||||||
QByteArray section;
|
QByteArray section;
|
||||||
@ -2654,13 +2660,12 @@ UINT8 FfsEngine::reconstructFile(const QModelIndex& index, const UINT8 revision,
|
|||||||
// Correct file size
|
// Correct file size
|
||||||
UINT8 tailSize = (fileHeader->Attributes & FFS_ATTRIB_TAIL_PRESENT) ? sizeof(UINT16) : 0;
|
UINT8 tailSize = (fileHeader->Attributes & FFS_ATTRIB_TAIL_PRESENT) ? sizeof(UINT16) : 0;
|
||||||
|
|
||||||
uint32ToUint24(sizeof(EFI_FFS_FILE_HEADER)+reconstructed.size() + tailSize, fileHeader->Size);
|
uint32ToUint24(sizeof(EFI_FFS_FILE_HEADER) + reconstructed.size() + tailSize, fileHeader->Size);
|
||||||
|
|
||||||
// Recalculate header checksum
|
// Recalculate header checksum
|
||||||
fileHeader->IntegrityCheck.Checksum.Header = 0;
|
fileHeader->IntegrityCheck.Checksum.Header = 0;
|
||||||
fileHeader->IntegrityCheck.Checksum.File = 0;
|
fileHeader->IntegrityCheck.Checksum.File = 0;
|
||||||
fileHeader->IntegrityCheck.Checksum.Header = calculateChecksum8((UINT8*)fileHeader, sizeof(EFI_FFS_FILE_HEADER)-1);
|
fileHeader->IntegrityCheck.Checksum.Header = calculateChecksum8((UINT8*)fileHeader, sizeof(EFI_FFS_FILE_HEADER) - 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
// Use current file body
|
// Use current file body
|
||||||
else
|
else
|
||||||
@ -2818,7 +2823,6 @@ UINT8 FfsEngine::reconstructSection(const QModelIndex& index, const UINT32 base,
|
|||||||
(model->subtype(index.parent()) == EFI_FV_FILETYPE_PEI_CORE ||
|
(model->subtype(index.parent()) == EFI_FV_FILETYPE_PEI_CORE ||
|
||||||
model->subtype(index.parent()) == EFI_FV_FILETYPE_PEIM ||
|
model->subtype(index.parent()) == EFI_FV_FILETYPE_PEIM ||
|
||||||
model->subtype(index.parent()) == EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER)) {
|
model->subtype(index.parent()) == EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER)) {
|
||||||
|
|
||||||
if (base) {
|
if (base) {
|
||||||
result = rebase(reconstructed, base + header.size());
|
result = rebase(reconstructed, base + header.size());
|
||||||
if (result) {
|
if (result) {
|
||||||
@ -2929,7 +2933,6 @@ UINT8 FfsEngine::growVolume(QByteArray & header, const UINT32 size, UINT32 & new
|
|||||||
return ERR_INVALID_VOLUME;
|
return ERR_INVALID_VOLUME;
|
||||||
|
|
||||||
// Case of complex blockMap
|
// Case of complex blockMap
|
||||||
//!TODO: implement this case
|
|
||||||
if (blockMapCount > 2)
|
if (blockMapCount > 2)
|
||||||
return ERR_COMPLEX_BLOCK_MAP;
|
return ERR_COMPLEX_BLOCK_MAP;
|
||||||
|
|
||||||
@ -3002,7 +3005,7 @@ UINT8 FfsEngine::findHexPattern(const QModelIndex & index, const QByteArray & he
|
|||||||
.arg(hexBody.mid(offset, hexPattern.length()))
|
.arg(hexBody.mid(offset, hexPattern.length()))
|
||||||
.arg(model->nameString(index))
|
.arg(model->nameString(index))
|
||||||
.arg(mode == SEARCH_MODE_BODY ? tr("body") : tr("header"))
|
.arg(mode == SEARCH_MODE_BODY ? tr("body") : tr("header"))
|
||||||
.arg(offset/2, 8, 16, QChar('0')),
|
.arg(offset / 2, 8, 16, QChar('0')),
|
||||||
index);
|
index);
|
||||||
}
|
}
|
||||||
offset = regexp.indexIn(hexBody, offset + 1);
|
offset = regexp.indexIn(hexBody, offset + 1);
|
||||||
@ -3574,7 +3577,7 @@ UINT8 FfsEngine::patchViaPattern(QByteArray & data, const QByteArray & hexFindPa
|
|||||||
INT32 offset = regexp.indexIn(hexBody);
|
INT32 offset = regexp.indexIn(hexBody);
|
||||||
while (offset >= 0) {
|
while (offset >= 0) {
|
||||||
if (offset % 2 == 0) {
|
if (offset % 2 == 0) {
|
||||||
UINT8 result = patchViaOffset(body, offset/2, hexReplacePattern);
|
UINT8 result = patchViaOffset(body, offset / 2, hexReplacePattern);
|
||||||
if (result)
|
if (result)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
4
gbe.h
4
gbe.h
@ -26,8 +26,8 @@ typedef struct {
|
|||||||
#define GBE_VERSION_OFFSET 10
|
#define GBE_VERSION_OFFSET 10
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT8 id: 4;
|
UINT8 id : 4;
|
||||||
UINT8 minor: 4;
|
UINT8 minor : 4;
|
||||||
UINT8 major;
|
UINT8 major;
|
||||||
} GBE_VERSION;
|
} GBE_VERSION;
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "messagelistitem.h"
|
#include "messagelistitem.h"
|
||||||
|
|
||||||
@ -33,7 +33,6 @@ MessageListItem::MessageListItem(const QIcon & icon, const QString & text, QList
|
|||||||
|
|
||||||
MessageListItem::~MessageListItem()
|
MessageListItem::~MessageListItem()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QModelIndex MessageListItem::index() const
|
QModelIndex MessageListItem::index() const
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __MESSAGELISTITEM_H__
|
#ifndef __MESSAGELISTITEM_H__
|
||||||
#define __MESSAGELISTITEM_H__
|
#define __MESSAGELISTITEM_H__
|
||||||
|
12
peimage.h
12
peimage.h
@ -27,7 +27,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#define EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
|
#define EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
|
||||||
#define EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER 13
|
#define EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER 13
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// PE32+ Machine type for EFI images
|
// PE32+ Machine type for EFI images
|
||||||
//
|
//
|
||||||
@ -517,7 +516,6 @@ typedef struct {
|
|||||||
//
|
//
|
||||||
#define EFI_IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
|
#define EFI_IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// DLL Support
|
// DLL Support
|
||||||
//
|
//
|
||||||
@ -573,7 +571,6 @@ typedef struct {
|
|||||||
EFI_IMAGE_THUNK_DATA *FirstThunk;
|
EFI_IMAGE_THUNK_DATA *FirstThunk;
|
||||||
} EFI_IMAGE_IMPORT_DESCRIPTOR;
|
} EFI_IMAGE_IMPORT_DESCRIPTOR;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Debug Directory Format
|
// Debug Directory Format
|
||||||
//
|
//
|
||||||
@ -620,7 +617,6 @@ typedef struct {
|
|||||||
//
|
//
|
||||||
} EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY;
|
} EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Debug Data Structure defined by Apple Mach-O to COFF utility.
|
// Debug Data Structure defined by Apple Mach-O to COFF utility.
|
||||||
//
|
//
|
||||||
@ -654,16 +650,16 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
UINT32 NameOffset:31;
|
UINT32 NameOffset : 31;
|
||||||
UINT32 NameIsString:1;
|
UINT32 NameIsString : 1;
|
||||||
} s;
|
} s;
|
||||||
UINT32 Id;
|
UINT32 Id;
|
||||||
} u1;
|
} u1;
|
||||||
union {
|
union {
|
||||||
UINT32 OffsetToData;
|
UINT32 OffsetToData;
|
||||||
struct {
|
struct {
|
||||||
UINT32 OffsetToDirectory:31;
|
UINT32 OffsetToDirectory : 31;
|
||||||
UINT32 DataIsDirectory:1;
|
UINT32 DataIsDirectory : 1;
|
||||||
} s;
|
} s;
|
||||||
} u2;
|
} u2;
|
||||||
} EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY;
|
} EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY;
|
||||||
|
@ -9,15 +9,15 @@
|
|||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "searchdialog.h"
|
#include "searchdialog.h"
|
||||||
|
|
||||||
SearchDialog::SearchDialog(QWidget *parent) :
|
SearchDialog::SearchDialog(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::SearchDialog),
|
ui(new Ui::SearchDialog),
|
||||||
hexValidator(QRegExp("([0-9a-fA-F\\.])*")),
|
hexValidator(QRegExp("([0-9a-fA-F\\.])*")),
|
||||||
guidValidator(QRegExp("[0-9a-fA-F\\.]{8}-[0-9a-fA-F\\.]{4}-[0-9a-fA-F\\.]{4}-[0-9a-fA-F\\.]{4}-[0-9a-fA-F\\.]{12}"))
|
guidValidator(QRegExp("[0-9a-fA-F\\.]{8}-[0-9a-fA-F\\.]{4}-[0-9a-fA-F\\.]{4}-[0-9a-fA-F\\.]{4}-[0-9a-fA-F\\.]{12}"))
|
||||||
{
|
{
|
||||||
// Create UI
|
// Create UI
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
@ -40,9 +40,10 @@ void SearchDialog::setEditFocus(int index)
|
|||||||
{
|
{
|
||||||
if (index == 0) // Hex pattern
|
if (index == 0) // Hex pattern
|
||||||
ui->hexEdit->setFocus();
|
ui->hexEdit->setFocus();
|
||||||
else if (index == 1) // GUID
|
else if (index == 1) { // GUID
|
||||||
ui->guidEdit->setFocus();
|
ui->guidEdit->setFocus();
|
||||||
|
ui->guidEdit->setCursorPosition(0);
|
||||||
|
}
|
||||||
else if (index == 2) // Text
|
else if (index == 2) // Text
|
||||||
ui->textEdit->setFocus();
|
ui->textEdit->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SEARCHDIALOG_H
|
#ifndef SEARCHDIALOG_H
|
||||||
#define SEARCHDIALOG_H
|
#define SEARCHDIALOG_H
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>340</width>
|
<width>400</width>
|
||||||
<height>214</height>
|
<height>214</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -15,9 +15,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#include "treeitem.h"
|
#include "treeitem.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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 & tail,
|
const QByteArray & header, const QByteArray & body, const QByteArray & tail,
|
||||||
@ -95,7 +92,7 @@ int TreeItem::columnCount() const
|
|||||||
|
|
||||||
QVariant TreeItem::data(int column) const
|
QVariant TreeItem::data(int column) const
|
||||||
{
|
{
|
||||||
switch(column)
|
switch (column)
|
||||||
{
|
{
|
||||||
case 0: //Name
|
case 0: //Name
|
||||||
return itemName;
|
return itemName;
|
||||||
@ -206,7 +203,7 @@ void TreeItem::setAction(const UINT8 action)
|
|||||||
|
|
||||||
// On insert action, set insert action for children
|
// On insert action, set insert action for children
|
||||||
if (action == Actions::Insert)
|
if (action == Actions::Insert)
|
||||||
for(int i = 0; i < childCount(); i++)
|
for (int i = 0; i < childCount(); i++)
|
||||||
child(i)->setAction(Actions::Insert);
|
child(i)->setAction(Actions::Insert);
|
||||||
|
|
||||||
// Set rebuild action for parent, if it has no action now
|
// Set rebuild action for parent, if it has no action now
|
||||||
|
@ -61,7 +61,7 @@ QVariant TreeModel::headerData(int section, Qt::Orientation orientation,
|
|||||||
int role) const
|
int role) const
|
||||||
{
|
{
|
||||||
if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
|
if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
|
||||||
switch(section)
|
switch (section)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
return tr("Name");
|
return tr("Name");
|
||||||
@ -132,7 +132,7 @@ int TreeModel::rowCount(const QModelIndex &parent) const
|
|||||||
|
|
||||||
UINT8 TreeModel::type(const QModelIndex &index) const
|
UINT8 TreeModel::type(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if (!index.isValid())
|
||||||
return 0;
|
return 0;
|
||||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
||||||
return item->type();
|
return item->type();
|
||||||
@ -140,7 +140,7 @@ UINT8 TreeModel::type(const QModelIndex &index) const
|
|||||||
|
|
||||||
UINT8 TreeModel::subtype(const QModelIndex &index) const
|
UINT8 TreeModel::subtype(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if (!index.isValid())
|
||||||
return 0;
|
return 0;
|
||||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
||||||
return item->subtype();
|
return item->subtype();
|
||||||
@ -148,7 +148,7 @@ UINT8 TreeModel::subtype(const QModelIndex &index) const
|
|||||||
|
|
||||||
QByteArray TreeModel::header(const QModelIndex &index) const
|
QByteArray TreeModel::header(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if (!index.isValid())
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
||||||
return item->header();
|
return item->header();
|
||||||
@ -156,7 +156,7 @@ QByteArray TreeModel::header(const QModelIndex &index) const
|
|||||||
|
|
||||||
bool TreeModel::hasEmptyHeader(const QModelIndex &index) const
|
bool TreeModel::hasEmptyHeader(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if (!index.isValid())
|
||||||
return true;
|
return true;
|
||||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
||||||
return item->hasEmptyHeader();
|
return item->hasEmptyHeader();
|
||||||
@ -164,7 +164,7 @@ bool TreeModel::hasEmptyHeader(const QModelIndex &index) const
|
|||||||
|
|
||||||
QByteArray TreeModel::body(const QModelIndex &index) const
|
QByteArray TreeModel::body(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if (!index.isValid())
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
||||||
return item->body();
|
return item->body();
|
||||||
@ -172,7 +172,7 @@ QByteArray TreeModel::body(const QModelIndex &index) const
|
|||||||
|
|
||||||
bool TreeModel::hasEmptyBody(const QModelIndex &index) const
|
bool TreeModel::hasEmptyBody(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if (!index.isValid())
|
||||||
return true;
|
return true;
|
||||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
||||||
return item->hasEmptyBody();
|
return item->hasEmptyBody();
|
||||||
@ -180,7 +180,7 @@ bool TreeModel::hasEmptyBody(const QModelIndex &index) const
|
|||||||
|
|
||||||
QByteArray TreeModel::tail(const QModelIndex &index) const
|
QByteArray TreeModel::tail(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if (!index.isValid())
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
||||||
return item->tail();
|
return item->tail();
|
||||||
@ -188,7 +188,7 @@ QByteArray TreeModel::tail(const QModelIndex &index) const
|
|||||||
|
|
||||||
bool TreeModel::hasEmptyTail(const QModelIndex &index) const
|
bool TreeModel::hasEmptyTail(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if (!index.isValid())
|
||||||
return true;
|
return true;
|
||||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
||||||
return item->hasEmptyTail();
|
return item->hasEmptyTail();
|
||||||
@ -196,7 +196,7 @@ bool TreeModel::hasEmptyTail(const QModelIndex &index) const
|
|||||||
|
|
||||||
QString TreeModel::info(const QModelIndex &index) const
|
QString TreeModel::info(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if (!index.isValid())
|
||||||
return QString();
|
return QString();
|
||||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
||||||
return item->info();
|
return item->info();
|
||||||
@ -204,7 +204,7 @@ QString TreeModel::info(const QModelIndex &index) const
|
|||||||
|
|
||||||
UINT8 TreeModel::action(const QModelIndex &index) const
|
UINT8 TreeModel::action(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if (!index.isValid())
|
||||||
return Actions::NoAction;
|
return Actions::NoAction;
|
||||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
||||||
return item->action();
|
return item->action();
|
||||||
@ -212,7 +212,7 @@ UINT8 TreeModel::action(const QModelIndex &index) const
|
|||||||
|
|
||||||
UINT8 TreeModel::compression(const QModelIndex &index) const
|
UINT8 TreeModel::compression(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if (!index.isValid())
|
||||||
return COMPRESSION_ALGORITHM_UNKNOWN;
|
return COMPRESSION_ALGORITHM_UNKNOWN;
|
||||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
||||||
return item->compression();
|
return item->compression();
|
||||||
@ -220,7 +220,7 @@ UINT8 TreeModel::compression(const QModelIndex &index) const
|
|||||||
|
|
||||||
void TreeModel::setSubtype(const QModelIndex & index, UINT8 subtype)
|
void TreeModel::setSubtype(const QModelIndex & index, UINT8 subtype)
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if (!index.isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
||||||
@ -230,7 +230,7 @@ void TreeModel::setSubtype(const QModelIndex & index, UINT8 subtype)
|
|||||||
|
|
||||||
void TreeModel::setNameString(const QModelIndex &index, const QString &data)
|
void TreeModel::setNameString(const QModelIndex &index, const QString &data)
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if (!index.isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
||||||
@ -240,7 +240,7 @@ void TreeModel::setNameString(const QModelIndex &index, const QString &data)
|
|||||||
|
|
||||||
void TreeModel::setTypeString(const QModelIndex &index, const QString &data)
|
void TreeModel::setTypeString(const QModelIndex &index, const QString &data)
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if (!index.isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
||||||
@ -250,7 +250,7 @@ void TreeModel::setTypeString(const QModelIndex &index, const QString &data)
|
|||||||
|
|
||||||
void TreeModel::setSubtypeString(const QModelIndex &index, const QString &data)
|
void TreeModel::setSubtypeString(const QModelIndex &index, const QString &data)
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if (!index.isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
||||||
@ -260,7 +260,7 @@ void TreeModel::setSubtypeString(const QModelIndex &index, const QString &data)
|
|||||||
|
|
||||||
void TreeModel::setTextString(const QModelIndex &index, const QString &data)
|
void TreeModel::setTextString(const QModelIndex &index, const QString &data)
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if (!index.isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
||||||
@ -270,7 +270,7 @@ void TreeModel::setTextString(const QModelIndex &index, const QString &data)
|
|||||||
|
|
||||||
QString TreeModel::nameString(const QModelIndex &index) const
|
QString TreeModel::nameString(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if (!index.isValid())
|
||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
||||||
@ -279,15 +279,16 @@ QString TreeModel::nameString(const QModelIndex &index) const
|
|||||||
|
|
||||||
QString TreeModel::actionString(const QModelIndex &index) const
|
QString TreeModel::actionString(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if (!index.isValid())
|
||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
||||||
return item->data(1).toString();}
|
return item->data(1).toString();
|
||||||
|
}
|
||||||
|
|
||||||
QString TreeModel::typeString(const QModelIndex &index) const
|
QString TreeModel::typeString(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if (!index.isValid())
|
||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
||||||
@ -296,7 +297,7 @@ QString TreeModel::typeString(const QModelIndex &index) const
|
|||||||
|
|
||||||
QString TreeModel::subtypeString(const QModelIndex &index) const
|
QString TreeModel::subtypeString(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if (!index.isValid())
|
||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
||||||
@ -305,22 +306,21 @@ QString TreeModel::subtypeString(const QModelIndex &index) const
|
|||||||
|
|
||||||
QString TreeModel::textString(const QModelIndex &index) const
|
QString TreeModel::textString(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if (!index.isValid())
|
||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
||||||
return item->data(4).toString();
|
return item->data(4).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TreeModel::setAction(const QModelIndex &index, const UINT8 action)
|
void TreeModel::setAction(const QModelIndex &index, const UINT8 action)
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if (!index.isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
|
||||||
item->setAction(action);
|
item->setAction(action);
|
||||||
emit dataChanged(this->index(0,0), index);
|
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,
|
||||||
@ -376,13 +376,13 @@ QModelIndex TreeModel::addItem(const UINT8 type, const UINT8 subtype, const UINT
|
|||||||
|
|
||||||
QModelIndex TreeModel::findParentOfType(const QModelIndex& index, UINT8 type) const
|
QModelIndex TreeModel::findParentOfType(const QModelIndex& index, UINT8 type) const
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if (!index.isValid())
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
|
|
||||||
TreeItem *item;
|
TreeItem *item;
|
||||||
QModelIndex parent = index;
|
QModelIndex parent = index;
|
||||||
|
|
||||||
for(item = static_cast<TreeItem*>(parent.internalPointer());
|
for (item = static_cast<TreeItem*>(parent.internalPointer());
|
||||||
item != NULL && item != rootItem && item->type() != type;
|
item != NULL && item != rootItem && item->type() != type;
|
||||||
item = static_cast<TreeItem*>(parent.internalPointer()))
|
item = static_cast<TreeItem*>(parent.internalPointer()))
|
||||||
parent = parent.parent();
|
parent = parent.parent();
|
||||||
|
@ -116,7 +116,6 @@ QString compressionTypeToQString(UINT8 algorithm)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString actionTypeToQString(UINT8 action)
|
QString actionTypeToQString(UINT8 action)
|
||||||
{
|
{
|
||||||
switch (action) {
|
switch (action) {
|
||||||
@ -138,4 +137,3 @@ QString actionTypeToQString(UINT8 action)
|
|||||||
return QObject::tr("Unknown");
|
return QObject::tr("Unknown");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
79
uefitool.cpp
79
uefitool.cpp
@ -9,14 +9,14 @@
|
|||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "uefitool.h"
|
#include "uefitool.h"
|
||||||
#include "ui_uefitool.h"
|
#include "ui_uefitool.h"
|
||||||
|
|
||||||
UEFITool::UEFITool(QWidget *parent) :
|
UEFITool::UEFITool(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
ui(new Ui::UEFITool)
|
ui(new Ui::UEFITool)
|
||||||
{
|
{
|
||||||
clipboard = QApplication::clipboard();
|
clipboard = QApplication::clipboard();
|
||||||
|
|
||||||
@ -48,6 +48,9 @@ UEFITool::UEFITool(QWidget *parent) :
|
|||||||
// Enable Drag-and-Drop actions
|
// Enable Drag-and-Drop actions
|
||||||
this->setAcceptDrops(true);
|
this->setAcceptDrops(true);
|
||||||
|
|
||||||
|
// Set current directory
|
||||||
|
currentDir = ".";
|
||||||
|
|
||||||
// Initialize non-persistent data
|
// Initialize non-persistent data
|
||||||
init();
|
init();
|
||||||
|
|
||||||
@ -152,6 +155,7 @@ void UEFITool::search()
|
|||||||
}
|
}
|
||||||
else if (index == 1) { // GUID
|
else if (index == 1) { // GUID
|
||||||
searchDialog->ui->guidEdit->setFocus();
|
searchDialog->ui->guidEdit->setFocus();
|
||||||
|
searchDialog->ui->guidEdit->setCursorPosition(0);
|
||||||
QByteArray pattern = searchDialog->ui->guidEdit->text().toLatin1();
|
QByteArray pattern = searchDialog->ui->guidEdit->text().toLatin1();
|
||||||
if (pattern.isEmpty())
|
if (pattern.isEmpty())
|
||||||
return;
|
return;
|
||||||
@ -217,11 +221,11 @@ void UEFITool::insert(const UINT8 mode)
|
|||||||
QString path;
|
QString path;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Types::Volume:
|
case Types::Volume:
|
||||||
path = QFileDialog::getOpenFileName(this, tr("Select FFS file to insert"),".","FFS files (*.ffs *.bin);;All files (*.*)");
|
path = QFileDialog::getOpenFileName(this, tr("Select FFS file to insert"), currentDir, "FFS files (*.ffs *.bin);;All files (*.*)");
|
||||||
break;
|
break;
|
||||||
case Types::File:
|
case Types::File:
|
||||||
case Types::Section:
|
case Types::Section:
|
||||||
path = QFileDialog::getOpenFileName(this, tr("Select section file to insert"),".","Section files (*.sct *.bin);;All files (*.*)");
|
path = QFileDialog::getOpenFileName(this, tr("Select section file to insert"), currentDir, "Section files (*.sct *.bin);;All files (*.*)");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
@ -290,39 +294,39 @@ void UEFITool::replace(const UINT8 mode)
|
|||||||
QString path;
|
QString path;
|
||||||
if (model->type(index) == Types::Region) {
|
if (model->type(index) == Types::Region) {
|
||||||
if (mode == REPLACE_MODE_AS_IS) {
|
if (mode == REPLACE_MODE_AS_IS) {
|
||||||
path = QFileDialog::getOpenFileName(this, tr("Select region file to replace selected object"), ".", "Region files (*.rgn *.bin);;All files (*.*)");
|
path = QFileDialog::getOpenFileName(this, tr("Select region file to replace selected object"), currentDir, "Region files (*.rgn *.bin);;All files (*.*)");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (model->type(index) == Types::File) {
|
else if (model->type(index) == Types::File) {
|
||||||
if (mode == REPLACE_MODE_AS_IS) {
|
if (mode == REPLACE_MODE_AS_IS) {
|
||||||
path = QFileDialog::getOpenFileName(this, tr("Select FFS file to replace selected object"),".","FFS files (*.ffs *.bin);;All files (*.*)");
|
path = QFileDialog::getOpenFileName(this, tr("Select FFS file to replace selected object"), currentDir, "FFS files (*.ffs *.bin);;All files (*.*)");
|
||||||
}
|
}
|
||||||
else if (mode == REPLACE_MODE_BODY) {
|
else if (mode == REPLACE_MODE_BODY) {
|
||||||
if (model->subtype(index) == EFI_FV_FILETYPE_ALL || model->subtype(index) == EFI_FV_FILETYPE_RAW)
|
if (model->subtype(index) == EFI_FV_FILETYPE_ALL || model->subtype(index) == EFI_FV_FILETYPE_RAW)
|
||||||
path = QFileDialog::getOpenFileName(this, tr("Select raw file to replace body"),".","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_FV_FILETYPE_PAD) // Pad file body can't be replaced
|
else if (model->subtype(index) == EFI_FV_FILETYPE_PAD) // Pad file body can't be replaced
|
||||||
return;
|
return;
|
||||||
else
|
else
|
||||||
path = QFileDialog::getOpenFileName(this, tr("Select FFS file body to replace body"),".","FFS file body files (*.fbd *.bin);;All files (*.*)");
|
path = QFileDialog::getOpenFileName(this, tr("Select FFS file body to replace body"), currentDir, "FFS file body files (*.fbd *.bin);;All files (*.*)");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (model->type(index) == Types::Section) {
|
else if (model->type(index) == Types::Section) {
|
||||||
if (mode == REPLACE_MODE_AS_IS) {
|
if (mode == REPLACE_MODE_AS_IS) {
|
||||||
path = QFileDialog::getOpenFileName(this, tr("Select section file to replace selected object"),".","Section files (*.sec *.bin);;All files (*.*)");
|
path = QFileDialog::getOpenFileName(this, tr("Select section file to replace selected object"), currentDir, "Section files (*.sec *.bin);;All files (*.*)");
|
||||||
}
|
}
|
||||||
else if (mode == REPLACE_MODE_BODY) {
|
else if (mode == REPLACE_MODE_BODY) {
|
||||||
if (model->subtype(index) == EFI_SECTION_COMPRESSION || model->subtype(index) == EFI_SECTION_GUID_DEFINED || model->subtype(index) == EFI_SECTION_DISPOSABLE)
|
if (model->subtype(index) == EFI_SECTION_COMPRESSION || model->subtype(index) == EFI_SECTION_GUID_DEFINED || model->subtype(index) == EFI_SECTION_DISPOSABLE)
|
||||||
path = QFileDialog::getOpenFileName(this, tr("Select FFS file body file to replace body"),".","FFS file body files (*.fbd *.bin);;All files (*.*)");
|
path = QFileDialog::getOpenFileName(this, tr("Select FFS file body file to replace body"), currentDir, "FFS file body files (*.fbd *.bin);;All files (*.*)");
|
||||||
else if (model->subtype(index) == EFI_SECTION_FIRMWARE_VOLUME_IMAGE)
|
else if (model->subtype(index) == EFI_SECTION_FIRMWARE_VOLUME_IMAGE)
|
||||||
path = QFileDialog::getOpenFileName(this, tr("Select volume file to replace body"),".","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"),".","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
|
else
|
||||||
path = QFileDialog::getOpenFileName(this, tr("Select file to replace body"),".","Binary files (*.bin);;All files (*.*)");
|
path = QFileDialog::getOpenFileName(this, tr("Select file to replace body"), currentDir, "Binary files (*.bin);;All files (*.*)");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
@ -381,59 +385,59 @@ void UEFITool::extract(const UINT8 mode)
|
|||||||
if (mode == EXTRACT_MODE_AS_IS) {
|
if (mode == EXTRACT_MODE_AS_IS) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Types::Capsule:
|
case Types::Capsule:
|
||||||
path = QFileDialog::getSaveFileName(this, tr("Save capsule to file"),".","Capsule files (*.cap *.bin);;All files (*.*)");
|
path = QFileDialog::getSaveFileName(this, tr("Save capsule to file"), currentDir, "Capsule files (*.cap *.bin);;All files (*.*)");
|
||||||
break;
|
break;
|
||||||
case Types::Image:
|
case Types::Image:
|
||||||
path = QFileDialog::getSaveFileName(this, tr("Save image to file"),".","Image files (*.rom *.bin);;All files (*.*)");
|
path = QFileDialog::getSaveFileName(this, tr("Save image to file"), currentDir, "Image files (*.rom *.bin);;All files (*.*)");
|
||||||
break;
|
break;
|
||||||
case Types::Region:
|
case Types::Region:
|
||||||
path = QFileDialog::getSaveFileName(this, tr("Save region to file"),".","Region files (*.rgn *.bin);;All files (*.*)");
|
path = QFileDialog::getSaveFileName(this, tr("Save region to file"), currentDir, "Region files (*.rgn *.bin);;All files (*.*)");
|
||||||
break;
|
break;
|
||||||
case Types::Padding:
|
case Types::Padding:
|
||||||
path = QFileDialog::getSaveFileName(this, tr("Save padding to file"),".","Padding files (*.pad *.bin);;All files (*.*)");
|
path = QFileDialog::getSaveFileName(this, tr("Save padding to file"), currentDir, "Padding files (*.pad *.bin);;All files (*.*)");
|
||||||
break;
|
break;
|
||||||
case Types::Volume:
|
case Types::Volume:
|
||||||
path = QFileDialog::getSaveFileName(this, tr("Save volume to file"),".","Volume files (*.vol *.bin);;All files (*.*)");
|
path = QFileDialog::getSaveFileName(this, tr("Save volume to file"), currentDir, "Volume files (*.vol *.bin);;All files (*.*)");
|
||||||
break;
|
break;
|
||||||
case Types::File:
|
case Types::File:
|
||||||
path = QFileDialog::getSaveFileName(this, tr("Save FFS file to file"),".","FFS files (*.ffs *.bin);;All files (*.*)");
|
path = QFileDialog::getSaveFileName(this, tr("Save FFS file to file"), currentDir, "FFS files (*.ffs *.bin);;All files (*.*)");
|
||||||
break;
|
break;
|
||||||
case Types::Section:
|
case Types::Section:
|
||||||
path = QFileDialog::getSaveFileName(this, tr("Save section file to file"),".","Section files (*.sct *.bin);;All files (*.*)");
|
path = QFileDialog::getSaveFileName(this, tr("Save section file to file"), currentDir, "Section files (*.sct *.bin);;All files (*.*)");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
path = QFileDialog::getSaveFileName(this, tr("Save object to file"),".","Binary files (*.bin);;All files (*.*)");
|
path = QFileDialog::getSaveFileName(this, tr("Save object to file"), currentDir, "Binary files (*.bin);;All files (*.*)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mode == EXTRACT_MODE_BODY) {
|
else if (mode == EXTRACT_MODE_BODY) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Types::Capsule:
|
case Types::Capsule:
|
||||||
path = QFileDialog::getSaveFileName(this, tr("Save capsule body to image file"),".","Image files (*.rom *.bin);;All files (*.*)");
|
path = QFileDialog::getSaveFileName(this, tr("Save capsule body to image file"), currentDir, "Image files (*.rom *.bin);;All files (*.*)");
|
||||||
break;
|
break;
|
||||||
case Types::File: {
|
case Types::File: {
|
||||||
if (model->subtype(index) == EFI_FV_FILETYPE_ALL || model->subtype(index) == EFI_FV_FILETYPE_RAW)
|
if (model->subtype(index) == EFI_FV_FILETYPE_ALL || model->subtype(index) == EFI_FV_FILETYPE_RAW)
|
||||||
path = QFileDialog::getSaveFileName(this, tr("Save FFS file body to raw file"),".","Raw files (*.raw *.bin);;All files (*.*)");
|
path = QFileDialog::getSaveFileName(this, tr("Save FFS file body to raw file"), currentDir, "Raw files (*.raw *.bin);;All files (*.*)");
|
||||||
else
|
else
|
||||||
path = QFileDialog::getSaveFileName(this, tr("Save FFS file body to file"),".","FFS file body files (*.fbd *.bin);;All files (*.*)");
|
path = QFileDialog::getSaveFileName(this, tr("Save FFS file body to file"), currentDir, "FFS file body files (*.fbd *.bin);;All files (*.*)");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Types::Section: {
|
case Types::Section: {
|
||||||
if (model->subtype(index) == EFI_SECTION_COMPRESSION || model->subtype(index) == EFI_SECTION_GUID_DEFINED || model->subtype(index) == EFI_SECTION_DISPOSABLE)
|
if (model->subtype(index) == EFI_SECTION_COMPRESSION || model->subtype(index) == EFI_SECTION_GUID_DEFINED || model->subtype(index) == EFI_SECTION_DISPOSABLE)
|
||||||
path = QFileDialog::getSaveFileName(this, tr("Save encapsulation section body to FFS body file"),".","FFS file body files (*.fbd *.bin);;All files (*.*)");
|
path = QFileDialog::getSaveFileName(this, tr("Save encapsulation section body to FFS body file"), currentDir, "FFS file body files (*.fbd *.bin);;All files (*.*)");
|
||||||
else if (model->subtype(index) == EFI_SECTION_FIRMWARE_VOLUME_IMAGE)
|
else if (model->subtype(index) == EFI_SECTION_FIRMWARE_VOLUME_IMAGE)
|
||||||
path = QFileDialog::getSaveFileName(this, tr("Save section body to volume file"),".","Volume files (*.vol *.bin);;All files (*.*)");
|
path = QFileDialog::getSaveFileName(this, tr("Save section body to volume file"), 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::getSaveFileName(this, tr("Save section body to raw file"),".","Raw files (*.raw *.bin);;All files (*.*)");
|
path = QFileDialog::getSaveFileName(this, tr("Save section body to raw file"), currentDir, "Raw files (*.raw *.bin);;All files (*.*)");
|
||||||
else
|
else
|
||||||
path = QFileDialog::getSaveFileName(this, tr("Save section body to file"),".","Binary files (*.bin);;All files (*.*)");
|
path = QFileDialog::getSaveFileName(this, tr("Save section body to file"), currentDir, "Binary files (*.bin);;All files (*.*)");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
path = QFileDialog::getSaveFileName(this, tr("Save object to file"),".","Binary files (*.bin);;All files (*.*)");
|
path = QFileDialog::getSaveFileName(this, tr("Save object to file"), currentDir, "Binary files (*.bin);;All files (*.*)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
path = QFileDialog::getSaveFileName(this, tr("Save object to file"),".","Binary files (*.bin);;All files (*.*)");
|
path = QFileDialog::getSaveFileName(this, tr("Save object to file"), currentDir, "Binary files (*.bin);;All files (*.*)");
|
||||||
|
|
||||||
if (path.trimmed().isEmpty())
|
if (path.trimmed().isEmpty())
|
||||||
return;
|
return;
|
||||||
@ -480,7 +484,7 @@ void UEFITool::exit()
|
|||||||
|
|
||||||
void UEFITool::saveImageFile()
|
void UEFITool::saveImageFile()
|
||||||
{
|
{
|
||||||
QString path = QFileDialog::getSaveFileName(this, tr("Save BIOS image file"),".","BIOS image files (*.rom *.bin *.cap *.bio *.fd *.wph *.efi);;All files (*.*)");
|
QString path = QFileDialog::getSaveFileName(this, tr("Save BIOS image file"), currentDir, "BIOS image files (*.rom *.bin *.cap *.bio *.fd *.wph *.efi);;All files (*.*)");
|
||||||
|
|
||||||
if (path.isEmpty())
|
if (path.isEmpty())
|
||||||
return;
|
return;
|
||||||
@ -510,7 +514,7 @@ void UEFITool::saveImageFile()
|
|||||||
|
|
||||||
void UEFITool::openImageFile()
|
void UEFITool::openImageFile()
|
||||||
{
|
{
|
||||||
QString path = QFileDialog::getOpenFileName(this, tr("Open BIOS image file"),".","BIOS image files (*.rom *.bin *.cap *.bio *.fd *.wph *.efi);;All files (*.*)");
|
QString path = QFileDialog::getOpenFileName(this, tr("Open BIOS image file"), currentDir, "BIOS image files (*.rom *.bin *.cap *.bio *.fd *.wph *.efi);;All files (*.*)");
|
||||||
openImageFile(path);
|
openImageFile(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -547,6 +551,9 @@ void UEFITool::openImageFile(QString path)
|
|||||||
|
|
||||||
// Enable search
|
// Enable search
|
||||||
ui->actionSearch->setEnabled(true);
|
ui->actionSearch->setEnabled(true);
|
||||||
|
|
||||||
|
// Set current directory
|
||||||
|
currentDir = fileInfo.absolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UEFITool::copyMessage()
|
void UEFITool::copyMessage()
|
||||||
@ -610,16 +617,16 @@ void UEFITool::contextMenuEvent(QContextMenuEvent* event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!ui->structureTreeView->underMouse())
|
if (!ui->structureTreeView->underMouse())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QPoint pt = event->pos();
|
QPoint pt = event->pos();
|
||||||
QModelIndex index = ui->structureTreeView->indexAt(ui->structureTreeView->viewport()->mapFrom(this, pt));
|
QModelIndex index = ui->structureTreeView->indexAt(ui->structureTreeView->viewport()->mapFrom(this, pt));
|
||||||
if(!index.isValid())
|
if (!index.isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TreeModel* model = ffsEngine->treeModel();
|
TreeModel* model = ffsEngine->treeModel();
|
||||||
switch(model->type(index))
|
switch (model->type(index))
|
||||||
{
|
{
|
||||||
case Types::Capsule:
|
case Types::Capsule:
|
||||||
ui->menuCapsuleActions->exec(event->globalPos());
|
ui->menuCapsuleActions->exec(event->globalPos());
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __UEFITOOL_H__
|
#ifndef __UEFITOOL_H__
|
||||||
#define __UEFITOOL_H__
|
#define __UEFITOOL_H__
|
||||||
@ -39,7 +39,7 @@
|
|||||||
#include "searchdialog.h"
|
#include "searchdialog.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class UEFITool;
|
class UEFITool;
|
||||||
}
|
}
|
||||||
|
|
||||||
class UEFITool : public QMainWindow
|
class UEFITool : public QMainWindow
|
||||||
@ -52,7 +52,7 @@ public:
|
|||||||
|
|
||||||
void openImageFile(QString path);
|
void openImageFile(QString path);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void init();
|
void init();
|
||||||
void populateUi(const QModelIndex ¤t);
|
void populateUi(const QModelIndex ¤t);
|
||||||
void scrollTreeView(QListWidgetItem* item);
|
void scrollTreeView(QListWidgetItem* item);
|
||||||
@ -93,6 +93,7 @@ private:
|
|||||||
FfsEngine* ffsEngine;
|
FfsEngine* ffsEngine;
|
||||||
SearchDialog* searchDialog;
|
SearchDialog* searchDialog;
|
||||||
QClipboard* clipboard;
|
QClipboard* clipboard;
|
||||||
|
QString currentDir;
|
||||||
QQueue<MessageListItem> messageItems;
|
QQueue<MessageListItem> messageItems;
|
||||||
|
|
||||||
void showMessages();
|
void showMessages();
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>UEFITool 0.18.3</string>
|
<string>UEFITool 0.18.4</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralWidget">
|
<widget class="QWidget" name="centralWidget">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
Loading…
Reference in New Issue
Block a user