CloverBootloader/rEFIt_UEFI/Settings/SelfOem.h

74 lines
2.9 KiB
C
Raw Normal View History

2020-10-03 19:02:31 +02:00
/*
* Self.h
*
* Created on: Sep 28, 2020
* Author: jief
*/
#ifndef PLATFORM_SELFOEM_H_
#define PLATFORM_SELFOEM_H_
#include "../Settings/Self.h"
#include "../Settings/ConfigManager.h"
2020-10-03 19:02:31 +02:00
class SelfOem
{
protected:
XString8 m_ConfName = NullXString8; // Initialisation required by -Weffc++. Couldn't use default ctor.
2020-10-03 19:02:31 +02:00
// bool m_OemDirExists;
EFI_FILE* m_OemDir = NULL;
XStringW m_OemPathRelToSelfDir = NullXStringW;
XStringW m_OemFulPath = NullXStringW;
2020-10-03 19:02:31 +02:00
// const EFI_FILE* m_userConfigDir = NULL;
XStringW m_configDirPathRelToSelfDir = NullXStringW; // could also be empty if config dir is clover dir.
XStringW m_configDirPathRelToSelfDirWithTrailingSlash = NullXStringW; // could also be empty if config dir is clover dir.
EFI_FILE* m_KextsDir = NULL;
XStringW m_KextsPathRelToSelfDir = NullXStringW;
XStringW m_KextsFullPath = NullXStringW;
2020-10-03 19:02:31 +02:00
// EFI_STATUS _openDir(const XStringW& path, bool* b, EFI_FILE** efiDir);
2020-10-03 19:02:31 +02:00
bool _checkOEMPath();
bool _setOemPathRelToSelfDir(bool isFirmwareClover, const XString8& OEMBoard, const XString8& OEMProduct, INT32 frequency, const XObjArray<LanCardClass>& lanCardArray);
2020-10-03 19:02:31 +02:00
EFI_STATUS _initialize();
public:
SelfOem () {};
2020-10-03 19:02:31 +02:00
SelfOem(const SelfOem&) = delete;
SelfOem& operator = (const SelfOem&) = delete;
~SelfOem () {};
EFI_STATUS initialize(const XString8& confName, bool isFirmwareClover, const XString8& OEMBoard, const XString8& OEMProduct, INT32 frequency, const XObjArray<LanCardClass>& lanCardArray);
void unInitialize();
2020-10-03 19:02:31 +02:00
EFI_STATUS reInitialize();
void closeHandle();
bool isInitialized() const { return m_ConfName.notEmpty(); }
2020-10-03 19:02:31 +02:00
const XString8& getConfName() { return m_ConfName; }
bool oemDirExists() { return m_OemPathRelToSelfDir.notEmpty(); }
const EFI_FILE& getOemDir() { assert(m_OemDir != NULL); return *m_OemDir; }
const XStringW& getOemPathRelToSelfDir() { assert(m_OemPathRelToSelfDir.notEmpty()); return m_OemPathRelToSelfDir; }
const XStringW& getOemFullPath() { assert(m_OemFulPath.notEmpty()); return m_OemFulPath; }
const EFI_FILE& getConfigDir() { if ( m_OemDir != NULL ) return *m_OemDir; return self.getCloverDir(); }
const XStringW& getConfigDirPathRelToSelfDir() { return m_configDirPathRelToSelfDirWithTrailingSlash; }
const XStringW& getConfigDirPathRelToSelfDirWithTrailingSlash() { return m_configDirPathRelToSelfDirWithTrailingSlash; }
const XStringW& getConfigDirFullPath() { if ( m_OemDir != NULL ) return getOemFullPath(); return self.getCloverDirFullPath(); }
2020-10-03 19:02:31 +02:00
bool isKextsDirFound() { return m_KextsDir != NULL; }
const EFI_FILE& getKextsDir() { assert(m_KextsDir != NULL); return *m_KextsDir; }
const XStringW& getKextsDirPathRelToSelfDir() { assert(m_KextsPathRelToSelfDir.notEmpty()); return m_KextsPathRelToSelfDir; }
const XStringW& getKextsFullPath() { assert(m_KextsFullPath.notEmpty()); return m_KextsFullPath; }
2020-10-03 19:02:31 +02:00
};
extern SelfOem selfOem;
#endif /* PLATFORM_SELF_H_ */