| Previous | Next |
| CLASS_E_CLASSNOTAVAILABLE | VIEW_E_DRAW |
CLASS_E_NOTLICENSED
Class is not licensed for use
CLASS_E_NOTLICENSED has hexadecimal value 0x80040112 (unsigned 2147746066, signed -2147221230). AllStat records “Class is not licensed for use”. The narrow interpretation is that the COM class requires a license that is absent or invalid for this creation path. The failing stage is licensed class creation through IClassFactory or IClassFactory2.
The high bit in 0x80040112 is set, so this is a failure rather than a success or informational result. Its facility field is 4 (FACILITY_ITF) and its low 16-bit code is 274 (0x0112). Those bit fields classify the value, but they do not identify the failing object by themselves; the native method, object identity, and first producer of CLASS_E_NOTLICENSED remain essential.
API stage
Understanding CLASS_E_NOTLICENSED requires this subsystem context: A COM class factory separates discovery of a class object from creation of an instance. For CLASS_E_NOTLICENSED, keeping those stages distinct reveals whether the defect is registration, factory selection, aggregation, licensing, or server implementation.
- Associate
CLASS_E_NOTLICENSEDwith one exact operation in CoGetClassObject, IClassFactory::CreateInstance, aggregation rules, class availability, and optional licensing. - Confirm that
CLASS_E_NOTLICENSEDcame from licensed class creation through IClassFactory or IClassFactory2, rather than from cleanup or a wrapper that ran afterward. - Preserve any IErrorInfo, underlying Win32 result, provider message, or callback failure that preceded
CLASS_E_NOTLICENSED; the HRESULT alone should not erase a more specific cause.
Verification steps
- Capture
CLASS_E_NOTLICENSEDat the first native return before a wrapper maps it to a generic exception. - Identify the exact object, method, and lifecycle phase involved in licensed class creation through IClassFactory or IClassFactory2.
- Capture the class CLSID, factory interface, license method, and whether a key was supplied.
- Separate machine licensing from runtime design-time keys.
- Verify product edition, deployment identity, clock-dependent policy, and server-provided error information.
- Reproduce
CLASS_E_NOTLICENSEDwith one controlled input or state change, and verify that the correction changes the decisive evidence rather than merely hiding the result.
Interpretation limits
CLASS_E_NOTLICENSEDcan result when the machine license is missing or not valid for the installed edition.CLASS_E_NOTLICENSEDcan result when a runtime key was not requested, persisted, or supplied to CreateInstanceLic.CLASS_E_NOTLICENSEDcan result when the caller uses CoCreateInstance or another helper that bypasses the required IClassFactory2 licensing flow.
Incident record
A useful CLASS_E_NOTLICENSED incident records the CLSID, requested IID, class context, server path, pUnkOuter value, factory interface, activation machine, license path, and the first server-side return. For CLASS_E_NOTLICENSED, also retain the application and component build, architecture, process and thread IDs, COM apartment, operation correlation ID, elapsed time, and the first state-changing event before the failure. When logging CLASS_E_NOTLICENSED, redact content and credentials while preserving types, lengths, hashes, opaque identities, and lifecycle generations needed to reproduce its contract.
- For
CLASS_E_NOTLICENSED, capture the class CLSID, factory interface, license method, and whether a key was supplied. - For
CLASS_E_NOTLICENSED, separate machine licensing from runtime design-time keys. - For
CLASS_E_NOTLICENSED, verify product edition, deployment identity, clock-dependent policy, and server-provided error information.
Recovery conditions
Correction. For CLASS_E_NOTLICENSED, install or activate the legitimate license and use the class vendor’s documented IClassFactory2 flow; never synthesize or copy keys between deployments. Retry boundary. Retry only after license state changes or a valid key is obtained; repeated creation attempts should be rate-limited and audited. Before repeating the CLASS_E_NOTLICENSED operation, release any factory or partially initialized instance, determine whether a server process was launched, and avoid reusing a factory obtained before deployment or license state changed.
Practical scenario
A host loads a licensed ActiveX component through CoCreateInstance, which cannot supply its saved runtime key; acquiring IClassFactory2 and calling CreateInstanceLic resolves the contract. This isolates CLASS_E_NOTLICENSED within COM class factories and object creation and provides a regression test for the stated correction.
Difference from related HRESULTs
REGDB_E_CLASSNOTREG is deployment registration failure; CLASS_E_NOTLICENSED occurs after the class is known but creation policy refuses it. For CLASS_E_NOTLICENSED, keep those outcomes separate in exception mappings, telemetry dimensions, user messages, and automated retry policy.
Developer and administrator guidance
For CLASS_E_NOTLICENSED, keep class-object discovery separate from CreateInstance, log pUnkOuter and the initial IID, and make licensed creation an explicit IClassFactory2 path. Regression coverage for CLASS_E_NOTLICENSED should include in-process and local-server contexts, null and non-null controlling unknowns, IID_IUnknown aggregation rules, stale factories after upgrade, and valid versus missing license state.
Operational repair for CLASS_E_NOTLICENSED must target the evidence-backed owner: verify the registered server path and product version with the supported installer, and use the vendor’s licensing mechanism rather than copying registration or license material between machines. Retain before-and-after traces for CLASS_E_NOTLICENSED so the change can be attributed and reversed.
References
- Microsoft: generic COM error codes — official Microsoft documentation relevant to
CLASS_E_NOTLICENSED. - Microsoft: HRESULT values — official Microsoft documentation relevant to
CLASS_E_NOTLICENSED. - Microsoft: IClassFactory::CreateInstance — official Microsoft documentation relevant to
CLASS_E_NOTLICENSED. - Microsoft: CoGetClassObject — official Microsoft documentation relevant to
CLASS_E_NOTLICENSED. - Microsoft: licensing and IClassFactory2 — official Microsoft documentation relevant to
CLASS_E_NOTLICENSED. - Microsoft: IClassFactory2::CreateInstanceLic — official Microsoft documentation relevant to
CLASS_E_NOTLICENSED.
Looking for a different code? Search another status or error code.