From 9eba8104811570edf8cacfcb331793ddaa9a1e67 Mon Sep 17 00:00:00 2001 From: imSp4rky Date: Sun, 29 Nov 2026 11:51:19 -0700 Subject: [PATCH] refactor(drm): read PlayReady result codes from pyplayready DrmResult and drop the hand-copied table --- tests/core/test_playready_errors.py | 66 ++ unshackle/core/drm/playready.py | 2 +- unshackle/core/drm/playready_errors.py | 867 +------------------------ 3 files changed, 83 insertions(+), 852 deletions(-) create mode 100644 tests/core/test_playready_errors.py diff --git a/tests/core/test_playready_errors.py b/tests/core/test_playready_errors.py new file mode 100644 index 00000000..360ad497 --- /dev/null +++ b/tests/core/test_playready_errors.py @@ -0,0 +1,66 @@ +from collections import Counter + +import pytest +from pyplayready.misc.drmresults import DrmResult + +from unshackle.core.drm.playready import PlayReady +from unshackle.core.drm.playready_errors import REVOCATION_CODES, describe, is_revocation + + +def test_only_oem_code_repeats_upstream() -> None: + counts = Counter(m.value[0] for m in DrmResult) + assert [code for code, n in counts.items() if n > 1] == [0x8004DFF] + + +def test_revocation_codes() -> None: + assert REVOCATION_CODES == {0x8004C065, 0x8004C053, 0x8004C07D} + + +@pytest.mark.parametrize("code", [0x8004C065, -2147172251, 0x8004C053, 0x8004C07D]) +def test_is_revocation(code: int) -> None: + assert is_revocation(code) + + +@pytest.mark.parametrize("code", [0x8004C006, 0x8004A013, 0x8004C0C4, 0x8004C0C2, -1021]) +def test_is_not_revocation(code: int) -> None: + assert not is_revocation(code) + + +def test_describe_signed_and_unsigned() -> None: + text = "DRM_E_DEVCERT_REVOKED (0x8004C065): The device certificate given to DRM is revoked." + assert describe(0x8004C065) == describe(-2147172251) == text + + +def test_describe_uses_upstream_name() -> None: + assert describe(0x8004C006) == "DRM_E_INVALID_LICENSE (0x8004C006): The license is invalid" + + +@pytest.mark.parametrize( + ("code", "text"), + [ + (0x80041100, "DRM_E_CH_BASECODE (0x80041100)"), + (0x80048000, "DRM_E_LEGACY_BASECODE (0x80048000)"), + (0x8004DFFC, "DRM_E_OEM_CONSTRAINT_1_FAIL (0x8004DFFC): Failed while OEM CONSTRAINT-1 check"), + (0x8004DFFF, "DRM_E_HDCP_NON_SECURE (0x8004DFFF): Attempt to play back through insecure HDMI output path"), + ], +) +def test_describe_local_codes(code: int, text: str) -> None: + assert describe(code) == text + + +@pytest.mark.parametrize("code", [-1021, 0x08004DFF]) +def test_describe_unknown(code: int) -> None: + assert describe(code) is None + + +def test_detect_revocation_from_soap_body() -> None: + body = "0x8004C065" + assert PlayReady.detect_revocation(body) == describe(0x8004C065) + + +def test_detect_revocation_from_signed_code() -> None: + assert PlayReady.detect_revocation("licence error -2147172269") == describe(0x8004C053) + + +def test_detect_revocation_ignores_other_codes() -> None: + assert PlayReady.detect_revocation("0x8004C006") is None diff --git a/unshackle/core/drm/playready.py b/unshackle/core/drm/playready.py index 59fa3f8c..a7641f84 100644 --- a/unshackle/core/drm/playready.py +++ b/unshackle/core/drm/playready.py @@ -440,7 +440,7 @@ class PlayReady(CencDrm): for token in re.findall(r"0x[0-9A-Fa-f]{8}|-?\d{7,}", text): code = int(token, 16) if token.lower().startswith("0x") else int(token) if is_revocation(code): - return describe(code) or f"0x{code & 0xFFFFFFFF:08X}" + return describe(code) return None class Exceptions: diff --git a/unshackle/core/drm/playready_errors.py b/unshackle/core/drm/playready_errors.py index c29ded1e..48dfcfcd 100644 --- a/unshackle/core/drm/playready_errors.py +++ b/unshackle/core/drm/playready_errors.py @@ -1,858 +1,38 @@ -# Generated from PlayReady drmresults.h (DRM_E_/DRM_S_ result codes). +"""PlayReady HRESULT names and texts, read from pyplayready's DrmResult. + +_LOCAL holds the codes that DrmResult lacks or writes one digit short (0x8004DFF for 0x8004DFFC-F). +""" from __future__ import annotations -# {unsigned_hresult: (symbol, description)} -ERRORS: dict[int, tuple[str, str]] = { - 0x00000001: ("DRM_S_FALSE", "Operation was successful, but returned a FALSE test condition."), - 0x00000002: ("DRM_S_MORE_DATA", "Operation was successful, but more data is available."), - 0x0004C300: ("DRM_S_TEST_SKIP_FILE", "Skip processing this file, not an eror."), - 0x0004C301: ("DRM_S_TEST_CONVERTED_FILE", "The file was converted to a PlayReady file during the action."), - 0x80000002: ("DRM_E_OUTOFMEMORY", "Insufficient resources exist to complete the request."), - 0x80004001: ("DRM_E_NOTIMPL", "The requested operation is not implemented."), - 0x80004005: ("DRM_E_FAIL", "The requested operation failed."), - 0x80004006: ("DRM_E_HLOS_TAMPERED", "HLOS tampered."), - 0x80004007: ("DRM_E_OPL_BLOCKED", "OPL blocked."), - 0x80004008: ("DRM_E_LOAD_IMG", "Failed on loading playready image."), - 0x80004009: ("DRM_E_VER_MISMATCH", "Version mismatch between HLOS and TZ."), - 0x8000400A: ("DRM_E_SET_BANDWIDTH", "Failed on setting bandwidth."), - 0x8000400B: ("DRM_E_OUT_OF_BOUND", "Out of bound."), - 0x8000400C: ( - "DRM_E_PLAY_ENABLER_BLOCKED", - "WFD is blocked as play enabler object for HDCP doesn't exist in license", - ), - 0x8000400E: ("DRM_E_HDMI_READ_FAIL", "Failed to read HDMI Status"), - 0x80030002: ("DRM_E_FILENOTFOUND", "A requested file could not be found."), - 0x8003006E: ("DRM_E_FILEOPEN", "A request failed due to a file being open."), - 0x80040E80: ("DRM_E_VERIFICATION_FAILURE", "Validation of a Longhorn certificate failed."), - 0x80040E82: ("DRM_E_RSA_SIGNATURE_ERROR", "Error in RSA(PSS) signature."), - 0x80040E86: ("DRM_E_BAD_RSA_EXPONENT", "An incorrect RSA exponent was supplied for a public key."), - 0x80040E87: ("DRM_E_P256_CONVERSION_FAILURE", "An error occurred while converting between P256 types."), - 0x80040E88: ("DRM_E_P256_PKCRYPTO_FAILURE", "An error occurred in an asymmetric P256 cryptographic operation."), - 0x80040E89: ( - "DRM_E_P256_PLAINTEXT_MAPPING_FAILURE", - "An error occurred while attempting to map a plaintext array to a EC Point: There is no conversion for this byte array to a EC Point.", - ), - 0x80040E8A: ( - "DRM_E_P256_INVALID_SIGNATURE", - "The ECDSA signature to be verified was not a valid signature format.", - ), - 0x80040E8B: ( - "DRM_E_P256_ECDSA_VERIFICATION_ERROR", - "The ECDSA verification algorithm encountered an unknown error.", - ), - 0x80040E8C: ("DRM_E_P256_ECDSA_SIGNING_ERROR", "The ECDSA signature algorithm encountered an unknown error."), - 0x80040E8D: ( - "DRM_E_P256_HMAC_KEYGEN_FAILURE", - "Could not generate a valid HMAC key under constraint where CK || HMACK is a valid x coord on the EC (P256).", - ), +from pyplayready.misc.drmresults import DrmResult + +_LOCAL: dict[int, tuple[str, str]] = { 0x80041100: ("DRM_E_CH_BASECODE", ""), - 0x80041103: ("DRM_E_CH_VERSION_MISSING", "Missing content header version."), - 0x80041104: ("DRM_E_CH_KID_MISSING", "Missing KID attribute in content header."), - 0x80041105: ("DRM_E_CH_LAINFO_MISSING", "Missing LAINFO attribute in content header."), - 0x80041106: ("DRM_E_CH_CHECKSUM_MISSING", "Missing content header checksum."), - 0x80041107: ("DRM_E_CH_ATTR_MISSING", "Missing content header attribute."), - 0x80041108: ("DRM_E_CH_INVALID_HEADER", "Invalid content header."), - 0x80041109: ("DRM_E_CH_INVALID_CHECKSUM", "Invalid checksum in the header."), - 0x8004110A: ("DRM_E_CH_UNABLE_TO_VERIFY", "Unable to verify signature of content header."), - 0x8004110B: ("DRM_E_CH_UNSUPPORTED_VERSION", "Unsupported content header version."), - 0x8004110C: ("DRM_E_CH_UNSUPPORTED_HASH_ALGORITHM", "Unsupported hash algorithm."), - 0x8004110D: ("DRM_E_CH_UNSUPPORTED_SIGN_ALGORITHM", "Unsupported signature algorithm."), - 0x8004110E: ("DRM_E_CH_BAD_KEY", "Invalid key."), - 0x8004110F: ("DRM_E_CH_INCOMPATIBLE_HEADER_TYPE", "Incompatible content header type."), - 0x80041110: ("DRM_E_HEADER_ALREADY_SET", "Content header type is already set. Reinitialize is required."), - 0x80041113: ("DRM_E_CH_NOT_SIGNED", "The header was not signed."), - 0x80041116: ("DRM_E_CH_UNKNOWN_ERROR", "Unknown Error."), 0x80048000: ("DRM_E_LEGACY_BASECODE", ""), - 0x80048007: ("DRM_E_LIC_KEY_DECODE_FAILURE", "Key decode failure."), - 0x80048008: ("DRM_E_LIC_SIGNATURE_FAILURE", "License signature failure."), - 0x80048013: ("DRM_E_LIC_KEY_AND_CERT_MISMATCH", "Key and cert mismatch."), - 0x80048014: ("DRM_E_KEY_MISMATCH", "A public/private keypair is mismatched."), - 0x800480CF: ("DRM_E_INVALID_SIGNATURE", "License signature failure."), - 0x800480D0: ("DRM_E_SYNC_ENTRYNOTFOUND", "An entry was not found in the sync store."), - 0x800480D1: ("DRM_E_STACKTOOSMALL", "The stack supplied to the DRM API was too small."), - 0x800480D2: ( - "DRM_E_CIPHER_NOTINITIALIZED", - "The DRM Cipher routines were not correctly initialized before calling encryption/decryption routines.", - ), - 0x800480D3: ( - "DRM_E_DECRYPT_NOTINITIALIZED", - "The DRM decrypt routines were not correctly initialized before trying to decrypt data.", - ), - 0x800480D4: ( - "DRM_E_SECURESTORE_LOCKNOTOBTAINED", - "Before reading or writing data to securestore in raw mode, first the lock must be obtained using DRM_SST_OpenData.", - ), - 0x800480D5: ("DRM_E_PKCRYPTO_FAILURE", "An error occurred in an asymmetric cryptographic operation."), - 0x800480D6: ("DRM_E_INVALID_DSTSLOTSIZE", "Invalid DST slot size is specified."), - 0x8004A000: ("DRM_E_DEVICE_NOT_REGISTERED", "The DEVICEID does not exist in the device store"), - 0x8004A001: ( - "DRM_E_TOO_MANY_INCLUSION_GUIDS", - "The license contained more than DRM_MAX_INCLUSION_GUIDS entries in its inclusion list", - ), - 0x8004A002: ("DRM_E_REVOCATION_GUID_NOT_RECOGNIZED", "The revocation list type GUID was not recognized"), - 0x8004A003: ("DRM_E_LIC_CHAIN_TOO_DEEP", "The license chained deeper than this implementation can handle"), - 0x8004A004: ( - "DRM_E_DEVICE_SECURITY_LEVEL_TOO_LOW", - "The security level of the remote device is too low to receive the license", - ), - 0x8004A005: ("DRM_E_DST_BLOCK_CACHE_CORRUPT", "The block header cache returned invalid data"), - 0x8004A006: ("DRM_E_CONTRACT_FAILED", "The error code returned by the API is not present in the contract"), - 0x8004A007: ("DRM_E_DST_BLOCK_CACHE_MISS", "The block header cache didn't contain the requested block header"), - 0x8004A013: ("DRM_E_INVALID_METERRESPONSE_SIGNATURE", "Invalid signature in meter response"), - 0x8004A014: ("DRM_E_INVALID_LICENSE_REVOCATION_LIST_SIGNATURE", "Invalid signature in license revocation list."), - 0x8004A015: ("DRM_E_INVALID_METERCERT_SIGNATURE", "Invalid signature in metering certificate"), - 0x8004A016: ("DRM_E_METERSTORE_DATA_NOT_FOUND", "Metering data slot not found due to bad data in response file"), - 0x8004A017: ("DRM_E_NO_LICENSES_TO_SYNC", "No more licenses to sync"), - 0x8004A018: ( - "DRM_E_INVALID_REVOCATION_LIST", - "The revocation list version does not match the current revocation version", - ), - 0x8004A019: ("DRM_E_ENVELOPE_CORRUPT", "The envelope archive or file is corrupt"), - 0x8004A01A: ( - "DRM_E_ENVELOPE_FILE_NOT_COMPATIBLE", - "The envelope file is not compatible with this version of the porting kit", - ), - 0x8004A01B: ( - "DRM_E_EXTENDED_RESTRICTION_NOT_UNDERSTOOD", - "An extensible restriction was not understood by the app, and is mark as being required", - ), - 0x8004A01C: ("DRM_E_INVALID_SLK", "An ILA SLK (symmetric session key) was found, but did not contain valid data"), - 0x8004A01D: ( - "DRM_E_DEVCERT_MODEL_MISMATCH", - "The model string in the certificate does not match the model of the device and so the cert must be re-generated.", - ), - 0x8004C001: ("DRM_E_DEVICENOTINIT", "This device has not been initialized against a DRM init service"), - 0x8004C002: ("DRM_E_DRMNOTINIT", "The app has not call DRM_Init properly"), - 0x8004C003: ("DRM_E_INVALIDRIGHT", "A right in the license in invalid"), - 0x8004C004: ( - "DRM_E_INCOMPATABLELICENSESIZE", - "The size of the license is incompatable. DRM doesn't understand this license", - ), - 0x8004C005: ( - "DRM_E_INVALIDLICENSEFLAGS", - "The flags in the license are invalid. DRM either doesn't understand them or they are conflicting", - ), - 0x8004C006: ("DRM_E_INVALIDLICENSE", "The license is invalid"), - 0x8004C007: ("DRM_E_CONDITIONFAIL", "A condition in the license failed to pass"), - 0x8004C008: ("DRM_E_CONDITIONNOTSUPPORTED", "A condition in the license is not supported by this verison of DRM"), - 0x8004C009: ( - "DRM_E_LICENSEEXPIRED", - "The license has expired either by depleting a play count or via an end time.", - ), - 0x8004C00A: ("DRM_E_LICENSENOTYETVALID", "The license start time had not come to pass yet."), - 0x8004C00B: ("DRM_E_RIGHTSNOTAVAILABLE", "The rights the app has requested are not available in the license"), - 0x8004C00C: ("DRM_E_LICENSEMISMATCH", "The license content id/ sku id doesn't match that requested by the app"), - 0x8004C00D: ("DRM_E_WRONGTOKENTYPE", "The token parameter was of an incompatible type."), - 0x8004C00E: ("DRM_E_NORIGHTSREQUESTED", "The app has not requested any rights before trying to bind"), - 0x8004C00F: ( - "DRM_E_LICENSENOTBOUND", - "A license has not been bound to. Decrypt can not happen without a successful bind call", - ), - 0x8004C010: ("DRM_E_HASHMISMATCH", "A Keyed Hash check failed."), - 0x8004C011: ("DRM_E_INVALIDTIME", "A time structure is invalid."), - 0x8004C012: ("DRM_E_LICENSESTORENOTFOUND", "The external license store was not found."), - 0x8004C013: ("DRM_E_LICENSENOTFOUND", "A license was not found in the license store."), - 0x8004C014: ( - "DRM_E_LICENSEVERSIONNOTSUPPORTED", - "The DRM license version is not supported by the DRM version on the device.", - ), - 0x8004C015: ("DRM_E_INVALIDBINDID", "The bind id is invalid."), - 0x8004C016: ( - "DRM_E_UNSUPPORTEDALGORITHM", - "The encryption algorithm required for this operation is not supported.", - ), - 0x8004C017: ("DRM_E_ALGORITHMNOTSET", "The encryption algorithm required for this operation is not supported."), - 0x8004C018: ( - "DRM_E_LICENSESERVERNEEDSKEY", - "The license server needs a version of the device bind key from the init service.", - ), - 0x8004C019: ( - "DRM_E_INVALIDLICENSESTORE", - "The license store version number is incorrect, or the store is invalid in some other way.", - ), - 0x8004C01A: ("DRM_E_FILEREADERROR", "There was an error reading a file."), - 0x8004C01B: ("DRM_E_FILEWRITEERROR", "There was an error writing a file."), - 0x8004C01C: ( - "DRM_E_CLIENTTIMEINVALID", - "The time/clock on the device is not in sync with the license server within tolerance.", - ), - 0x8004C01D: ("DRM_E_DSTSTOREFULL", "The data store is full."), - 0x8004C01E: ("DRM_E_NOXMLOPENTAG", "XML open tag not found"), - 0x8004C01F: ("DRM_E_NOXMLCLOSETAG", "XML close tag not found"), - 0x8004C020: ("DRM_E_INVALIDXMLTAG", "Invalid XML tag"), - 0x8004C021: ("DRM_E_NOXMLCDATA", "No XML CDATA found"), - 0x8004C022: ("DRM_E_DSTNAMESPACEFULL", "No more room for DST Namespace"), - 0x8004C023: ("DRM_E_DSTNAMESPACENOTFOUND", "No DST Namespace found"), - 0x8004C024: ("DRM_E_DSTSLOTNOTFOUND", "DST Dataslot not found"), - 0x8004C025: ("DRM_E_DSTSLOTEXIST", "DST Dataslot already exists"), - 0x8004C026: ("DRM_E_DSTCORRUPTED", "The data store is corrupted"), - 0x8004C027: ("DRM_E_DSTSEEKERROR", "There was an error attempting to seek in the Data Store"), - 0x8004C028: ("DRM_E_DSTNAMESPACEINUSE", "No DST Namespace in use"), - 0x8004C029: ( - "DRM_E_INVALID_SECURESTORE_PASSWORD", - "The password used to open the secure store key was not able to validate the secure store hash.", - ), - 0x8004C02A: ("DRM_E_SECURESTORE_CORRUPT", "The secure store is corrupt"), - 0x8004C02B: ("DRM_E_SECURESTORE_FULL", "The current secure store key is full. No more data can be added."), - 0x8004C02C: ("DRM_E_NOACTIONINLICENSEREQUEST", "No action(s) added for license request"), - 0x8004C02D: ("DRM_E_DUPLICATEDHEADERATTRIBUTE", "Duplicated attribute in Header"), - 0x8004C02E: ("DRM_E_NOKIDINHEADER", "No KID attribute in Header"), - 0x8004C02F: ("DRM_E_NOLAINFOINHEADER", "No LAINFO attribute in Header"), - 0x8004C030: ("DRM_E_NOCHECKSUMINHEADER", "No Checksum attribute in Header"), - 0x8004C031: ("DRM_E_DSTBLOCKMISMATCH", "DST block mismatch"), - 0x8004C032: ("DRM_E_BACKUP_EXISTS", "Backup file already exist."), - 0x8004C033: ("DRM_E_LICENSE_TOOLONG", "License size is too long"), - 0x8004C034: ("DRM_E_DSTEXISTS", "A DST already exists in the specified location"), - 0x8004C035: ("DRM_E_INVALIDDEVICECERTIFICATE", "The device certificate is invalid."), - 0x8004C036: ("DRM_E_DSTLOCKFAILED", "Locking a segment of the DST failed."), - 0x8004C037: ("DRM_E_FILESEEKERROR", "File Seek Error"), - 0x8004C038: ("DRM_E_DSTNOTLOCKEDEXCLUSIVE", "Existing lock is not exclusive"), - 0x8004C039: ("DRM_E_DSTEXCLUSIVELOCKONLY", "Only exclusive lock is accepted"), - 0x8004C03A: ("DRM_E_DSTRESERVEDKEYDETECTED", "DST reserved key value detected in UniqueKey"), - 0x8004C03B: ("DRM_E_V1_NOT_SUPPORTED", "V1 Lic Acquisition is not supported"), - 0x8004C03C: ("DRM_E_HEADER_NOT_SET", "Content header is not set"), - 0x8004C03D: ("DRM_E_NEEDDEVCERTINDIV", "The device certificate is template. It need Devcert Indiv"), - 0x8004C03E: ("DRM_E_MACHINEIDMISMATCH", "The device has Machine Id different from that in devcert."), - 0x8004C03F: ("DRM_E_CLK_INVALID_RESPONSE", "The secure clock response is invalid."), - 0x8004C040: ("DRM_E_CLK_INVALID_DATE", "The secure clock response is invalid."), - 0x8004C041: ("DRM_E_CLK_UNSUPPORTED_VALUE", "The secure clock response has unsupported value."), - 0x8004C042: ("DRM_E_INVALIDDEVICECERTIFICATETEMPLATE", "The device certificate is invalid."), - 0x8004C043: ("DRM_E_DEVCERTEXCEEDSIZELIMIT", "The device certificate exceeds max size"), - 0x8004C044: ("DRM_E_DEVCERTTEMPLATEEXCEEDSSIZELIMIT", "The device certificate template exceeds max size"), - 0x8004C045: ("DRM_E_DEVCERTREADERROR", "Can't get the device certificate"), - 0x8004C046: ("DRM_E_DEVCERTWRITEERROR", "Can't store the device certificate"), - 0x8004C047: ("DRM_E_PRIVKEYREADERROR", "Can't get device private key"), - 0x8004C048: ("DRM_E_PRIVKEYWRITEERROR", "Can't store device private key"), - 0x8004C049: ("DRM_E_DEVCERTTEMPLATEREADERROR", "Can't get the device certificate template"), - 0x8004C04A: ("DRM_E_CLK_NOT_SUPPORTED", "The secure clock is not supported."), - 0x8004C04B: ("DRM_E_DEVCERTINDIV_NOT_SUPPORTED", "The Devcert Indiv is not supported."), - 0x8004C04C: ("DRM_E_METERING_NOT_SUPPORTED", "The Metering is not supported."), - 0x8004C04D: ("DRM_E_CLK_RESETSTATEREADERROR", "Can not read Secure clock Reset State."), - 0x8004C04E: ("DRM_E_CLK_RESETSTATEWRITEERROR", "Can not write Secure clock Reset State."), - 0x8004C04F: ("DRM_E_XMLNOTFOUND", "a required XML tag was not found"), - 0x8004C050: ("DRM_E_METERING_WRONG_TID", "wrong TID sent on metering response"), - 0x8004C051: ("DRM_E_METERING_INVALID_COMMAND", "wrong command sent on metering response"), - 0x8004C052: ("DRM_E_METERING_STORE_CORRUPT", "The metering store is corrupt"), - 0x8004C053: ("DRM_E_CERTIFICATE_REVOKED", "A certificate given to DRM was revoked."), - 0x8004C054: ("DRM_E_CRYPTO_FAILED", "A cryptographic operation failed."), - 0x8004C055: ("DRM_E_STACK_CORRUPT", "The stack allocator context is corrupt. Likely a buffer overrun problem."), - 0x8004C056: ("DRM_E_UNKNOWN_BINDING_KEY", "A matching binding key could not be found for the license."), - 0x8004C057: ("DRM_E_V1_LICENSE_CHAIN_NOT_SUPPORTED", "License chaining with V1 content is not supported."), - 0x8004C058: ("DRM_E_WRONG_TOKEN_TYPE", "The wrong type of token was used."), - 0x8004C059: ( - "DRM_E_POLICY_METERING_DISABLED", - "Metering code was called but metering is disabled by group or user policy", - ), - 0x8004C05A: ("DRM_E_POLICY_ONLINE_DISABLED", "online communication is disabled by group policy"), - 0x8004C05B: ("DRM_E_CLK_NOT_SET", "License may be there but can not be used as secure clock not set."), - 0x8004C05C: ( - "DRM_E_NO_CLK_SUPPORTED", - "This device does not support any Clock. So time bound licenses can not be played", - ), - 0x8004C05D: ("DRM_E_NO_URL", "Can not find URL info."), - 0x8004C05E: ("DRM_E_UNKNOWN_DEVICE_PROPERTY", "Unknown device property."), - 0x8004C05F: ( - "DRM_E_METERING_MID_MISMATCH", - "The metering ID is not same in Metering Cert and metering response data", - ), - 0x8004C060: ( - "DRM_E_METERING_RESPONSE_DECRYPT_FAILED", - "The encrypted section of metering response can not be decrypted", - ), - 0x8004C063: ("DRM_E_RIV_TOO_SMALL", "RIV on the machine is too small."), - 0x8004C064: ("DRM_E_STACK_ALREADY_INITIALIZED", "DRM_STK_Init called for initialized stack"), - 0x8004C065: ("DRM_E_DEVCERT_REVOKED", "The device certificate given to DRM is revoked."), - 0x8004C066: ("DRM_E_OEM_RSA_DECRYPTION_ERROR", "Error in OEM RSA Decryption."), - 0x8004C067: ("DRM_E_INVALID_DEVSTORE_ATTRIBUTE", "Invalid device attributes in the device store"), - 0x8004C068: ("DRM_E_INVALID_DEVSTORE_ENTRY", "The device store data entry is corrupted"), - 0x8004C069: ("DRM_E_OEM_RSA_ENCRYPTION_ERROR", "Error in OEM RSA Encryption process"), - 0x8004C06A: ("DRM_E_DSTNAMESPACEEXIST", "The DST Namespace already exists."), - 0x8004C06B: ("DRM_E_PERF_SCOPING_ERROR", "Error in performance scope context"), - 0x8004C06C: ("DRM_E_PRECISION_ARITHMETIC_FAIL", "Operation involving multiple precision arithmetic fails"), - 0x8004C06D: ("DRM_E_OEM_RSA_INVALID_PRIVATE_KEY", "Invalid private key."), - 0x8004C06E: ( - "DRM_E_NO_OPL_CALLBACK", - "There is no callback function to process the output restrictions specified in the license", - ), - 0x8004C06F: ("DRM_E_INVALID_PLAYREADY_OBJECT", "Structure of PlayReady object is invalid"), - 0x8004C070: ("DRM_E_DUPLICATE_LICENSE", "There is already a license in the store with the same KID & LID"), - 0x8004C071: ( - "DRM_E_REVOCATION_NOT_SUPPORTED", - "Device does not support revocation, while revocation data was placed into license policy structure.", - ), - 0x8004C072: ("DRM_E_RECORD_NOT_FOUND", "Record with requested type was not found in PlayReady object."), - 0x8004C073: ("DRM_E_BUFFER_BOUNDS_EXCEEDED", "An array is being referenced outside of it's bounds."), - 0x8004C074: ("DRM_E_INVALID_BASE64", "An input string contains invalid Base64 characters."), - 0x8004C075: ("DRM_E_PROTOCOL_VERSION_NOT_SUPPORTED", "The protocol version is not supported."), - 0x8004C076: ( - "DRM_E_INVALID_LICENSE_RESPONSE_SIGNATURE", - "Cannot verify license acquisition's response because signature is invalid.", - ), - 0x8004C077: ( - "DRM_E_INVALID_LICENSE_RESPONSE_RESPONSEID", - "Cannot verify license acquisition's response because response ID is invalid.", - ), - 0x8004C078: ( - "DRM_E_LICENSE_RESPONSE_SIGNATURE_MISSING", - "Cannot verify license acquisition's response because either response ID, license nonce or signature is missing.", - ), - 0x8004C079: ( - "DRM_E_INVALID_DOMAIN_JOIN_RESPONSE_SIGNATURE", - "Cannot verify domain join response because signature is invalid.", - ), - 0x8004C07A: ( - "DRM_E_DOMAIN_JOIN_RESPONSE_SIGNATURE_MISSING", - "Cannot verify domain join response because either signing certificate chain or signature is missing.", - ), - 0x8004C07B: ("DRM_E_ACTIVATION_REQUIRED", "The device must be activated before initialization can succeed."), - 0x8004C07C: ("DRM_E_ACTIVATION_INTERNAL_ERROR", "A server error occurred during device activation."), - 0x8004C07D: ( - "DRM_E_ACTIVATION_GROUP_CERT_REVOKED_ERROR", - "The activation group cert has been revoked and the application must be updated with a new client lib.", - ), - 0x8004C07E: ( - "DRM_E_ACTIVATION_NEW_CLIENT_LIB_REQUIRED_ERROR", - "The client lib used by the application is not supported and must be updated.", - ), - 0x8004C07F: ("DRM_E_ACTIVATION_BAD_REQUEST", "The activation request is invalid"), - 0x8004C080: ("DRM_E_FILEIO_ERROR", "Encountered a system error during file I/O."), - 0x8004C081: ("DRM_E_DISKSPACE_ERROR", "Out of disk space for storing playready files."), - 0x8004C082: ( - "DRM_E_UPLINKLICENSENOTFOUND", - "A license was found in the license store but no license was found for its uplink ID.", - ), - 0x8004C0A0: ("DRM_E_LRB_NOLGPUBKEY", "LRB does not contain a valid LGPUBKEY."), - 0x8004C0A1: ("DRM_E_LRB_INVALIDSIGNATURE", "Signature inside LRB is invalid."), - 0x8004C0A2: ("DRM_E_LRB_LGPUBKEY_MISMATCH", "LRB is signed with a pubkey different from LGPUBKEY"), - 0x8004C0A3: ("DRM_E_LRB_INVALIDLICENSEDATA", "LRB is signed with a pubkey different from LGPUBKEY"), - 0x8004C0C0: ("DRM_E_LICEVAL_LICENSE_NOT_SUPPLIED", "License not supplied in the liceval context"), - 0x8004C0C1: ("DRM_E_LICEVAL_KID_MISMATCH", "Mismatch between KID from header and the one inside license"), - 0x8004C0C2: ("DRM_E_LICEVAL_LICENSE_REVOKED", "License for this content has been revoked"), - 0x8004C0C3: ("DRM_E_LICEVAL_UPDATE_FAILURE", "Failed to update content revocation"), - 0x8004C0C4: ("DRM_E_LICEVAL_REQUIRED_REVOCATION_LIST_NOT_AVAILABLE", "Failed to update content revocation"), - 0x8004C0E0: ("DRM_E_XMR_OBJECT_ALREADY_EXISTS", "XMR builder context already has this object."), - 0x8004C0E1: ("DRM_E_XMR_OBJECT_NOTFOUND", "XMR object was not found."), - 0x8004C0E2: ("DRM_E_XMR_REQUIRED_OBJECT_MISSING", "XMR license doesn't have one or more required objects."), - 0x8004C0E3: ("DRM_E_XMR_INVALID_UNKNOWN_OBJECT", "Invalid unknown object"), - 0x8004C0E4: ("DRM_E_XMR_LICENSE_BINDABLE", "XMR license does not contain the Cannot Bind right"), - 0x8004C0E5: ("DRM_E_XMR_LICENSE_NOT_BINDABLE", "XMR license cannot be bound to because of the Cannot Bind right"), - 0x8004C0E6: ( - "DRM_E_XMR_UNSUPPORTED_XMR_VERSION", - "The version of XMR license is not supported for the current action", - ), - 0x8004C100: ( - "DRM_E_NOT_CRL_BLOB", - "CRL blob provided for parsing does not start with CBLB. It means file is not CRL blob at all.", - ), - 0x8004C101: ( - "DRM_E_BAD_CRL_BLOB", - "The file is structured as CRL blob, but there is some error in file structure or one of CRLs inside is invalid.", - ), - 0x8004C200: ("DRM_E_INVALID_DEVCERT_ATTRIBUTE", "The attributes in the Device certificate are invalid"), - 0x8004C300: ("DRM_E_TEST_PKCRYPTO_FAILURE", "Error in PK encryption/decryption crypto test cases."), - 0x8004C301: ("DRM_E_TEST_PKSIGN_VERIFY_ERROR", "Digital signature verification failed."), - 0x8004C302: ("DRM_E_TEST_ENCRYPT_ERROR", "Error in encryption of cipher text."), - 0x8004C303: ("DRM_E_TEST_RC4KEY_FAILED", "RC4 key failed during crypto operations."), - 0x8004C304: ("DRM_E_TEST_DECRYPT_ERROR", "Error in cipher text decryption."), - 0x8004C305: ("DRM_E_TEST_DESKEY_FAILED", "Decrypted data not equal to original data in a DES operation."), - 0x8004C306: ("DRM_E_TEST_CBC_INVERSEMAC_FAILURE", "Decrypted data not equal to original in Inverse MAC operation."), - 0x8004C307: ("DRM_E_TEST_HMAC_FAILURE", "Error in hashed data in HMAC operation."), - 0x8004C308: ("DRM_E_TEST_INVALIDARG", "Error in the number of arguments or argument data in Test files."), - 0x8004C30A: ( - "DRM_E_TEST_DEVICE_PRIVATE_KEY_INCORRECTLY_STORED", - "DRMManager context should not contain the device private key.", - ), - 0x8004C30B: ("DRM_E_TEST_DRMMANAGER_CONTEXT_NULL", "DRMManager context is NULL."), - 0x8004C30C: ("DRM_E_TEST_UNEXPECTED_REVINFO_RESULT", "Revocation cache result was not as expected."), - 0x8004C30D: ("DRM_E_TEST_RIV_MISMATCH", "Revocation Info Version(RIV) mismatch."), - 0x8004C310: ("DRM_E_TEST_URL_ERROR", "There is an error in the URL from the challenge generated."), - 0x8004C311: ( - "DRM_E_TEST_MID_MISMATCH", - "The MIDs returned from the DRM_MANAGER_CONTEXT does not match the test input.", - ), - 0x8004C312: ( - "DRM_E_TEST_METER_CERTIFICATE_MISMATCH", - "The input data does not match with the Metering certificate returned from the license.", - ), - 0x8004C313: ( - "DRM_E_TEST_LICENSE_STATE_MISMATCH", - "The input data and license state returned from the license do not match.", - ), - 0x8004C316: ( - "DRM_E_TEST_SOURCE_ID_MISMATCH", - "The input data and license state returned from the license do not match.", - ), - 0x8004C317: ( - "DRM_E_TEST_UNEXPECTED_LICENSE_COUNT", - "The input data and the number of license from the KID do not match.", - ), - 0x8004C318: ("DRM_E_TEST_UNEXPECTED_DEVICE_PROPERTY", "Unknown device property."), - 0x8004C319: ("DRM_E_TEST_DRMMANAGER_MISALIGNED_BYTES", "Error due to misalignment of bytes."), - 0x8004C31A: ( - "DRM_E_TEST_LICENSE_RESPONSE_ERROR", - "The license response callbacks did not provide the expected data.", - ), - 0x8004C31B: ( - "DRM_E_TEST_OPL_MISMATCH", - "The minimum levels of the compressed/uncompressed Digital and Analog Video do not match the OPL.", - ), - 0x8004C31C: ("DRM_E_TEST_INVALID_OPL_CALLBACK", "The callback type supplied is not valid."), - 0x8004C31D: ("DRM_E_TEST_INCOMPLETE", "The test function failed to complete."), - 0x8004C31E: ( - "DRM_E_TEST_UNEXPECTED_OUTPUT", - "The output of the function being tested does not match the expected output.", - ), - 0x8004C31F: ( - "DRM_E_TEST_DLA_NO_CONTENT_HEADER", - "Content Header Information was not retrieved correctly in DLA Sync Tests.", - ), - 0x8004C320: ( - "DRM_E_TEST_DLA_CONTENT_HEADER_FOUND", - "Content Header Information was found when it should not have been in DLA Sync Tests.", - ), - 0x8004C321: ("DRM_E_TEST_SYNC_LSD_INCORRECT", "DRM_SNC_GetSyncStoreEntry returned incorrect License State Data."), - 0x8004C322: ("DRM_E_TEST_TOO_SLOW", "The performance test failed because DRM took longer than its maximum time."), - 0x8004C323: ( - "DRM_E_TEST_LICENSESTORE_NOT_OPEN", - "The License Store contexts in the App Manager context are not open.", - ), - 0x8004C324: ("DRM_E_TEST_DEVICE_NOT_INITED", "The device instance has not been initialized prior to use."), - 0x8004C325: ( - "DRM_E_TEST_VARIABLE_NOT_SET", - "A global variable needed for test execution has not been set correctly.", - ), - 0x8004C326: ("DRM_E_TEST_NOMORE", "The same as DRM_E_NOMORE, only explicitly used in test code."), - 0x8004C327: ("DRM_E_TEST_FILE_LOAD_ERROR", "There was an error loading a test data file."), - 0x8004C328: ("DRM_E_TEST_LICENSE_ACQ_FAILED", "The attempt to acquire a license failed."), - 0x8004C329: ( - "DRM_E_TEST_UNSUPPORTED_FILE_FORMAT", - "A file format is being used which is not supported by the test function.", - ), - 0x8004C32A: ("DRM_E_TEST_PARSING_ERROR", "There was an error parsing input parameter."), - 0x8004C32B: ("DRM_E_TEST_NOTIMPL", "The specified test API is not implemented."), - 0x8004C32C: ( - "DRM_E_TEST_VARIABLE_NOTFOUND", - "The specified test varaible was not found in the shared variable table.", - ), - 0x8004C32D: ("DRM_E_TEST_VARIABLE_LISTFULL", "The shared test variable table is full."), - 0x8004C32E: ("DRM_E_TEST_UNEXPECTED_CONTENT_PROPERTY", "Unknown content property."), - 0x8004C32F: ("DRM_E_TEST_PRO_HEADER_NOT_SET", "PlayReady Object Header not set."), - 0x8004C330: ("DRM_E_TEST_NON_PRO_HEADER_TYPE", "Incompatible header - PlayReady Object Header expected."), - 0x8004C331: ("DRM_E_TEST_INVALID_DEVICE_WRAPPER", "The Device Simulator Device Wrapper is not valid."), - 0x8004C332: ("DRM_E_TEST_INVALID_WMDM_WRAPPER", "The Device Simulator WMDM Wrapper is not valid."), - 0x8004C333: ("DRM_E_TEST_INVALID_WPD_WRAPPER", "The Device Simulator WPD Wrapper is not valid."), - 0x8004C334: ("DRM_E_TEST_INVALID_FILE", "The data file given was invalid."), - 0x8004C335: ("DRM_E_TEST_PROPERTY_NOT_FOUND", "The object did not have the property which was queried."), - 0x8004C336: ("DRM_E_TEST_METERING_DATA_INCORRECT", "The metering data reported is incorrect."), - 0x8004C337: ( - "DRM_E_TEST_FILE_ALREADY_OPEN", - "The handle variable for a test file is not NULL. This indicates that a file was opened and not closed properly.", - ), - 0x8004C338: ( - "DRM_E_TEST_FILE_NOT_OPEN", - "The handle variable for a test file is NULL. This indicates that a file was not opened.", - ), - 0x8004C339: ( - "DRM_E_TEST_PICT_COLUMN_TOO_WIDE", - "The PICT input file contains a column which is too wide for the test parser to handle.", - ), - 0x8004C33A: ( - "DRM_E_TEST_PICT_COLUMN_MISMATCH", - "The PICT input file contains a row which doesn't have the same number of columns as the header row.", - ), - 0x8004C33B: ("DRM_E_TEST_TUX_TEST_SKIPPED", "TUX cannot find the speficied test case in target dll. Test Skipped."), - 0x8004C33C: ("DRM_E_TEST_KEYFILE_VERIFICATION_FAILURE", "Verification of the Keyfile context failed."), - 0x8004C33D: ("DRM_E_TEST_DATA_VERIFICATION_FAILURE", "Data does not match expected value and failed verification."), - 0x8004C33E: ("DRM_E_TEST_NET_FAIL", "The Test failed to perform Network I/O."), - 0x8004C3E8: ( - "DRM_E_LOGICERR", - "DRM code has a logic error in it. This result should never be returned. There is an unhandled code path if it is returned.", - ), - 0x8004C3E9: ("DRM_E_INVALIDREVINFO", "The device certificate is invalid."), - 0x8004C3EA: ("DRM_E_SYNCLISTNOTSUPPORTED", "The device does not support synclist."), - 0x8004C3EB: ("DRM_E_REVOCATION_BUFFERTOOSMALL", "The revocation buffer is too small."), - 0x8004C3EC: ( - "DRM_E_DEVICE_ALREADY_REGISTERED", - "There exists already a device in the device store with the same DEVICEID that was given.", - ), - 0x8004C3ED: ("DRM_E_DST_NOT_COMPATIBLE", "The data store version is incompatible with this version of DRM."), - 0x8004C3F0: ("DRM_E_RSA_DECRYPTION_ERROR", "The data block/Encoded message used in OAEP decoding is incorrect."), - 0x8004C3F1: ("DRM_E_OEM_RSA_MESSAGE_TOO_BIG", "The base message buffer is larger than the given modulus."), - 0x8004C3F2: ("DRM_E_METERCERTNOTFOUND", "The metering certificate was not found in the store."), - 0x8004C3F3: ("DRM_E_MODULAR_ARITHMETIC_FAILURE", "A failure occurred in bignum modular arithmetic."), - 0x8004C3F4: ("DRM_E_FEATURE_NOT_SUPPORTED", "The feature is not supported in this release."), - 0x8004C3F5: ("DRM_E_REVOCATION_INVALID_PACKAGE", "The revocation package is invalid"), - 0x8004C3F6: ("DRM_E_HWID_ERROR", "Failed to get the hardware ID."), - 0x8004C500: ("DRM_E_DOMAIN_INVALID_GUID", "Not a correct GUID."), - 0x8004C501: ("DRM_E_DOMAIN_INVALID_CUSTOM_DATA_TYPE", "Not a valid custom data type."), - 0x8004C502: ("DRM_E_DOMAIN_STORE_ADD_DATA", "Failed to add data into the domain store."), - 0x8004C503: ("DRM_E_DOMAIN_STORE_GET_DATA", "Failed to retrieve data from the domain store."), - 0x8004C504: ("DRM_E_DOMAIN_STORE_DELETE_DATA", "Failed to delete data from the domain store."), - 0x8004C505: ("DRM_E_DOMAIN_STORE_OPEN_STORE", "Failed to open the domain store."), - 0x8004C506: ("DRM_E_DOMAIN_STORE_CLOSE_STORE", "Failed to close the domain store."), - 0x8004C507: ("DRM_E_DOMAIN_BIND_LICENSE", "Failed to bind to the domain license."), - 0x8004C508: ("DRM_E_DOMAIN_INVALID_CUSTOM_DATA", "Not a valid custom data."), - 0x8004C509: ("DRM_E_DOMAIN_NOT_FOUND", "No domain information is found."), - 0x8004C50A: ( - "DRM_E_DOMAIN_INVALID_DOMKEYXMR_DATA", - "The domain join response contains invalid domain privkey XMR data.", - ), - 0x8004C50B: ( - "DRM_E_DOMAIN_STORE_INVALID_KEY_RECORD", - "Invalid format of domain private key record read from the domain store.", - ), - 0x8004C580: ( - "DRM_E_DEVICE_DOMAIN_JOIN_REQUIRED", - "This error code communicates to the application that the device is not a member of a domain. The app can uses this error code in turn to decide whether it needs to join the domain or not", - ), - 0x8004C600: ("DRM_E_SERVER_INTERNAL_ERROR", "An internal server error occurred."), - 0x8004C601: ("DRM_E_SERVER_INVALID_MESSAGE", "The message sent to the server was invalid."), - 0x8004C602: ("DRM_E_SERVER_DEVICE_LIMIT_REACHED", "The device limit for the domain has been reached."), - 0x8004C603: ("DRM_E_SERVER_INDIV_REQUIRED", "Individualization of the client is required."), - 0x8004C604: ("DRM_E_SERVER_SERVICE_SPECIFIC", "An error specific to the service has occurred."), - 0x8004C605: ("DRM_E_SERVER_DOMAIN_REQUIRED", "A Domain certificate is required."), - 0x8004C606: ("DRM_E_SERVER_RENEW_DOMAIN", "The Domain certificate needs to be renewed."), - 0x8004C607: ("DRM_E_SERVER_UNKNOWN_METERINGID", "The metering identifier is unknown."), - 0x8004C608: ("DRM_E_SERVER_COMPUTER_LIMIT_REACHED", "The computer limit for the domain has been reached."), - 0x8004C609: ( - "DRM_E_SERVER_PROTOCOL_FALLBACK", - "The client should fallback to the V2 license acquisition protocol.", - ), - 0x8004C60A: ( - "DRM_E_SERVER_NOT_A_MEMBER", - "The client was removed from the domain in an offline fashion and thus still has a domain cert, but not a valid domain membership.", - ), - 0x8004C60B: ( - "DRM_E_SERVER_PROTOCOL_VERSION_MISMATCH", - "The protocol version specified was not supported by the server.", - ), - 0x8004C60C: ("DRM_E_SERVER_UNKNOWN_ACCOUNTID", "The account identifier is unknown."), - 0x8004C60D: ("DRM_E_SERVER_PROTOCOL_REDIRECT", "The protocol has a redirect."), - 0x8004C610: ("DRM_E_SERVER_UNKNOWN_TRANSACTIONID", "The transaction identifier is unknown."), - 0x8004C611: ("DRM_E_SERVER_INVALID_LICENSEID", "The license identifier is invalid."), - 0x8004C612: ( - "DRM_E_SERVER_MAXIMUM_LICENSEID_EXCEEDED", - "The maximum number of license identifiers in the request was exceeded.", - ), - 0x8004C700: ("DRM_E_LICACQ_TOO_MANY_LICENSES", "There are too many licenses in the license response."), - 0x8004C701: ( - "DRM_E_LICACQ_ACK_TRANSACTIONID_TOO_BIG", - "The Transaction ID specified by the server exceeds the allocated buffer.", - ), - 0x8004C702: ( - "DRM_E_LICACQ_ACK_MESSAGE_NOT_CREATED", - "The license acquisition acknowledgement message could not be created.", - ), - 0x8004C780: ("DRM_E_INITIATORS_UNKNOWN_TYPE", "The initiator type is unknown."), - 0x8004C781: ("DRM_E_INITIATORS_INVALID_SERVICEID", "The service ID data is not valid."), - 0x8004C782: ("DRM_E_INITIATORS_INVALID_ACCOUNTID", "The account ID data is not valid."), - 0x8004C783: ("DRM_E_INITIATORS_INVALID_MID", "The account ID data is not valid."), - 0x8004C784: ("DRM_E_INITIATORS_MISSING_DC_URL", "Domain Controller URL is missing."), - 0x8004C785: ("DRM_E_INITIATORS_MISSING_CONTENT_HEADER", "Content header is missing."), - 0x8004C786: ( - "DRM_E_INITIATORS_MISSING_LAURL_IN_CONTENT_HEADER", - "Missing license acquisition URL in content header.", - ), - 0x8004C787: ("DRM_E_INITIATORS_MISSING_METERCERT_URL", "Meter certificate server URL is missing."), - 0x8004C800: ("DRM_E_BCERT_INVALID_SIGNATURE_TYPE", "An invalid signature type was encountered"), - 0x8004C801: ( - "DRM_E_BCERT_CHAIN_TOO_DEEP", - "There are, or there would be, too many certificates in the certificate chain", - ), - 0x8004C802: ("DRM_E_BCERT_INVALID_CERT_TYPE", "An invalid certificate type was encountered"), - 0x8004C803: ("DRM_E_BCERT_INVALID_FEATURE", "An invalid feature entry was encountered"), - 0x8004C804: ("DRM_E_BCERT_INVALID_KEY_USAGE", "An invalid public key usage was encountered"), - 0x8004C805: ("DRM_E_BCERT_INVALID_SECURITY_VERSION", "An invalid Indiv Box security version was encountered"), - 0x8004C806: ("DRM_E_BCERT_INVALID_KEY_TYPE", "An invalid public key type was encountered"), - 0x8004C807: ("DRM_E_BCERT_INVALID_KEY_LENGTH", "An invalid public key length was encountered"), - 0x8004C808: ("DRM_E_BCERT_INVALID_MAX_LICENSE_SIZE", "An invalid maximum license size value was encountered"), - 0x8004C809: ("DRM_E_BCERT_INVALID_MAX_HEADER_SIZE", "An invalid maximum license header size value was encountered"), - 0x8004C80A: ( - "DRM_E_BCERT_INVALID_MAX_LICENSE_CHAIN_DEPTH", - "An invalid maximum license chain depth was encountered", - ), - 0x8004C80B: ("DRM_E_BCERT_INVALID_SECURITY_LEVEL", "An invalid security level was encountered"), - 0x8004C80C: ( - "DRM_E_BCERT_PRIVATE_KEY_NOT_SPECIFIED", - "A private key for signing the certificate was not provided to the builder", - ), - 0x8004C80D: ("DRM_E_BCERT_ISSUER_KEY_NOT_SPECIFIED", "An issuer key was not provided to the builder"), - 0x8004C80E: ("DRM_E_BCERT_ACCOUNT_ID_NOT_SPECIFIED", "An account ID was not provided to the builder"), - 0x8004C80F: ("DRM_E_BCERT_SERVICE_ID_NOT_SPECIFIED", "A service provider ID was not provided to the builder"), - 0x8004C810: ("DRM_E_BCERT_CLIENT_ID_NOT_SPECIFIED", "A client ID was not provided to the builder"), - 0x8004C811: ("DRM_E_BCERT_DOMAIN_URL_NOT_SPECIFIED", "A domain URL was not provided to the builder"), - 0x8004C812: ("DRM_E_BCERT_DOMAIN_URL_TOO_LONG", "The domain URL contains too many ASCII characters"), - 0x8004C813: ("DRM_E_BCERT_HARDWARE_ID_NOT_SPECIFIED", "A hardware ID was not provided to the builder"), - 0x8004C814: ("DRM_E_BCERT_HARDWARE_ID_TOO_LONG", "A hardware ID is longer than the maximum supported bytes"), - 0x8004C815: ("DRM_E_BCERT_SERIAL_NUM_NOT_SPECIFIED", "A device serial number was not provided to the builder"), - 0x8004C816: ("DRM_E_BCERT_CERT_ID_NOT_SPECIFIED", "A certificate ID was not provided to the builder"), - 0x8004C817: ( - "DRM_E_BCERT_PUBLIC_KEY_NOT_SPECIFIED", - "A public key for the certificate was not provided to the builder or not found by the parser", - ), - 0x8004C818: ( - "DRM_E_BCERT_KEY_USAGES_NOT_SPECIFIED", - "The public key usage information was not provided to the builder or not found by the parser", - ), - 0x8004C819: ("DRM_E_BCERT_STRING_NOT_NULL_TERMINATED", "Data string is not null-teminated"), - 0x8004C81A: ("DRM_E_BCERT_OBJECTHEADER_LEN_TOO_BIG", "Object length in object header is too big"), - 0x8004C81B: ("DRM_E_BCERT_INVALID_ISSUERKEY_LENGTH", "IssuerKey Length value is invalid"), - 0x8004C81C: ("DRM_E_BCERT_BASICINFO_CERT_EXPIRED", "Certificate is expired"), - 0x8004C81D: ("DRM_E_BCERT_UNEXPECTED_OBJECT_HEADER", "Object header has unexpected values"), - 0x8004C81E: ( - "DRM_E_BCERT_ISSUERKEY_KEYINFO_MISMATCH", - "The cert's Issuer Key does not match key info in the next cert", - ), - 0x8004C81F: ("DRM_E_BCERT_INVALID_MAX_KEY_USAGES", "Number of key usage entries is invalid"), - 0x8004C820: ("DRM_E_BCERT_INVALID_MAX_FEATURES", "Number of features is invalid"), - 0x8004C821: ("DRM_E_BCERT_INVALID_CHAIN_HEADER_TAG", "Cert chain header tag is invalid"), - 0x8004C822: ("DRM_E_BCERT_INVALID_CHAIN_VERSION", "Cert chain version is invalid"), - 0x8004C823: ("DRM_E_BCERT_INVALID_CHAIN_LENGTH", "Cert chain length value is invalid"), - 0x8004C824: ("DRM_E_BCERT_INVALID_CERT_HEADER_TAG", "Cert header tag is invalid"), - 0x8004C825: ("DRM_E_BCERT_INVALID_CERT_VERSION", "Cert version is invalid"), - 0x8004C826: ("DRM_E_BCERT_INVALID_CERT_LENGTH", "Cert length value is invalid"), - 0x8004C827: ("DRM_E_BCERT_INVALID_SIGNEDCERT_LENGTH", "Length of signed portion of certificate is invalid"), - 0x8004C828: ("DRM_E_BCERT_INVALID_PLATFORM_IDENTIFIER", "An invalid Platform Identifier was specified"), - 0x8004C829: ("DRM_E_BCERT_INVALID_NUMBER_EXTDATARECORDS", "An invalid number of extended data records"), - 0x8004C82A: ("DRM_E_BCERT_INVALID_EXTDATARECORD", "An invalid extended data record"), - 0x8004C82B: ("DRM_E_BCERT_EXTDATA_LENGTH_MUST_PRESENT", "Extended data record length must be present."), - 0x8004C82C: ("DRM_E_BCERT_EXTDATA_PRIVKEY_MUST_PRESENT", "Extended data record length must be present."), - 0x8004C82D: ( - "DRM_E_BCERT_INVALID_EXTDATA_LENGTH", - "Calculated and written extended data object lengths do not match.", - ), - 0x8004C82E: ( - "DRM_E_BCERT_EXTDATA_IS_NOT_PROVIDED", - "Extended data is not provided, the cert builder cannot write it.", - ), - 0x8004C82F: ( - "DRM_E_BCERT_HWIDINFO_IS_MISSING", - "The PC certificate is correct but is not ready to use because has no HWID information", - ), - 0x8004C830: ( - "DRM_E_BCERT_INVALID_EXTDATA_SIGNED_LENGTH", - "Length of signed portion of extended data info is invalid", - ), - 0x8004C831: ("DRM_E_BCERT_INVALID_EXTDATA_RECORD_TYPE", "Extended data record type is invalid"), - 0x8004C832: ( - "DRM_E_BCERT_EXTDATAFLAG_CERT_TYPE_MISMATCH", - "Certificate of this type cannot have extended data flag set", - ), - 0x8004C833: ("DRM_E_BCERT_METERING_ID_NOT_SPECIFIED", "An metering ID was not provided to the builder"), - 0x8004C834: ("DRM_E_BCERT_METERING_URL_NOT_SPECIFIED", "A metering URL was not provided to the builder"), - 0x8004C835: ("DRM_E_BCERT_METERING_URL_TOO_LONG", "The metering URL contains too many ASCII characters"), - 0x8004C836: ("DRM_E_BCERT_VERIFICATION_ERRORS", "Verification errors are found while parsing cert chain"), - 0x8004C837: ("DRM_E_BCERT_REQUIRED_KEYUSAGE_MISSING", "Required key usage is missing"), - 0x8004C838: ( - "DRM_E_BCERT_NO_PUBKEY_WITH_REQUESTED_KEYUSAGE", - "The certificate does not contain a public key with the requested key usage", - ), - 0x8004C839: ("DRM_E_BCERT_MANUFACTURER_STRING_TOO_LONG", "The manufacturer string is too long"), - 0x8004C83A: ("DRM_E_BCERT_TOO_MANY_PUBLIC_KEYS", "There are too many public keys in the certificate"), - 0x8004C83B: ("DRM_E_BCERT_OBJECTHEADER_LEN_TOO_SMALL", "Object length in object header is too small"), - 0x8004C83C: ( - "DRM_E_BCERT_INVALID_WARNING_DAYS", - "An invalid server certificate expiration warning days. Warning days must be greater than zero.", - ), - 0x8004C900: ("DRM_E_XMLSIG_ECDSA_VERIFY_FAILURE", "Error in ECDSA signature verification."), - 0x8004C901: ("DRM_E_XMLSIG_SHA_VERIFY_FAILURE", "Error in SHA verification."), - 0x8004C902: ("DRM_E_XMLSIG_FORMAT", "The format of XML signature or encryption segment is incorrect."), - 0x8004C903: ("DRM_E_XMLSIG_PUBLIC_KEY_ID", "Invalud pre-shared public key ID."), - 0x8004C904: ("DRM_E_XMLSIG_INVALID_KEY_FORMAT", "Invalid type of public/private key format."), - 0x8004C905: ("DRM_E_XMLSIG_SHA_HASH_SIZE", "Size of hash is unexpected."), - 0x8004C906: ("DRM_E_XMLSIG_ECDSA_SIGNATURE_SIZE", "Size of ECDSA signature is unexpected."), - 0x8004CA00: ("DRM_E_UTF_UNEXPECTED_END", "Unexpected end of data in the middle of multibyte character."), - 0x8004CA01: ("DRM_E_UTF_INVALID_CODE", "UTF character maps into a code with invalid value."), - 0x8004CB00: ("DRM_E_SOAPXML_INVALID_STATUS_CODE", "Status code contained in the server error response is invalid."), - 0x8004CB01: ("DRM_E_SOAPXML_XML_FORMAT", "Cannot parse out expected XML node."), - 0x8004CB02: ("DRM_E_SOAPXML_WRONG_MESSAGE_TYPE", "The message type associated with the soap message is wrong."), - 0x8004CB03: ("DRM_E_SOAPXML_SIGNATURE_MISSING", "The message did not have a signature and needed one"), - 0x8004CB04: ( - "DRM_E_SOAPXML_PROTOCOL_NOT_SUPPORTED", - "The requested protocol is not supported by the DRM SOAP parser.", - ), - 0x8004CB05: ("DRM_E_SOAPXML_DATA_NOT_FOUND", "The requested data is not found in the response."), - 0x8004CC00: ( - "DRM_E_CRYPTO_PUBLIC_KEY_NOT_MATCH", - "The public key associated with an encrypted domain private from the server does not match any public key on the device.", - ), - 0x8004CC01: ( - "DRM_E_UNABLE_TO_RESOLVE_LOCATION_TREE", - "Unable to derive the key. Maybe due to blackout or no rights to the service, etc.", - ), - 0x8004CD00: ("DRM_E_SECURE_TRACE_BAD_GLOBAL_DATA_POINTER", "The secure trace global data pointer is NULL"), - 0x8004CD01: ("DRM_E_SECURE_TRACE_INVALID_GLOBAL_DATA", "The secure trace global data structure is invalid"), - 0x8004CD02: ("DRM_E_SECURE_TRACE_FORMATTING_ERROR", "An error occured in formatting the trace message"), - 0x8004CD03: ("DRM_E_SECURE_TRACE_BAD_SCHEME_DATA_POINTER", "A secure trace scheme data pointer is NULL"), - 0x8004CD04: ( - "DRM_E_SECURE_TRACE_BAD_PER_THREAD_AES_DATA_POINTER", - "The secure trace per thread AES data pointer is NULL", - ), - 0x8004CD05: ( - "DRM_E_SECURE_TRACE_BAD_PER_THREAD_AES_BUFFER_POINTER", - "A secure trace per thread AES buffer pointer is NULL", - ), - 0x8004CD06: ("DRM_E_SECURE_TRACE_AES_INSUFFICIENT_BUFFER", "There is no space left in the secure trace AES buffer"), - 0x8004CD07: ("DRM_E_SECURE_TRACE_VERSION_MISMATCH", "All drm dlls do not agree on the same secure trace version"), - 0x8004CD08: ("DRM_E_SECURE_TRACE_UNEXPECTED_ERROR", "An expected error was encountered in secure tracing system"), - 0x8004CE00: ("DRM_E_ND_MUST_REVALIDATE", "The client must be revalidated before executing the intended operation."), - 0x8004CE01: ("DRM_E_ND_INVALID_MESSAGE", "A received message is garbled."), - 0x8004CE02: ("DRM_E_ND_INVALID_MESSAGE_TYPE", "A received message contains an invalid message type."), - 0x8004CE03: ("DRM_E_ND_INVALID_MESSAGE_VERSION", "A received message contains an invalid message version."), - 0x8004CE04: ("DRM_E_ND_INVALID_SESSION", "The requested session is invalid."), - 0x8004CE05: ( - "DRM_E_ND_MEDIA_SESSION_LIMIT_REACHED", - "A new session cannot be opened because the maximum number of sessions has already been opened.", - ), - 0x8004CE06: ( - "DRM_E_ND_UNABLE_TO_VERIFY_PROXIMITY", - "The proximity detection procedure could not confirm that the receiver is near the transmitter in the network.", - ), - 0x8004CE07: ( - "DRM_E_ND_INVALID_PROXIMITY_RESPONSE", - "The response to the proximity detection challenge is invalid.", - ), - 0x8004CE08: ( - "DRM_E_ND_DEVICE_LIMIT_REACHED", - "The maximum number of devices in use has been reached. Unable to open additional devices.", - ), - 0x8004CE09: ("DRM_E_ND_BAD_REQUEST", "The message format is invalid."), - 0x8004CE0A: ("DRM_E_ND_FAILED_SEEK", "It is not possible to seek to the specified mark-in point."), - 0x8004CE0B: ( - "DRM_E_ND_INVALID_CONTEXT", - "Manager context or at least one of it's children is missing (or corrupt).", - ), - 0x8004CF00: ("DRM_E_ASF_BAD_ASF_HEADER", "The ASF file has a bad ASF header."), - 0x8004CF01: ("DRM_E_ASF_BAD_PACKET_HEADER", "The ASF file has a bad packet header."), - 0x8004CF02: ("DRM_E_ASF_BAD_PAYLOAD_HEADER", "The ASF file has a bad payload header."), - 0x8004CF03: ("DRM_E_ASF_BAD_DATA_HEADER", "The ASF file has a bad data header."), - 0x8004CF04: ( - "DRM_E_ASF_INVALID_OPERATION", - "The intended operation is invalid given the current processing state of the ASF file.", - ), - 0x8004CF05: ( - "DRM_E_ASF_AES_PAYLOAD_FOUND", - "ND payload extension system found; the file may be encrypted with AES already.", - ), - 0x8004CF06: ( - "DRM_E_ASF_EXTENDED_STREAM_PROPERTIES_OBJ_NOT_FOUND", - "Extended stream properties object is not found; the file may be in non-supported outdated format.", - ), - 0x8004CF20: ("DRM_E_ASF_INVALID_DATA", "The packet is overstuffed with data."), - 0x8004CF21: ( - "DRM_E_ASF_TOO_MANY_PAYLOADS", - "The number of payloads in the packet is greater than the maximum allowed.", - ), - 0x8004CF22: ("DRM_E_ASF_BANDWIDTH_OVERRUN", "An object is overflowing the leaky bucket."), - 0x8004CF23: ( - "DRM_E_ASF_INVALID_STREAM_NUMBER", - "The stream number is invalid; it is either zero, greater than the maximum value allowed, or has no associated data.", - ), - 0x8004CF24: ( - "DRM_E_ASF_LATE_SAMPLE", - "A sample was encountered with a presentation time outside of the mux's send window.", - ), - 0x8004CF25: ("DRM_E_ASF_NOT_ACCEPTING", "The sample does not fit in the remaining payload space."), - 0x8004CF26: ("DRM_E_ASF_UNEXPECTED", "An unexpected error occurred."), - 0x8004D000: ("DRM_E_NONCE_STORE_TOKEN_NOT_FOUND", "The matching nonce store token is not found."), - 0x8004D001: ("DRM_E_NONCE_STORE_OPEN_STORE", "Fail to open nonce store."), - 0x8004D002: ("DRM_E_NONCE_STORE_CLOSE_STORE", "Fail to close nonce store."), - 0x8004D003: ("DRM_E_NONCE_STORE_ADD_LICENSE", "There is already a license associated with the nonce store token."), - 0x8004D100: ("DRM_E_LICGEN_POLICY_NOT_SUPPORTED", "The license generation policy combination is not supported."), - 0x8004D200: ("DRM_E_POLICYSTATE_NOT_FOUND", "The policy state is not found in the secure store."), - 0x8004D201: ( - "DRM_E_POLICYSTATE_CORRUPTED", - "The policy state is not stored as a valid internal format in the secure store.", - ), - 0x8004D300: ("DRM_E_MOVE_DENIED", "The requested move operation was denied by the service."), - 0x8004D301: ("DRM_E_INVALID_MOVE_RESPONSE", "The move response was incorrectly formed."), - 0x8004D302: ("DRM_E_MOVE_NONCE_MISMATCH", "The nonce in the repsonse did not match the expected value."), - 0x8004D303: ("DRM_E_MOVE_TXID_MISMATCH", "The transaction id in the repsonse did not match the expected value."), - 0x8004D304: ("DRM_E_MOVE_STORE_OPEN_STORE", "Failed to open the move store."), - 0x8004D305: ("DRM_E_MOVE_STORE_CLOSE_STORE", "Failed to close the move store."), - 0x8004D306: ("DRM_E_MOVE_STORE_ADD_DATA", "Failed to add data into the move store."), - 0x8004D307: ("DRM_E_MOVE_STORE_GET_DATA", "Failed to retrieve data from the move store."), - 0x8004D308: ("DRM_E_MOVE_FORMAT_INVALID", "The format of a move page or index is invalid."), - 0x8004D309: ("DRM_E_MOVE_SIGNATURE_INVALID", "The signature of a move index is invalid."), - 0x8004D30A: ("DRM_E_COPY_DENIED", "The requested copy operation was denied by the service."), - 0x8004D400: ("DRM_E_XB_OBJECT_NOTFOUND", "The extensible binary object was not found."), - 0x8004D401: ("DRM_E_XB_INVALID_OBJECT", "The extensible binary object format was invalid."), - 0x8004D402: ( - "DRM_E_XB_OBJECT_ALREADY_EXISTS", - "A single instance extensible binary object was encountered more than once.", - ), - 0x8004D403: ( - "DRM_E_XB_REQUIRED_OBJECT_MISSING", - "A required extensible binary object was not found during building.", - ), - 0x8004D404: ( - "DRM_E_XB_UNKNOWN_ELEMENT_TYPE", - "An extensible binary object description contained an element of an unknown type.", - ), - 0x8004D500: ("DRM_E_KEYFILE_INVALID_PLATFORM", "The keyfile does not support the current platform."), - 0x8004D501: ("DRM_E_KEYFILE_TOO_LARGE", "The keyfile is larger than the maximum supported size."), - 0x8004D502: ("DRM_E_KEYFILE_PRIVATE_KEY_NOT_FOUND", "The private key requested was not found in the keyfile."), - 0x8004D503: ( - "DRM_E_KEYFILE_CERTIFICATE_CHAIN_NOT_FOUND", - "The certificate chain requested was not found in the keyfile.", - ), - 0x8004D504: ("DRM_E_KEYFILE_KEY_NOT_FOUND", "The AES Key ID was not found in the keyfile."), - 0x8004D505: ("DRM_E_KEYFILE_UNKNOWN_DECRYPTION_METHOD", "Unknown keyfile decryption method."), - 0x8004D506: ("DRM_E_KEYFILE_INVALID_SIGNATURE", "The keyfile signature was not valid."), - 0x8004D507: ( - "DRM_E_KEYFILE_INTERNAL_DECRYPTION_BUFFER_TOO_SMALL", - "The internal decryption buffer is too small to hold the encrypted key from the keyfile.", - ), - 0x8004D508: ("DRM_E_KEYFILE_PLATFORMID_MISMATCH", "Platform ID in the certificate does not match expected value."), - 0x8004D509: ( - "DRM_E_KEYFILE_CERTIFICATE_ISSUER_KEY_MISMATCH", - "Issuer key of the device certificate does not match public key of the model certificate.", - ), - 0x8004D50A: ( - "DRM_E_KEYFILE_ROBUSTNESSVERSION_MISMATCH", - "Robustness version in the certificate does not match expected value.", - ), - 0x8004D50B: ( - "DRM_E_KEYFILE_FILE_NOT_CLOSED", - "The KeyFile Close function was not called before trying to unintialize the KeyFile context.", - ), - 0x8004D50C: ("DRM_E_KEYFILE_NOT_INITED", "The KeyFile Context was not initialized before trying to use it."), - 0x8004D50D: ("DRM_E_KEYFILE_FORMAT_INVALID", "The format of the KeyFile was invalid."), - 0x8004D50E: ( - "DRM_E_KEYFILE_UPDATE_NOT_ALLOWED", - "The keyfile of the device is read only, and updates are not permitted.", - ), 0x8004DFFC: ("DRM_E_OEM_CONSTRAINT_1_FAIL", "Failed while OEM CONSTRAINT-1 check"), 0x8004DFFD: ("DRM_E_OEM_CONSTRAINT_2_FAIL", "Failed while OEM CONSTRAINT-2 check"), 0x8004DFFE: ("DRM_E_OEM_CONSTRAINT_3_FAIL", "Failed while OEM CONSTRAINT-3 check"), 0x8004DFFF: ("DRM_E_HDCP_NON_SECURE", "Attempt to play back through insecure HDMI output path"), - 0x80070002: ("DRM_E_WIN32_FILE_NOT_FOUND", "The system cannot find the file specified."), - 0x80070012: ("DRM_E_WIN32_NO_MORE_FILES", "There are no more files."), - 0x80070057: ("DRM_E_INVALIDARG", "The parameter is incorrect."), - 0x8007007A: ("DRM_E_BUFFERTOOSMALL", "The data area passed to a function is too small."), - 0x80070103: ("DRM_E_NOMORE", "No more data is available."), - 0x80070216: ("DRM_E_ARITHMETIC_OVERFLOW", "Arithmetic result exceeded maximum value."), - 0x80070490: ("DRM_E_NOT_FOUND", "Element not found."), - 0x80070667: ("DRM_E_INVALID_COMMAND_LINE", "Invalid command line argument."), - 0xC00D2712: ("DRM_E_FAILED_TO_STORE_LICENSE", "License storage is not working."), - 0xC00D272F: ("DRM_E_PARAMETERS_MISMATCHED", "A problem has occurred in the Digital Rights Management component."), - 0xC00D275F: ("DRM_E_NOT_ALL_STORED", "Some of the licenses could not be stored."), } +ERRORS: dict[int, tuple[str, str]] = { + **{m.value[0]: (m.name, m.message) for m in DrmResult if m.value[0] != 0x8004DFF}, + **_LOCAL, +} -REVOCATION_CODES = frozenset( +REVOCATION_CODES: frozenset[int] = frozenset( { - 0x8004C065, # DRM_E_DEVCERT_REVOKED - 0x8004C053, # DRM_E_CERTIFICATE_REVOKED - 0x8004C07D, # DRM_E_ACTIVATION_GROUP_CERT_REVOKED_ERROR + DrmResult.DRM_E_DEVCERT_REVOKED.value[0], + DrmResult.DRM_E_CERTIFICATE_REVOKED.value[0], + DrmResult.DRM_E_ACTIVATION_GROUP_CERT_REVOKED_ERROR.value[0], } ) def is_revocation(code: int) -> bool: """True if the HRESULT means a revoked device or a revoked certificate (signed or unsigned).""" - return code is not None and (code & 0xFFFFFFFF) in REVOCATION_CODES + return (code & 0xFFFFFFFF) in REVOCATION_CODES def describe(code: int) -> str | None: @@ -861,24 +41,9 @@ def describe(code: int) -> str | None: Accepts signed or unsigned 32-bit ints (license servers often return the signed form, e.g. -2147172251 == 0x8004C065). """ - if code is None: - return None key = code & 0xFFFFFFFF entry = ERRORS.get(key) if entry is None: return None name, text = entry return f"{name} (0x{key:08X}){f': {text}' if text else ''}" - - -if __name__ == "__main__": - assert describe(0x8004C065) == describe(-2147172251) - assert "DEVCERT_REVOKED" in (describe(-2147172251) or "") - assert describe(-1021) is None # non-DRM_E service code - assert is_revocation(0x8004C065) and is_revocation(-2147172251) # DEVCERT_REVOKED, both forms - assert not is_revocation(0x8004C006) # INVALIDLICENSE is not revocation - assert is_revocation(0x8004C07D) # activation group cert revoked - assert not is_revocation(0x8004A013) # metering sig, not revocation - assert not is_revocation(0x8004C0C4) # rev-list-not-available, not revocation - assert not is_revocation(0x8004C0C2) # content license revoked, not device - print("ok")