mirror of
https://github.com/LongSoft/UEFITool.git
synced 2025-05-20 10:15:21 -04:00
Big structure update
- files split into common and app-specific ones - messages from parser and finder separated - ffsEngine split into multiple classes to reduce complexity - still no image rebuild
This commit is contained in:
parent
1f0a80d035
commit
2e788a8a1a
64 changed files with 477 additions and 2469 deletions
102
common/ffsparser.h
Normal file
102
common/ffsparser.h
Normal file
|
@ -0,0 +1,102 @@
|
|||
/* ffsparser.h
|
||||
|
||||
Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
*/
|
||||
|
||||
#ifndef __FFSPARSER_H__
|
||||
#define __FFSPARSER_H__
|
||||
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QObject>
|
||||
#include <QModelIndex>
|
||||
#include <QByteArray>
|
||||
#include <QVector>
|
||||
|
||||
#include "basetypes.h"
|
||||
#include "treemodel.h"
|
||||
#include "utility.h"
|
||||
#include "peimage.h"
|
||||
#include "parsingdata.h"
|
||||
|
||||
class TreeModel;
|
||||
|
||||
class FfsParser : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// Default constructor and destructor
|
||||
FfsParser(TreeModel* treeModel, QObject *parent = 0);
|
||||
~FfsParser();
|
||||
|
||||
// Returns messages
|
||||
QVector<QPair<QString, QModelIndex> > getMessages() const;
|
||||
// Clears messages
|
||||
void clearMessages();
|
||||
|
||||
// Firmware image parsing
|
||||
STATUS parseImageFile(const QByteArray & imageFile, const QModelIndex & index);
|
||||
STATUS parseRawArea(const QByteArray & data, const QModelIndex & index);
|
||||
STATUS parseVolumeHeader(const QByteArray & volume, const UINT32 parentOffset, const QModelIndex & parent, QModelIndex & index);
|
||||
STATUS parseVolumeBody(const QModelIndex & index);
|
||||
STATUS parseFileHeader(const QByteArray & file, const UINT32 parentOffset, const QModelIndex & parent, QModelIndex & index);
|
||||
STATUS parseFileBody(const QModelIndex & index);
|
||||
STATUS parseSectionHeader(const QByteArray & section, const UINT32 parentOffset, const QModelIndex & parent, QModelIndex & index);
|
||||
STATUS parseSectionBody(const QModelIndex & index);
|
||||
|
||||
/*// Search routines TODO: move to another class
|
||||
// Extract routine TODO: move to another class
|
||||
STATUS extract(const QModelIndex & index, QString & name, QByteArray & extracted, const UINT8 mode);*/
|
||||
|
||||
private:
|
||||
TreeModel *model;
|
||||
QVector<QPair<QString, QModelIndex> > messagesVector;
|
||||
|
||||
STATUS parseIntelImage(const QByteArray & intelImage, const QModelIndex & parent, QModelIndex & root = QModelIndex());
|
||||
STATUS parseGbeRegion(const QByteArray & gbe, const UINT32 parentOffset, const QModelIndex & parent, QModelIndex & index);
|
||||
STATUS parseMeRegion(const QByteArray & me, const UINT32 parentOffset, const QModelIndex & parent, QModelIndex & index);
|
||||
STATUS parseBiosRegion(const QByteArray & bios, const UINT32 parentOffset, const QModelIndex & parent, QModelIndex & index);
|
||||
STATUS parsePdrRegion(const QByteArray & pdr, const UINT32 parentOffset, const QModelIndex & parent, QModelIndex & index);
|
||||
|
||||
STATUS parsePadFileBody(const QModelIndex & index);
|
||||
STATUS parseSections(QByteArray sections, const QModelIndex & index);
|
||||
|
||||
STATUS parseCommonSectionHeader(const QByteArray & section, const UINT32 parentOffset, const QModelIndex & parent, QModelIndex & index);
|
||||
STATUS parseCompressedSectionHeader(const QByteArray & section, const UINT32 parentOffset, const QModelIndex & parent, QModelIndex & index);
|
||||
STATUS parseGuidedSectionHeader(const QByteArray & section, const UINT32 parentOffset, const QModelIndex & parent, QModelIndex & index);
|
||||
STATUS parseFreeformGuidedSectionHeader(const QByteArray & section, const UINT32 parentOffset, const QModelIndex & parent, QModelIndex & index);
|
||||
STATUS parseVersionSectionHeader(const QByteArray & section, const UINT32 parentOffset, const QModelIndex & parent, QModelIndex & index);
|
||||
STATUS parsePostcodeSectionHeader(const QByteArray & section, const UINT32 parentOffset, const QModelIndex & parent, QModelIndex & index);
|
||||
|
||||
STATUS parseCompressedSectionBody(const QModelIndex & index);
|
||||
STATUS parseGuidedSectionBody(const QModelIndex & index);
|
||||
STATUS parseVersionSectionBody(const QModelIndex & index);
|
||||
STATUS parseDepexSectionBody(const QModelIndex & index);
|
||||
STATUS parseUiSectionBody(const QModelIndex & index);
|
||||
STATUS parseRawSectionBody(const QModelIndex & index);
|
||||
|
||||
UINT8 getPaddingType(const QByteArray & padding);
|
||||
STATUS parseAprioriRawSection(const QByteArray & body, QString & parsed);
|
||||
STATUS findNextVolume(const QByteArray & bios, const UINT32 volumeOffset, UINT32 & nextVolumeOffset);
|
||||
STATUS getVolumeSize(const QByteArray & bios, const UINT32 volumeOffset, UINT32 & volumeSize, UINT32 & bmVolumeSize);
|
||||
UINT32 getFileSize(const QByteArray & volume, const UINT32 fileOffset, const UINT8 ffsVersion);
|
||||
UINT32 getSectionSize(const QByteArray & file, const UINT32 sectionOffset, const UINT8 ffsVersion);
|
||||
|
||||
// Internal operations
|
||||
BOOLEAN hasIntersection(const UINT32 begin1, const UINT32 end1, const UINT32 begin2, const UINT32 end2);
|
||||
|
||||
// Message helper
|
||||
void msg(const QString & message, const QModelIndex &index = QModelIndex());
|
||||
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue