VirtualBox

Ignore:
Timestamp:
Feb 8, 2013 3:20:52 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
83690
Message:

Some fixes and instrumentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxVariable/InitVariable.c

    r44604 r44605  
    148148     * Tell DevEFI to look for the specified variable.
    149149     */
    150     ASMOutU32(EFI_VARIABLE_OP, EFI_VM_VARIABLE_OP_GUID);
    151150    VBoxWriteNVRAMGuidParam(VendorGuid);
    152151    VBoxWriteNVRAMNameParam(VariableName);
    153 
    154152    u32Rc = VBoxWriteNVRAMDoOp(EFI_VARIABLE_OP_QUERY);
    155153    if (u32Rc == EFI_VARIABLE_OP_STATUS_OK)
     
    232230    LogFlowFuncEnter();
    233231
     232    if (!VariableNameSize || !VariableName || !VendorGuid)
     233    {
     234        LogFlowFuncLeaveRC(EFI_INVALID_PARAMETER);
     235        return EFI_INVALID_PARAMETER;
     236    }
     237
    234238    /*
    235239     * Tell DevEFI which the current variable is, then ask for the next one.
     
    245249    if (u32Rc == EFI_VARIABLE_OP_STATUS_OK)
    246250        u32Rc = VBoxWriteNVRAMDoOp(EFI_VARIABLE_OP_QUERY_NEXT);
     251    /** @todo We're supposed to skip stuff depending on attributes and
     252     *        runtime/boottime, at least if EmuGetNextVariableName is something
     253     *        to go by... */
    247254
    248255    if (u32Rc == EFI_VARIABLE_OP_STATUS_OK)
     
    254261        ASMOutU32(EFI_VARIABLE_OP, EFI_VM_VARIABLE_OP_NAME_LENGTH_UTF16);
    255262        cwcName = ASMInU32(EFI_VARIABLE_OP);
    256         if (cwcName * 2 < *VariableNameSize) /* ASSUMES byte size is specified */
     263        if ((cwcName + 1) * 2 <= *VariableNameSize) /* ASSUMES byte size is specified */
    257264        {
    258265            UINT32 i;
     
    269276            VariableName[i] = '\0';
    270277
    271             *VariableNameSize = cwcName * 2;
    272278            rc = EFI_SUCCESS;
    273279        }
    274280        else
    275         {
    276281            rc = EFI_BUFFER_TOO_SMALL;
    277             *VariableNameSize = (cwcName + 1) * 2;
    278         }
     282        *VariableNameSize = (cwcName + 1) * 2;
    279283    }
    280284    else
     
    282286
    283287    LogFlowFuncLeaveRC(rc);
     288    // Temporary - start
     289    DebugPrint("GetNextVariableName: rc=%u cbName=%u Name=%s VendorGuid=%g\n", rc, *VariableNameSize, VariableName, VendorGuid);
     290    // Temporary - end
    284291    return rc;
    285292#endif
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette