SmUUID wasn't injected if smbios info were in smbios.plist.

This commit is contained in:
jief666 2020-09-23 16:47:47 +03:00
parent b592a62d6f
commit 29bdb1bdcd
15 changed files with 151 additions and 110 deletions

View File

@ -747,7 +747,7 @@ EFI_STATUS
IN EFI_GUID *VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN VOID *Data
IN JCONST VOID *Data
);

View File

@ -47,7 +47,7 @@ EFI_GUID *APFSPartitionUUIDExtract(
}
if (DevicePathType(DevicePath) == MEDIA_DEVICE_PATH && DevicePathSubType (DevicePath) == MEDIA_VENDOR_DP) {
//Check that vendor-assigned GUID defines APFS Container Partition
if ( GuidLEToXString8((EFI_GUID *)((UINT8 *)DevicePath+0x04)).equalIC(ApfsSignatureUUID) ) {
if ( GuidLEToXString8(*(EFI_GUID *)((UINT8 *)DevicePath+0x04)).equalIC(ApfsSignatureUUID) ) {
return (EFI_GUID *)((UINT8 *)DevicePath+0x14);
}
}
@ -65,7 +65,7 @@ XString8 APFSPartitionUUIDExtractAsXString8(
)
{
EFI_GUID* uuid = APFSPartitionUUIDExtract(DevicePath);
if ( uuid ) return GuidLEToXString8(uuid);
if ( uuid ) return GuidLEToXString8(*uuid);
return ""_XS8;
}

View File

@ -18,7 +18,7 @@ constexpr LString8 ApfsSignatureUUID = "BE74FCF7-0B7C-49F3-9147-01F4042E6842";
* OUT: EFI_GUID
* returns null if it is not APFS part
*/
EFI_GUID *APFSPartitionUUIDExtract(
EFI_GUID* APFSPartitionUUIDExtract(
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
);

View File

@ -97,7 +97,7 @@ typedef struct {
UINT32 EFIAPI
CopyRecord(IN PLATFORM_DATA_RECORD *Rec,
IN CONST CHAR16 *Name,
IN VOID *Val,
IN const VOID *Val,
IN UINT32 ValLen)
{
CopyMem(&Rec->Hdr, &mCpuDataRecordHeader, sizeof(EFI_SUBCLASS_TYPE1_HEADER));
@ -114,7 +114,7 @@ CopyRecord(IN PLATFORM_DATA_RECORD *Rec,
EFI_STATUS EFIAPI
LogDataHub(IN EFI_GUID *TypeGuid,
IN CONST CHAR16 *Name,
IN VOID *Data,
IN const VOID *Data,
IN UINT32 DataSize)
{
UINT32 RecordSize;
@ -214,6 +214,9 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
UINT64 os_version = AsciiOSVersionToUint64(Entry->OSVersion);
CHAR8 *PlatformLang;
EFI_GUID uuid;
gSettings.getUUID(&uuid);
//
// firmware Variables
//
@ -225,8 +228,8 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
SetNvramVariable(L"system-id",
&gEfiAppleNvramGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS,
sizeof(gUuid),
&gUuid);
sizeof(uuid),
&uuid);
Attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS;
@ -241,12 +244,12 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
gSettings.RtMLB);
}
if (gSettings.RtROM != NULL) {
if (gSettings.RtROM.notEmpty()) {
SetNvramVariable(L"ROM",
&gEfiAppleNvramGuid,
Attributes,
gSettings.RtROMLen,
gSettings.RtROM);
gSettings.RtROM.size(),
gSettings.RtROM.vdata());
}
SetNvramVariable(L"FirmwareFeatures",
@ -310,11 +313,11 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
// we should have two UUID: platform and system
// NO! Only Platform is the best solution
if (!gSettings.InjectSystemID) {
if (gSettings.SmUUIDConfig) {
SetNvramVariable(L"platform-uuid", &gEfiAppleBootGuid, Attributes, 16, &gUuid);
if (!gSettings.ShouldInjectSystemID()) {
if (gSettings.SmUUID.notEmpty()) {
SetNvramVariable(L"platform-uuid", &gEfiAppleBootGuid, Attributes, sizeof(uuid), &uuid);
} else {
AddNvramVariable(L"platform-uuid", &gEfiAppleBootGuid, Attributes, 16, &gUuid);
AddNvramVariable(L"platform-uuid", &gEfiAppleBootGuid, Attributes, sizeof(uuid), &uuid);
}
}
@ -507,8 +510,10 @@ SetupDataForOSX(BOOLEAN Hibernate)
LogDataHubXStringW(&gEfiMiscSubClassGuid, L"Model", ProductName);
LogDataHubXStringW(&gEfiMiscSubClassGuid, L"SystemSerialNumber", SerialNumber);
if (gSettings.InjectSystemID) {
LogDataHub(&gEfiMiscSubClassGuid, L"system-id", &gUuid, sizeof(EFI_GUID));
if (gSettings.ShouldInjectSystemID()) {
EFI_GUID uuid;
gSettings.getUUID(&uuid);
LogDataHub(&gEfiMiscSubClassGuid, L"system-id", &uuid, sizeof(uuid));
}
LogDataHub(&gEfiProcessorSubClassGuid, L"clovergui-revision", &Revision, sizeof(UINT32));

View File

@ -394,7 +394,7 @@ GetSleepImageLocation(IN REFIT_VOLUME *Volume, REFIT_VOLUME **SleepImageVolume,
// find sleep image entry from plist
Status = egLoadFile(Volume->RootDir, PrefName, &PrefBuffer, &PrefBufferLen);
if (EFI_ERROR(Status)) {
XStringW PrefName3 = SWPrintf("\\Library\\Preferences\\com.apple.PowerManagement.%ls.plist", GuidBeToStr(&gUuid).wc_str());
XStringW PrefName3 = SWPrintf("\\Library\\Preferences\\com.apple.PowerManagement.%s.plist", gSettings.getUUID().c_str());
Status = egLoadFile(Volume->RootDir, PrefName3.wc_str(), &PrefBuffer, &PrefBufferLen);
if (EFI_ERROR(Status)) {
Status = egLoadFile(Volume->RootDir, PrefName2, &PrefBuffer, &PrefBufferLen);
@ -920,7 +920,7 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry)
if (EFI_ERROR(Status)) {
DBG(" cant convert Str %ls to GUID\n", Ptr);
} else {
XStringW TmpStr = GuidLEToXStringW(&TmpGuid);
XStringW TmpStr = GuidLEToXStringW(TmpGuid);
//DBG("got the guid %ls\n", TmpStr);
memcpy((VOID*)Ptr, TmpStr.wc_str(), TmpStr.sizeInBytes());
}

View File

@ -236,7 +236,7 @@ AddNvramVariable (
IN EFI_GUID *VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN VOID *Data
IN const VOID *Data
)
{
VOID *OldData;
@ -1232,7 +1232,7 @@ FindStartupDiskVolume (
EFI_DEVICE_PATH *MediaPath = Clover_FindDevicePathNodeWithType(DevicePath, MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP);
if (MediaPath) {
EFI_GUID *MediaPathGuid = (EFI_GUID *)&((VENDOR_DEVICE_PATH_WITH_DATA*)MediaPath)->VendorDefinedData;
XStringW MediaPathGuidStr = GuidLEToXStringW(MediaPathGuid);
XStringW MediaPathGuidStr = GuidLEToXStringW(*MediaPathGuid);
// DBG(" checking '%ls'\n", MediaPathGuidStr.wc_str());
if (StrStr(gEfiBootLoaderPath, MediaPathGuidStr.wc_str())) {
DBG(" - found entry %lld. '%ls', Volume '%ls', '%ls'\n", Index, LoaderEntry.Title.s(), Volume->VolName.wc_str(), LoaderPath.wc_str());

View File

@ -45,7 +45,7 @@ AddNvramVariable (
IN EFI_GUID *VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN VOID *Data
IN const VOID *Data
);
EFI_STATUS
AddNvramXString8 (

View File

@ -25,9 +25,12 @@ static void panic_(const char* format, VA_LIST va)
#endif
;
extern void egSetGraphicsModeEnabled(BOOLEAN);
#define FATAL_ERROR_MSG "\nA fatal error happened. System halted.\n"
static void panic_(const char* format, VA_LIST va)
{
egSetGraphicsModeEnabled(false);
if ( format ) {
vprintf(format, va);
#ifdef DEBUG_ON_SERIAL_PORT

View File

@ -135,8 +135,6 @@ CONST CHAR8* gFirmwareBuildDate = "unknown";
CONST CHAR8* gBuildInfo = NULL;
#endif
EFI_GUID gUuid;
EMU_VARIABLE_CONTROL_PROTOCOL *gEmuVariableControl = NULL;
extern BOOLEAN NeedPMfix;
@ -4297,8 +4295,7 @@ ParseSMBIOSSettings(
MsgLog("ATTENTION : property not string in SmUUID\n");
}else{
if (IsValidGuidAsciiString(Prop->getString()->stringValue())) {
StrToGuidLE(Prop->getString()->stringValue(), &gSettings.SmUUID);
gSettings.SmUUIDConfig = TRUE;
gSettings.SmUUID = Prop->getString()->stringValue();
} else {
DBG("Error: invalid SmUUID '%s' - should be in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n", Prop->getString()->stringValue().c_str());
}
@ -5863,29 +5860,23 @@ GetUserSettings(const TagDict* CfgDict)
}
// RtVariables
gSettings.RtROM.setEmpty();
const TagDict* RtVariablesDict = CfgDict->dictPropertyForKey("RtVariables");
if (RtVariablesDict != NULL) {
// ROM: <data>bin data</data> or <string>base 64 encoded bin data</string>
const TagStruct* Prop = RtVariablesDict->propertyForKey("ROM");
if (Prop != NULL) {
if ( Prop->isString() && Prop->getString()->stringValue().equalIC("UseMacAddr0") ) {
gSettings.RtROM = &gLanMac[0][0];
gSettings.RtROMLen = 6;
gSettings.RtROM.ncpy(&gLanMac[0][0], 6);
} else if ( Prop->isString() && Prop->getString()->stringValue().equalIC("UseMacAddr1") ) {
gSettings.RtROM = &gLanMac[1][0];
gSettings.RtROMLen = 6;
gSettings.RtROM.ncpy(&gLanMac[1][0], 6);
} else if ( Prop->isString() || Prop->isData() ) { // GetDataSetting accept both
UINTN ROMLength = 0;
gSettings.RtROM = GetDataSetting(RtVariablesDict, "ROM", &ROMLength);
gSettings.RtROMLen = ROMLength;
VOID* ROM = GetDataSetting(RtVariablesDict, "ROM", &ROMLength);
gSettings.RtROM.ncpy(ROM, ROMLength);
} else {
MsgLog("MALFORMED PLIST : property not string or data in RtVariables/ROM\n");
}
if (gSettings.RtROM == NULL || gSettings.RtROMLen == 0) {
gSettings.RtROM = NULL;
gSettings.RtROMLen = 0;
}
}
// MLB: <string>some value</string>
@ -5972,9 +5963,10 @@ GetUserSettings(const TagDict* CfgDict)
}
}
if (gSettings.RtROM == NULL) {
gSettings.RtROM = (UINT8*)&gSettings.SmUUID.Data4[2];
gSettings.RtROMLen = 6;
if (gSettings.RtROM.isEmpty()) {
EFI_GUID uuid;
StrToGuidLE(gSettings.SmUUID, &uuid);
gSettings.RtROM.ncpy(&uuid.Data4[2], 6);
}
if (gSettings.RtMLB.isEmpty()) {
@ -5984,8 +5976,7 @@ GetUserSettings(const TagDict* CfgDict)
// if CustomUUID and InjectSystemID are not specified
// then use InjectSystemID=TRUE and SMBIOS UUID
// to get Chameleon's default behaviour (to make user's life easier)
CopyMem((VOID*)&gUuid, (VOID*)&gSettings.SmUUID, sizeof(EFI_GUID));
gSettings.InjectSystemID = TRUE;
// CopyMem((VOID*)&gUuid, (VOID*)&gSettings.SmUUID, sizeof(EFI_GUID));
// SystemParameters again - values that can depend on previous params
const TagDict* SystemParametersDict = CfgDict->dictPropertyForKey("SystemParameters");
@ -6002,30 +5993,39 @@ GetUserSettings(const TagDict* CfgDict)
if ( !Prop->isString() ) {
MsgLog("ATTENTION : property not string in SystemParameters/CustomUUID\n");
}else{
BOOLEAN IsValidCustomUUID = FALSE;
if (IsValidGuidAsciiString(Prop->getString()->stringValue())) {
gSettings.CustomUuid = Prop->getString()->stringValue();
DBG("Converted CustomUUID %ls\n", gSettings.CustomUuid.wc_str());
Status = StrToGuidLE(gSettings.CustomUuid, &gUuid);
if (!EFI_ERROR(Status)) {
IsValidCustomUUID = TRUE;
// if CustomUUID specified, then default for InjectSystemID=FALSE
// to stay compatibile with previous Clover behaviour
gSettings.InjectSystemID = FALSE;
DBG("The UUID is valid\n");
}
}
if (!IsValidCustomUUID) {
gSettings.CustomUuid = Prop->getString()->stringValue();
// if CustomUUID specified, then default for InjectSystemID=FALSE
// to stay compatibile with previous Clover behaviour
DBG("The UUID is valid\n");
}else{
DBG("Error: invalid CustomUUID '%s' - should be in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n", Prop->getString()->stringValue().c_str());
gSettings.CustomUuid = {0};
}
}
}
//else gUuid value from SMBIOS
// DBG("Finally use %s\n", strguid(&gUuid));
gSettings.InjectSystemID_ = 2;
Prop = SystemParametersDict->propertyForKey("InjectSystemID");
gSettings.InjectSystemID = gSettings.InjectSystemID ? !IsPropertyNotNullAndFalse(Prop) : IsPropertyNotNullAndTrue(Prop);
if ( Prop ) {
if ( Prop->isBool() ) gSettings.InjectSystemID_ = Prop->getBool()->boolValue();
else if ( Prop->isString() ) {
// TODO a function that takes a string and return if it's true or false
if ( Prop->getString()->stringValue().equalIC("true") ) gSettings.InjectSystemID_ = 1;
else if ( Prop->getString()->stringValue()[0] == 'y' ) gSettings.InjectSystemID_ = 1;
else if ( Prop->getString()->stringValue()[0] == 'Y' ) gSettings.InjectSystemID_ = 1;
else if ( Prop->getString()->stringValue().equalIC("false") ) gSettings.InjectSystemID_ = 0;
else if ( Prop->getString()->stringValue().equalIC("n") ) gSettings.InjectSystemID_ = 0;
else if ( Prop->getString()->stringValue().equalIC("N") ) gSettings.InjectSystemID_ = 0;
else {
DBG("MALFORMED PLIST : SMBIOS/InjectSystemID must be true, yes, false, no, or non existant");
}
}else{
DBG("MALFORMED PLIST : SMBIOS/InjectSystemID must be <true/>, <false/> or non existant");
}
}
Prop = SystemParametersDict->propertyForKey("NvidiaWeb");
gSettings.NvidiaWeb = IsPropertyNotNullAndTrue(Prop);
@ -8230,7 +8230,7 @@ checkOffset(RomVersion);
WriteOldFixLengthString(VersionNr, 64);
WriteOldFixLengthString(SerialNr, 64);
xb.ncat(&SmUUID, sizeof(SmUUID));
xb.cat(SmUUIDConfig);
xb.cat((BOOLEAN)SmUUID.notEmpty());
xb.ncat(&pad0, sizeof(pad0));
//CHAR8 Uuid[64]);
//CHAR8 SKUNumber[64]);
@ -8290,7 +8290,7 @@ checkOffset(BootArgs);
WriteOldFixLengthString(BootArgs, 256);
xb.memsetAtPos(xb.size(), 0, 1);
checkOffset(CustomUuid);
WriteOldFixLengthString(CustomUuid, 40);
WriteOldFixLengthString(XStringW(CustomUuid), 40);
xb.ncat(&pad20, sizeof(pad20));
checkOffset(DefaultVolume);
xb.cat(uintptr_t(0)); //DefaultVolume was CHAR16*
@ -8362,7 +8362,7 @@ checkOffset(FixMCFG);
xb.cat(DeviceRename);
//Injections
xb.cat(StringInjector);
xb.cat(InjectSystemID);
xb.cat(InjectSystemID_);
xb.cat(NoDefaultProperties);
xb.cat(ReuseFFFF);
@ -8480,9 +8480,12 @@ checkOffset(CustomBoot);
// SysVariables
xb.ncat(&pad30, sizeof(pad30));
checkOffset(RtMLB);
xb.cat(uintptr_t(0)); // RtMLB was CHAR8*
xb.cat(RtROM);
xb.cat(RtROMLen);
xb.cat(uintptr_t(0)); // RtROM was UINT8*
checkOffset(RtROMLen);
xb.cat(RtROM.size());
checkOffset(CsrActiveConfig);
xb.cat(CsrActiveConfig);
xb.cat(BooterConfig);
WriteOldFixLengthString(BooterCfgStr, 64);
@ -8638,3 +8641,25 @@ checkOffset(OptionsBits);
// MsgLog("%s\n", s.c_str());
//}
//
EFI_GUID nullUUID = {0};
const XString8& SETTINGS_DATA::getUUID()
{
if ( CustomUuid.notEmpty() ) return CustomUuid;
return SmUUID;
}
const XString8& SETTINGS_DATA::getUUID(EFI_GUID *uuid)
{
if ( CustomUuid.notEmpty() ) {
EFI_STATUS Status = StrToGuidLE(CustomUuid, uuid);
if ( EFI_ERROR(Status) ) panic("CustomUuid(%s) is not valid", CustomUuid.c_str()); // we panic, because it's a bug. Validity is checked when imported from settings
return CustomUuid;
}
EFI_STATUS Status = StrToGuidLE(SmUUID, uuid);
if ( EFI_ERROR(Status) ) panic("CustomUuid(%s) is not valid", CustomUuid.c_str()); // same as before
return SmUUID;
}

View File

@ -252,8 +252,7 @@ public:
XString8 ProductName;
XString8 VersionNr;
XString8 SerialNr;
EFI_GUID SmUUID;
BOOLEAN SmUUIDConfig;
XString8 SmUUID;
CHAR8 pad0[7];
//CHAR8 Uuid;
//CHAR8 SKUNumber;
@ -311,7 +310,7 @@ public:
XString8 Language;
XString8 BootArgs;
INT8 pad19[2];
XStringW CustomUuid;
XString8 CustomUuid;
INT8 pad20[6];
XStringW DefaultVolume;
@ -382,7 +381,7 @@ public:
ACPI_NAME_LIST *DeviceRename;
//Injections
BOOLEAN StringInjector;
BOOLEAN InjectSystemID;
UINT8 InjectSystemID_; // 0=false, 1=true, other value = default.
BOOLEAN NoDefaultProperties;
BOOLEAN ReuseFFFF;
@ -502,8 +501,7 @@ public:
// SysVariables
UINT8 pad30[4];
XString8 RtMLB;
UINT8 *RtROM;
UINTN RtROMLen;
XBuffer<UINT8> RtROM;
UINT32 CsrActiveConfig;
UINT16 BooterConfig;
@ -609,8 +607,8 @@ public:
XObjArray<MMIOWhiteList> mmioWhiteListArray;
SETTINGS_DATA() : VendorName(), RomVersion(), EfiVersion(), ReleaseDate(), ManufactureName(), ProductName(), VersionNr(), SerialNr(), SmUUID({0,0,0,{0}}),
SmUUIDConfig(0), pad0{0}, FamilyName(), OEMProduct(), OEMVendor(), BoardManufactureName(), BoardSerialNumber(), BoardNumber(), LocationInChassis(),
SETTINGS_DATA() : VendorName(), RomVersion(), EfiVersion(), ReleaseDate(), ManufactureName(), ProductName(), VersionNr(), SerialNr(), SmUUID(),
pad0{0}, FamilyName(), OEMProduct(), OEMVendor(), BoardManufactureName(), BoardSerialNumber(), BoardNumber(), LocationInChassis(),
BoardVersion(), OEMBoard(), BoardType(0), pad1(0), Mobile(0), ChassisType(0), ChassisManufacturer(), ChassisAssetTag(), CpuFreqMHz(0),
BusSpeed(0), Turbo(0), EnabledCores(0), UserChange(0), QEMU(0), SmbiosVersion(0), Attribute(0), pad17{0}, MemoryManufacturer(),
MemorySerialNumber(), MemoryPartNumber(), MemorySpeed(), CpuType(0), QPI(0), SetTable132(0), TrustSMBIOS(0), InjectMemoryTables(0), XMPDetection(0),
@ -620,7 +618,7 @@ public:
DropSSDT(0), NoOemTableId(0), NoDynamicExtract(0), AutoMerge(0), GeneratePStates(0), GenerateCStates(0), GenerateAPSN(0), GenerateAPLF(0), GeneratePluginType(0),
PLimitDict(0), UnderVoltStep(0), DoubleFirstState(0), SuspendOverride(0), EnableC2(0), EnableC4(0), EnableC6(0), EnableISS(0), SlpSmiEnable(0),
FixHeaders(0), C3Latency(0), smartUPS(0), PatchNMI(0), EnableC7(0), SavingMode(0), DsdtName(), FixDsdt(0), MinMultiplier(0),
MaxMultiplier(0), PluginType(0), FixMCFG(0), DeviceRenameCount(0), DeviceRename(0), StringInjector(0), InjectSystemID(0), NoDefaultProperties(0), ReuseFFFF(0),
MaxMultiplier(0), PluginType(0), FixMCFG(0), DeviceRenameCount(0), DeviceRename(0), StringInjector(0), InjectSystemID_(0), NoDefaultProperties(0), ReuseFFFF(0),
FakeATI(0), FakeNVidia(0), FakeIntel(0), FakeLAN(0), FakeWIFI(0), FakeSATA(0), FakeXHCI(0), FakeIMEI(0), GraphicsInjector(0),
InjectIntel(0), InjectATI(0), InjectNVidia(0), DeInit(0), LoadVBios(0), PatchVBios(0), PatchVBiosBytes(0), PatchVBiosBytesCount(0), InjectEDID(0),
LpcTune(0), DropOEM_DSM(0), CustomEDID(0), CustomEDIDsize(0), EdidFixHorizontalSyncPulseWidth(0), EdidFixVideoInputSignal(0), FBName(), VideoPorts(0), NvidiaGeneric(0),
@ -629,7 +627,7 @@ public:
HDALayoutId(0), USBInjection(0), USBFixOwnership(0), InjectClockID(0), HighCurrent(0), NameEH00(0), NameXH00(0), LANInjection(0), HDMIInjection(0),
LegacyBoot(), LegacyBiosDefaultEntry(0), HWP(0), TDP(0), HWPValue(0), HVHideStrings(), KernelAndKextPatches(), KextPatchesAllowed(0),
KernelPatchesAllowed(0), AirportBridgeDeviceName(), KbdPrevLang(0), PointerEnabled(0), PointerSpeed(0), DoubleClickTime(0), PointerMirror(0), CustomBoot(0), CustomLogo(0),
RefCLK(0), RtMLB(), RtROM(0), RtROMLen(0), CsrActiveConfig(0), BooterConfig(0), BooterCfgStr(), DisableCloverHotkeys(0), NeverDoRecovery(0),
RefCLK(0), RtMLB(), RtROM(), CsrActiveConfig(0), BooterConfig(0), BooterCfgStr(), DisableCloverHotkeys(0), NeverDoRecovery(0),
ConfigName{0}, /*MainConfigName(0),*/ /*BlackListCount(0),*/ DisabledDriverArray(), RPlt{0}, RBr{0}, EPCI{0}, REV{0}, Rtc8Allowed(0),
ForceHPET(0), ResetHDA(0), PlayAsync(0), DisableFunctions(0), DSDTPatchArray(), DebugDSDT(0), SlpWak(0), UseIntelHDMI(0),
AFGLowPowerState(0), PNLF_UID(0), ACPIDropTables(0), DisableEntryScan(0), DisableToolScan(0), KernelScan(0), LinuxScan(0), CustomEntries(0),
@ -644,6 +642,16 @@ public:
~SETTINGS_DATA() {}
const XString8& getUUID();
const XString8& getUUID(EFI_GUID* efiGuid);
bool ShouldInjectSystemID() {
if ( CustomUuid.notEmpty() ){
if ( InjectSystemID_ == 2 ) return false;
else return InjectSystemID_;
}
if ( SmUUID.notEmpty() && InjectSystemID_ == 2 ) return false;
return InjectSystemID_;
}
};
//#pragma GCC diagnostic ignored "-Wpadded"
@ -803,8 +811,6 @@ extern CONST CHAR8* gBuildInfo;
extern BOOLEAN ResumeFromCoreStorage;
extern BOOLEAN gRemapSmBiosIsRequire; // syscl: pass argument for Dell SMBIOS here
extern EFI_GUID gUuid;
extern EMU_VARIABLE_CONTROL_PROTOCOL *gEmuVariableControl;

View File

@ -143,9 +143,9 @@ F0 00 00 00 | ....
//Slice - I need GuidBEToStr :(
XStringW GuidBeToStr(EFI_GUID *Guid)
XStringW GuidBeToStr(const EFI_GUID& Guid)
{
UINT8 *GuidData = (UINT8 *)Guid;
UINT8 *GuidData = (UINT8 *)&Guid;
XStringW Str = SWPrintf("%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
GuidData[3], GuidData[2], GuidData[1], GuidData[0],
GuidData[5], GuidData[4],
@ -156,21 +156,21 @@ XStringW GuidBeToStr(EFI_GUID *Guid)
}
XStringW GuidLEToXStringW(EFI_GUID *Guid)
XStringW GuidLEToXStringW(const EFI_GUID& Guid)
{
XStringW returnValue;
returnValue.SWPrintf("%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
Guid->Data1, Guid->Data2, Guid->Data3, Guid->Data4[0], Guid->Data4[1],
Guid->Data4[2], Guid->Data4[3], Guid->Data4[4], Guid->Data4[5], Guid->Data4[6], Guid->Data4[7]);
Guid.Data1, Guid.Data2, Guid.Data3, Guid.Data4[0], Guid.Data4[1],
Guid.Data4[2], Guid.Data4[3], Guid.Data4[4], Guid.Data4[5], Guid.Data4[6], Guid.Data4[7]);
return returnValue;
}
XString8 GuidLEToXString8(EFI_GUID *Guid)
XString8 GuidLEToXString8(const EFI_GUID& Guid)
{
XString8 returnValue;
returnValue.S8Printf("%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
Guid->Data1, Guid->Data2, Guid->Data3, Guid->Data4[0], Guid->Data4[1],
Guid->Data4[2], Guid->Data4[3], Guid->Data4[4], Guid->Data4[5], Guid->Data4[6], Guid->Data4[7]);
Guid.Data1, Guid.Data2, Guid.Data3, Guid.Data4[0], Guid.Data4[1],
Guid.Data4[2], Guid.Data4[3], Guid.Data4[4], Guid.Data4[5], Guid.Data4[6], Guid.Data4[7]);
return returnValue;
}

View File

@ -18,22 +18,22 @@ extern "C" EFI_GUID gEfiMiscSubClassGuid;
template <typename T, enable_if( is___String(T) )>
BOOLEAN IsValidGuidAsciiString(const T& Str)
{
UINTN Index;
UINTN Index4IsValidGuidAsciiString; // stupid name to avoid warning : Declaration shadows a variable in the global namespace
if ( Str.length() != 36 ) {
return FALSE;
}
for (Index = 0; Index < 36; Index++) {
if (Index == 8 || Index == 13 || Index == 18 || Index == 23) {
if (Str[Index] != '-') {
for (Index4IsValidGuidAsciiString = 0; Index4IsValidGuidAsciiString < 36; Index4IsValidGuidAsciiString++) {
if (Index4IsValidGuidAsciiString == 8 || Index4IsValidGuidAsciiString == 13 || Index4IsValidGuidAsciiString == 18 || Index4IsValidGuidAsciiString == 23) {
if (Str[Index4IsValidGuidAsciiString] != '-') {
return FALSE;
}
} else {
if (!(
(Str[Index] >= '0' && Str[Index] <= '9')
|| (Str[Index] >= 'a' && Str[Index] <= 'f')
|| (Str[Index] >= 'A' && Str[Index] <= 'F')
(Str[Index4IsValidGuidAsciiString] >= '0' && Str[Index4IsValidGuidAsciiString] <= '9')
|| (Str[Index4IsValidGuidAsciiString] >= 'a' && Str[Index4IsValidGuidAsciiString] <= 'f')
|| (Str[Index4IsValidGuidAsciiString] >= 'A' && Str[Index4IsValidGuidAsciiString] <= 'F')
)
)
{
@ -54,7 +54,7 @@ StrHToBuf (
const T& t
)
{
UINTN Index;
UINTN Index4IsValidGuidAsciiString; // stupid name to avoid warning : Declaration shadows a variable in the global namespace
UINTN StrLength;
UINT8 Digit;
UINT8 Byte;
@ -67,14 +67,14 @@ StrHToBuf (
//
StrLength = BufferLength * sizeof (CHAR16);
for(Index = 0; Index < StrLength; Index++) {
for(Index4IsValidGuidAsciiString = 0; Index4IsValidGuidAsciiString < StrLength; Index4IsValidGuidAsciiString++) {
if ((Str[Index] >= (__typeof__(*Str))'a') && (Str[Index] <= (__typeof__(*Str))'f')) {
Digit = (UINT8) (Str[Index] - (__typeof__(*Str))'a' + 0x0A);
} else if ((Str[Index] >= (__typeof__(*Str))'A') && (Str[Index] <= (__typeof__(*Str))'F')) {
Digit = (UINT8) (Str[Index] - L'A' + 0x0A);
} else if ((Str[Index] >= (__typeof__(*Str))'0') && (Str[Index] <= (__typeof__(*Str))'9')) {
Digit = (UINT8) (Str[Index] - (__typeof__(*Str))'0');
if ((Str[Index4IsValidGuidAsciiString] >= (__typeof__(*Str))'a') && (Str[Index4IsValidGuidAsciiString] <= (__typeof__(*Str))'f')) {
Digit = (UINT8) (Str[Index4IsValidGuidAsciiString] - (__typeof__(*Str))'a' + 0x0A);
} else if ((Str[Index4IsValidGuidAsciiString] >= (__typeof__(*Str))'A') && (Str[Index4IsValidGuidAsciiString] <= (__typeof__(*Str))'F')) {
Digit = (UINT8) (Str[Index4IsValidGuidAsciiString] - L'A' + 0x0A);
} else if ((Str[Index4IsValidGuidAsciiString] >= (__typeof__(*Str))'0') && (Str[Index4IsValidGuidAsciiString] <= (__typeof__(*Str))'9')) {
Digit = (UINT8) (Str[Index4IsValidGuidAsciiString] - (__typeof__(*Str))'0');
} else {
return EFI_INVALID_PARAMETER;
}
@ -83,15 +83,15 @@ StrHToBuf (
// For odd characters, write the upper nibble for each buffer byte,
// and for even characters, the lower nibble.
//
if ((Index & 1) == 0) {
if ((Index4IsValidGuidAsciiString & 1) == 0) {
Byte = (UINT8) (Digit << 4);
} else {
Byte = Buf[Index / 2];
Byte = Buf[Index4IsValidGuidAsciiString / 2];
Byte &= 0xF0;
Byte = (UINT8) (Byte | Digit);
}
Buf[Index / 2] = Byte;
Buf[Index4IsValidGuidAsciiString / 2] = Byte;
}
return EFI_SUCCESS;
@ -173,9 +173,9 @@ StrToGuidLE (
}
XStringW GuidBeToStr(EFI_GUID *Guid);
XString8 GuidLEToXString8(EFI_GUID *Guid);
XStringW GuidLEToXStringW(EFI_GUID *Guid);
XStringW GuidBeToStr(const EFI_GUID& Guid);
XString8 GuidLEToXString8(const EFI_GUID& Guid);
XStringW GuidLEToXStringW(const EFI_GUID& Guid);

View File

@ -1398,10 +1398,9 @@ VOID GetDefaultSettings()
gSettings.BacklightLevelConfig = FALSE;
gSettings.TrustSMBIOS = TRUE;
gSettings.SmUUIDConfig = FALSE;
gSettings.SmUUID.setEmpty();
gSettings.DefaultBackgroundColor = 0x80000000; //the value to delete the variable
gSettings.RtROM = NULL;
gSettings.RtROMLen = 0;
gSettings.RtROM.setEmpty();
gSettings.CsrActiveConfig = 0xFFFF;
gSettings.BooterConfig = 0;
// MemSet(gSettings.BooterCfgStr, 64, 0);

View File

@ -24,6 +24,7 @@
#include "cpu.h"
#include "platformdata.h"
#include "AcpiPatcher.h"
#include "guid.h"
#ifdef __cplusplus
extern "C" {
@ -494,7 +495,7 @@ VOID GetTableType1()
return;
}
CopyMem((VOID*)&gSettings.SmUUID, (VOID*)&SmbiosTable.Type1->Uuid, 16);
gSettings.SmUUID = GuidLEToXString8(SmbiosTable.Type1->Uuid);
s = GetSmbiosString(SmbiosTable, SmbiosTable.Type1->ProductName);
gSettings.OEMProduct.strncpy(s, iStrLen(s, 64)); //strncpy take care of ending zero
@ -525,8 +526,10 @@ VOID PatchTableType1()
newSmbiosTable.Type1->WakeUpType = SystemWakeupTypePowerSwitch;
Once = TRUE;
if((gSettings.SmUUID.Data3 & 0xF000) != 0) {
CopyMem((VOID*)&newSmbiosTable.Type1->Uuid, (VOID*)&gSettings.SmUUID, 16);
EFI_GUID SmUUID;
StrToGuidLE(gSettings.SmUUID, &SmUUID);
if((SmUUID.Data3 & 0xF000) != 0) {
CopyMem((VOID*)&newSmbiosTable.Type1->Uuid, (VOID*)&SmUUID, sizeof(SmUUID));
}
gSettings.ManufactureName.trim();

View File

@ -71,7 +71,7 @@ const XIcon& ScanVolumeDefaultIcon(REFIT_VOLUME *Volume, IN UINT8 OSType, IN EFI
DevicePath = NextDevicePathNode(DevicePath);
}
if (DevicePathType(DevicePath) == MEDIA_DEVICE_PATH && DevicePathSubType (DevicePath) == MEDIA_VENDOR_DP) {
if ( GuidLEToXString8((EFI_GUID *)((UINT8 *)DevicePath+0x04)).equalIC(ApfsSignatureUUID) ) {
if ( GuidLEToXString8(*(EFI_GUID *)((UINT8 *)DevicePath+0x04)).equalIC(ApfsSignatureUUID) ) {
IconNum = BUILTIN_ICON_VOL_INTERNAL_APFS;
}
} else {