Lines Matching refs:pEfiVar
306 PEFIVAR pEfiVar = RTListNodeGetNext(&pThis->NVRAM.VarList, EFIVAR, ListNode);
307 RTListNodeRemove(&pEfiVar->ListNode);
308 RTMemFree(pEfiVar);
340 PEFIVAR pEfiVar;
341 RTListForEach(&pThis->NVRAM.VarList, pEfiVar, EFIVAR, ListNode)
343 Assert(strlen(pEfiVar->szName) == pEfiVar->cchName);
344 if ( pEfiVar->cchName == cchVariableName
345 && memcmp(pEfiVar->szName, pszVariableName, cchVariableName + 1) == 0
346 && RTUuidCompare(&pEfiVar->uuid, pUuid) == 0)
348 *ppEfiVar = pEfiVar;
355 LogFlowFunc(("rc=%Rrc pEfiVar=%p\n", rc, *ppEfiVar));
366 * @param pEfiVar The variable to insert.
368 static void nvramInsertVariable(PDEVEFI pThis, PEFIVAR pEfiVar)
377 int iDiff = RTUuidCompare(&pEfiVar->uuid, &pCurVar->uuid);
379 iDiff = strcmp(pEfiVar->szName, pCurVar->szName);
382 RTListNodeInsertBefore(&pCurVar->ListNode, &pEfiVar->ListNode);
391 RTListAppend(&pThis->NVRAM.VarList, &pEfiVar->ListNode);
406 PEFIVAR pEfiVar = (PEFIVAR)RTMemAllocZ(sizeof(EFIVAR));
407 AssertReturn(pEfiVar, VERR_NO_MEMORY);
409 pEfiVar->cchName = sizeof(pEfiVar->szName);
410 pEfiVar->cbValue = sizeof(pEfiVar->abValue);
412 &pEfiVar->uuid, &pEfiVar->szName[0], &pEfiVar->cchName,
413 &pEfiVar->fAttributes, &pEfiVar->abValue[0], &pEfiVar->cbValue);
417 rc = RTStrValidateEncoding(pEfiVar->szName);
418 size_t cchName = RTStrNLen(pEfiVar->szName, sizeof(pEfiVar->szName));
419 if (cchName != pEfiVar->cchName)
421 if (pEfiVar->cbValue == 0)
425 pEfiVar->cbValue, pEfiVar->cchName, cchName, pEfiVar->cchName + 1, pEfiVar->szName));
429 RTMemFree(pEfiVar);
437 nvramInsertVariable(pThis, pEfiVar);
457 PEFIVAR pEfiVar;
459 RTListForEach(&pThis->NVRAM.VarList, pEfiVar, EFIVAR, ListNode)
460 if (pEfiVar->fAttributes & VBOX_EFI_VARIABLE_NON_VOLATILE)
469 RTListForEach(&pThis->NVRAM.VarList, pEfiVar, EFIVAR, ListNode)
472 if (!(pEfiVar->fAttributes & VBOX_EFI_VARIABLE_NON_VOLATILE))
476 &pEfiVar->uuid, pEfiVar->szName, pEfiVar->cchName,
477 pEfiVar->fAttributes, pEfiVar->abValue, pEfiVar->cbValue);
502 * @param pEfiVar The resulting variable. NULL if not found / end.
505 static void nvramWriteVariableOpQueryCopyResult(PDEVEFI pThis, PEFIVAR pEfiVar, bool fEnumQuery)
508 if (pEfiVar)
511 pThis->NVRAM.VarOpBuf.uuid = pEfiVar->uuid;
512 pThis->NVRAM.VarOpBuf.cchName = pEfiVar->cchName;
513 memcpy(pThis->NVRAM.VarOpBuf.szName, pEfiVar->szName, pEfiVar->cchName); /* no need for + 1. */
514 pThis->NVRAM.VarOpBuf.fAttributes = pEfiVar->fAttributes;
515 pThis->NVRAM.VarOpBuf.cbValue = pEfiVar->cbValue;
516 memcpy(pThis->NVRAM.VarOpBuf.abValue, pEfiVar->abValue, pEfiVar->cbValue);
517 pThis->NVRAM.pCurVar = pEfiVar;
549 PEFIVAR pEfiVar;
553 &pEfiVar);
554 nvramWriteVariableOpQueryCopyResult(pThis, RT_SUCCESS(rc) ? pEfiVar : NULL, false /*fEnumQuery*/);
569 PEFIVAR pEfiVar = pThis->NVRAM.pCurVar;
570 if (pEfiVar)
571 pEfiVar = RTListGetNext(&pThis->NVRAM.VarList, pEfiVar, EFIVAR, ListNode);
573 pEfiVar = RTListGetFirst(&pThis->NVRAM.VarList, EFIVAR, ListNode);
574 nvramWriteVariableOpQueryCopyResult(pThis, pEfiVar, true /* fEnumQuery */);
606 PEFIVAR pEfiVar;
610 &pEfiVar);
613 LogFlowFunc(("Old abValue=%.*Rhxs\n", pEfiVar->cbValue, pEfiVar->abValue));
615 if (pEfiVar->fAttributes & EFI_VARIABLE_XXXXXXX)
628 RTListNodeRemove(&pEfiVar->ListNode);
632 if (pThis->NVRAM.pCurVar == pEfiVar)
634 RTMemFree(pEfiVar);
635 pEfiVar = NULL;
644 pEfiVar->fAttributes = pThis->NVRAM.VarOpBuf.fAttributes;
645 pEfiVar->cbValue = pThis->NVRAM.VarOpBuf.cbValue;
646 memcpy(pEfiVar->abValue, pThis->NVRAM.VarOpBuf.abValue, pEfiVar->cbValue);
663 pEfiVar = (PEFIVAR)RTMemAllocZ(sizeof(EFIVAR));
664 if (pEfiVar)
666 pEfiVar->uuid = pThis->NVRAM.VarOpBuf.uuid;
667 pEfiVar->cchName = pThis->NVRAM.VarOpBuf.cchName;
668 memcpy(pEfiVar->szName, pThis->NVRAM.VarOpBuf.szName, pEfiVar->cchName); /* The buffer is zeroed, so skip '\0'. */
669 pEfiVar->fAttributes = pThis->NVRAM.VarOpBuf.fAttributes;
670 pEfiVar->cbValue = pThis->NVRAM.VarOpBuf.cbValue;
671 memcpy(pEfiVar->abValue, pThis->NVRAM.VarOpBuf.abValue, pEfiVar->cbValue);
673 nvramInsertVariable(pThis, pEfiVar);
941 * @param pEfiVar The variable.
945 static bool efiInfoNvramIsUtf8(PCEFIVAR pEfiVar, bool *pfZeroTerm)
947 if (pEfiVar->cbValue < 2)
949 const char *pachValue = (const char *)&pEfiVar->abValue[0];
950 *pfZeroTerm = pachValue[pEfiVar->cbValue - 1] == 0;
953 size_t cchValue = RTStrNLen((const char *)pEfiVar->abValue, pEfiVar->cbValue);
954 if (cchValue != pEfiVar->cbValue - *pfZeroTerm)
978 * @param pEfiVar The variable.
982 static bool efiInfoNvramIsUtf16(PCEFIVAR pEfiVar, bool *pfZeroTerm)
984 if (pEfiVar->cbValue < 4 || (pEfiVar->cbValue & 1))
987 PCRTUTF16 pwcValue = (PCRTUTF16)&pEfiVar->abValue[0];
988 size_t cwcValue = pEfiVar->cbValue / sizeof(RTUTF16);
1027 PCEFIVAR pEfiVar;
1028 RTListForEach(&pThis->NVRAM.VarList, pEfiVar, EFIVAR, ListNode)
1032 if (efiInfoNvramIsUtf8(pEfiVar, &fZeroTerm))
1036 pEfiVar->fAttributes, &pEfiVar->uuid, pEfiVar->szName, pEfiVar->cbValue,
1037 fZeroTerm ? "" : ",nz", pEfiVar->cbValue, pEfiVar->abValue);
1038 else if (efiInfoNvramIsUtf16(pEfiVar, &fZeroTerm))
1042 pEfiVar->fAttributes, &pEfiVar->uuid, pEfiVar->szName, pEfiVar->cbValue,
1043 fZeroTerm ? "" : ",nz", pEfiVar->cbValue, pEfiVar->abValue);
1048 pEfiVar->fAttributes, &pEfiVar->uuid, pEfiVar->szName, pEfiVar->cbValue,
1049 pEfiVar->cbValue, pEfiVar->abValue);
1559 PEFIVAR pEfiVar;
1560 RTListForEach(&pThis->NVRAM.VarList, pEfiVar, EFIVAR, ListNode)
1562 pEfiVar->idUniqueSavedState = idUniqueSavedState++;
1579 RTListForEach(&pThis->NVRAM.VarList, pEfiVar, EFIVAR, ListNode)
1581 SSMR3PutStructEx(pSSM, pEfiVar, sizeof(EFIVAR), 0, g_aEfiVariableDescFields, NULL);
1625 PEFIVAR pEfiVar = (PEFIVAR)RTMemAllocZ(sizeof(EFIVAR));
1626 AssertReturn(pEfiVar, VERR_NO_MEMORY);
1628 rc = SSMR3GetStructEx(pSSM, pEfiVar, sizeof(EFIVAR), 0, g_aEfiVariableDescFields, NULL);
1631 if ( pEfiVar->cbValue > sizeof(pEfiVar->abValue)
1632 || pEfiVar->cbValue == 0)
1635 LogRel(("EFI: Loaded invalid variable value length %#x\n", pEfiVar->cbValue));
1637 uint32_t cchVarName = (uint32_t)RTStrNLen(pEfiVar->szName, sizeof(pEfiVar->szName));
1638 if (cchVarName >= sizeof(pEfiVar->szName))
1643 if (pEfiVar->cchName > cchVarName) /* No check for 0 here, busted load code in 4.2, so now storing 0 here. */
1646 LogRel(("EFI: Loaded invalid variable name length %#x (cchVarName=%#x)\n", pEfiVar->cchName, cchVarName));
1649 pEfiVar->cchName = cchVarName;
1651 AssertRCReturnStmt(rc, RTMemFree(pEfiVar), rc);
1656 RTListAppend(&pThis->NVRAM.VarList, &pEfiVar->ListNode);
1658 nvramInsertVariable(pThis, pEfiVar);
1660 if (pThis->NVRAM.idUniqueCurVar == pEfiVar->idUniqueSavedState)
1661 pThis->NVRAM.pCurVar = pEfiVar;