Example #1
0
    def get_uefistatus_string(self, StatusCode):
        print(type(StatusCode))

        isint = False
        if isinstance(StatusCode, int):
            isint = True

        if isint == True:
            Ret = UefiStatusCode().Convert64BitToString(StatusCode)
        else:
            Ret = UefiStatusCode().ConvertHexString64ToString(StatusCode)

        if Ret == '':
            Ret = '%x' % StatusCode
        return Ret
 def Print(self):
     print ("CertProvisioningResultVariable")
     print ("  HeaderSignature:  %s" % self.HeaderSignature)
     print ("  HeaderVersion:    0x%X" % self.HeaderVersion)
     print ("  Identity:         0x%X (%s)" % (self.Identity, CertProvisioningApplyVariable.IDENTITY_MAP[self.Identity]))
     print ("  SessionId:        0x%X" % self.SessionId)
     print ("  Status:           %s (0x%X)" % (UefiStatusCode().Convert64BitToString(self.Status), self.Status))
Example #3
0
    def Print(self, ShowRawXmlAsBytes=False):
        print("SecureSettingResultVariable")
        print("  HeaderSignature:  %s" % self.HeaderSignature)
        print("  HeaderVersion:    0x%X" % self.HeaderVersion)
        print("  SessionId:        0x%X" % (self.SessionId))
        print(
            "  Status:           %s (0x%X)" %
            (UefiStatusCode().Convert64BitToString(self.Status), self.Status))
        print("  Payload Size:     0x%X" % self.PayloadSize)
        if (self._XmlTree is not None):
            print("%s" % self._XmlTree.toprettyxml())
        else:
            print("XML TREE DOESN'T EXIST")

        if (ShowRawXmlAsBytes and (self.Payload is not None)):
            print("  Payload Bytes:    ")
            ndbl = memoryview(self.Payload).tolist()
            PrintByteList(ndbl)
Example #4
0
 def test_Hex32ToString_NonError_Invalid_Len(self):
     StatusCode = hex(len(UefiStatusCode.NonErrorCodeStrings))
     self.assertEqual(
         UefiStatusCode().ConvertHexString32ToString(StatusCode),
         "Undefined StatusCode")
Example #5
0
 def test_Hex32ToString_ErrorInvalidParameter(self):
     StatusCode = "0x80000002"
     self.assertEqual(
         UefiStatusCode().ConvertHexString32ToString(StatusCode),
         "Invalid Parameter")
Example #6
0
 def test_Hex32ToString_NotError(self):
     StatusCode = "0x00000000"
     self.assertEqual(
         UefiStatusCode().ConvertHexString32ToString(StatusCode), "Success")
Example #7
0
 def test_Hex64ToString_Error_Invalid_Len(self):
     StatusCode = hex(
         len(UefiStatusCode.ErrorCodeStrings) + 0x8000000000000000)
     self.assertEqual(
         UefiStatusCode().ConvertHexString64ToString(StatusCode),
         "Undefined StatusCode")
Example #8
0
 def test_Hex64ToString_ErrorNotFound(self):
     StatusCode = "0x800000000000000E"
     self.assertEqual(
         UefiStatusCode().ConvertHexString64ToString(StatusCode),
         "Not Found")