UEFITool/common/ffsbuilder.h
Nikolaj Schlej 9045fc6cc0 Merge Qt/non-Qt codebase
- added UEFIDump tool, which is now Windows-only UEFIExtract with some
limitations, made as PoC for non-Qt engine usage
- ensured that Qt classes will be used, if available
- checked build of UT and UE
- porting of UEFIFind to non-Qt engine TBD
2016-07-07 07:57:45 +02:00

61 lines
2.2 KiB
C++

/* fssbuilder.h
Copyright (c) 2016, 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,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*/
#ifndef FFSBUILDER_H
#define FFSBUILDER_H
#include <vector>
#include "ubytearray.h"
#include "ustring.h"
#include "basetypes.h"
#include "treemodel.h"
#include "descriptor.h"
#include "ffs.h"
#include "utility.h"
class FfsBuilder
{
public:
FfsBuilder(const TreeModel * treeModel) : model(treeModel) {}
~FfsBuilder() {}
std::vector<std::pair<UString, UModelIndex> > getMessages() const { return messagesVector; }
void clearMessages() { messagesVector.clear(); }
USTATUS build(const UModelIndex & root, UByteArray & image);
private:
const TreeModel* model;
std::vector<std::pair<UString, UModelIndex> > messagesVector;
void msg(const UString & message, const UModelIndex &index = UModelIndex()) {
messagesVector.push_back(std::pair<UString, UModelIndex>(message, index));
}
USTATUS buildCapsule(const UModelIndex & index, UByteArray & capsule);
USTATUS buildIntelImage(const UModelIndex & index, UByteArray & intelImage);
USTATUS buildRawArea(const UModelIndex & index, UByteArray & rawArea, bool addHeader = true);
USTATUS buildPadding(const UModelIndex & index, UByteArray & padding);
USTATUS buildVolume(const UModelIndex & index, UByteArray & volume);
USTATUS buildNonUefiData(const UModelIndex & index, UByteArray & data);
USTATUS buildFreeSpace(const UModelIndex & index, UByteArray & freeSpace);
USTATUS buildPadFile(const UModelIndex & index, UByteArray & padFile);
USTATUS buildFile(const UModelIndex & index, UByteArray & file);
USTATUS buildSection(const UModelIndex & index, UByteArray & section);
// Utility functions
USTATUS erase(const UModelIndex & index, UByteArray & erased);
};
#endif // FFSBUILDER_H