MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / GetDataSetting

Function GetDataSetting

rEFIt_UEFI/Platform/Settings.cpp:453–500  ·  view source on GitHub ↗

returns binary setting in a new allocated buffer and data length in dataLen. data can be specified in base64 encoded or in hex encoded

Source from the content-addressed store, hash-verified

451// or in <string></string> hex encoded
452//
453UINT8
454*GetDataSetting (
455 IN const TagDict* Dict,
456 IN CONST CHAR8 *PropName,
457 OUT UINTN *DataLen
458 )
459{
460 const TagStruct* Prop;
461 UINT8 *Data = NULL;
462
463 Prop = Dict->propertyForKey(PropName);
464 if (Prop != NULL) {
465 if (Prop->isData() /*&& Prop->dataLen > 0*/) { //rehabman: allow zero length data
466 // data property
467 Data = (__typeof__(Data))AllocateZeroPool(Prop->getData()->dataLenValue());
468 CopyMem(Data, Prop->getData()->dataValue(), Prop->getData()->dataLenValue());
469
470 if (DataLen != NULL) *DataLen = Prop->getData()->dataLenValue();
471 /*
472 DBG("Data: %p, Len: %d = ", Data, Prop->dataLen);
473 for (i = 0; i < Prop->dataLen; i++) {
474 DBG("%02hhX ", Data[i]);
475 }
476 DBG("\n");
477 */
478 } else if ( Prop->isString() ) {
479 // assume data in hex encoded string property
480 UINT32 Len = (UINT32)Prop->getString()->stringValue().length() >> 1; // number of hex digits
481 Data = (__typeof__(Data))AllocateZeroPool(Len); // 2 chars per byte, one more byte for odd number
482 Len = hex2bin(Prop->getString()->stringValue().c_str(), Data, Len);
483
484 if (DataLen != NULL) *DataLen = Len;
485 /*
486 DBG("Data(str): %p, Len: %d = ", data, len);
487 for (i = 0; i < Len; i++) {
488 DBG("%02hhX ", data[i]);
489 }
490 DBG("\n");
491 */
492 } else {
493 MsgLog("ATTENTION : PropName '%s' is not data or string. Ignored", PropName);
494 if (DataLen != NULL) *DataLen = 0;
495 }
496 }else{
497 if (DataLen != NULL) *DataLen = 0;
498 }
499 return Data;
500}
501
502EFI_STATUS
503LoadUserSettings (

Callers 8

FillinKextPatchesFunction · 0.85
FillinCustomEntryFunction · 0.85
FillingCustomLegacyFunction · 0.85
FillingCustomToolFunction · 0.85
GetEDIDSettingsFunction · 0.85
GetEarlyUserSettingsFunction · 0.85
getACPISettingsFunction · 0.85
GetUserSettingsFunction · 0.85

Calls 12

hex2binFunction · 0.85
propertyForKeyMethod · 0.80
dataLenValueMethod · 0.80
dataValueMethod · 0.80
AllocateZeroPoolFunction · 0.50
CopyMemFunction · 0.50
isDataMethod · 0.45
getDataMethod · 0.45
isStringMethod · 0.45
lengthMethod · 0.45
getStringMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected