private string DecodeFormatError()

in TpmRcDecoder/TpmRcDecoder.Universal/Decoder.cs [318:348]


        private string DecodeFormatError(UInt32 input)
        {
            UInt32 param = (input >> TPM_RC_FMT_PARAM_SHIFT) & TPM_RC_FMT_PARAM_MASK;

            string output = "Format Error:\n";

            if ((input & TPM_RC_FMT_PARAM) == TPM_RC_FMT_PARAM)
            {
                output += " Parameter: " + String.Format("0x{0:x}", param) + "\n";
            }
            else
            {
                if ((param & TPM_RC_FMT_SESSION) == TPM_RC_FMT_SESSION)
                {
                    output += " Session: " + String.Format("0x{0:x}", param & TPM_RC_FMT_SESSION_MASK) + "\n";
                }
                else
                {
                    output += " Handle: " + String.Format("0x{0:x}", param) + "\n";
                }
            }

            output += " Error: " + Enum.GetName(typeof(TPM_RC_FMT_CODES), input & TPM_RC_FMT_ERROR_MASK);
            string description;
            if (TPM_RC_FMT_CODE_DESCRIPTION.TryGetValue((TPM_RC_FMT_CODES) (input & TPM_RC_FMT_ERROR_MASK), out description))
            {
                output += "\n  Description: " + description;
            }

            return output;
        }