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))
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)
def test_Hex32ToString_NonError_Invalid_Len(self): StatusCode = hex(len(UefiStatusCode.NonErrorCodeStrings)) self.assertEqual( UefiStatusCode().ConvertHexString32ToString(StatusCode), "Undefined StatusCode")
def test_Hex32ToString_ErrorInvalidParameter(self): StatusCode = "0x80000002" self.assertEqual( UefiStatusCode().ConvertHexString32ToString(StatusCode), "Invalid Parameter")
def test_Hex32ToString_NotError(self): StatusCode = "0x00000000" self.assertEqual( UefiStatusCode().ConvertHexString32ToString(StatusCode), "Success")
def test_Hex64ToString_Error_Invalid_Len(self): StatusCode = hex( len(UefiStatusCode.ErrorCodeStrings) + 0x8000000000000000) self.assertEqual( UefiStatusCode().ConvertHexString64ToString(StatusCode), "Undefined StatusCode")
def test_Hex64ToString_ErrorNotFound(self): StatusCode = "0x800000000000000E" self.assertEqual( UefiStatusCode().ConvertHexString64ToString(StatusCode), "Not Found")