From 4160c6775b5e53849d9fcf38bfc3063486642070 Mon Sep 17 00:00:00 2001 From: Thomas Ardal Date: Wed, 15 Nov 2023 18:49:09 +0100 Subject: [PATCH] Support for a lot of hresults --- src/Elmah.Io.HResults/Code.cs | 30 ++ .../Facilities/FacilityBase.cs | 30 ++ .../Facilities/FacilityCertResolver.cs | 49 +++ .../Facilities/FacilityComplusResolver.cs | 130 +++++++ .../Facilities/FacilityDispatchResolver.cs | 61 +++ .../Facilities/FacilityFveResolver.cs | 67 ++++ .../Facilities/FacilityFwpResolver.cs | 74 ++++ .../Facilities/FacilityGraphicsResolver.cs | 39 ++ .../Facilities/FacilityItfResolver.cs | 310 ++++++++++++++++ .../Facilities/FacilityMediaserverResolver.cs | 82 ++++ .../Facilities/FacilityNdisResolver.cs | 64 ++++ .../Facilities/FacilityNullResolver.cs | 20 + .../Facilities/FacilityPlaResolver.cs | 50 +++ .../Facilities/FacilityRpcResolver.cs | 100 +++++ .../Facilities/FacilityScardResolver.cs | 77 ++++ .../Facilities/FacilitySecurityResolver.cs | 351 ++++++++++++++++++ .../Facilities/FacilitySetupapiResolver.cs | 104 ++++++ .../Facilities/FacilityStorageResolver.cs | 81 ++++ .../Facilities/FacilityTpmServicesResolver.cs | 139 +++++++ .../Facilities/FacilityTpmSoftwareResolver.cs | 73 ++++ .../Facilities/FacilityUrtResolver.cs | 18 + .../FacilityUsermodeFilterManagerResolver.cs | 57 +++ .../Facilities/FacilityWin32Resolver.cs | 23 ++ .../Facilities/FacilityWindowsResolver.cs | 43 +++ src/Elmah.Io.HResults/Facility.cs | 24 ++ src/Elmah.Io.HResults/Facility/Facilities.cs | 79 ---- src/Elmah.Io.HResults/Facility/FacilityUrt.cs | 19 - .../Facility/FacilityWin32.cs | 23 -- src/Elmah.Io.HResults/FacilityBase.cs | 14 - src/Elmah.Io.HResults/HResult.cs | 18 +- src/Elmah.Io.HResults/IntExtensions.cs | 70 ++++ test/Elmah.Io.HResults.Test/HResultTest.cs | 40 +- 32 files changed, 2208 insertions(+), 151 deletions(-) create mode 100644 src/Elmah.Io.HResults/Code.cs create mode 100644 src/Elmah.Io.HResults/Facilities/FacilityBase.cs create mode 100644 src/Elmah.Io.HResults/Facilities/FacilityCertResolver.cs create mode 100644 src/Elmah.Io.HResults/Facilities/FacilityComplusResolver.cs create mode 100644 src/Elmah.Io.HResults/Facilities/FacilityDispatchResolver.cs create mode 100644 src/Elmah.Io.HResults/Facilities/FacilityFveResolver.cs create mode 100644 src/Elmah.Io.HResults/Facilities/FacilityFwpResolver.cs create mode 100644 src/Elmah.Io.HResults/Facilities/FacilityGraphicsResolver.cs create mode 100644 src/Elmah.Io.HResults/Facilities/FacilityItfResolver.cs create mode 100644 src/Elmah.Io.HResults/Facilities/FacilityMediaserverResolver.cs create mode 100644 src/Elmah.Io.HResults/Facilities/FacilityNdisResolver.cs create mode 100644 src/Elmah.Io.HResults/Facilities/FacilityNullResolver.cs create mode 100644 src/Elmah.Io.HResults/Facilities/FacilityPlaResolver.cs create mode 100644 src/Elmah.Io.HResults/Facilities/FacilityRpcResolver.cs create mode 100644 src/Elmah.Io.HResults/Facilities/FacilityScardResolver.cs create mode 100644 src/Elmah.Io.HResults/Facilities/FacilitySecurityResolver.cs create mode 100644 src/Elmah.Io.HResults/Facilities/FacilitySetupapiResolver.cs create mode 100644 src/Elmah.Io.HResults/Facilities/FacilityStorageResolver.cs create mode 100644 src/Elmah.Io.HResults/Facilities/FacilityTpmServicesResolver.cs create mode 100644 src/Elmah.Io.HResults/Facilities/FacilityTpmSoftwareResolver.cs create mode 100644 src/Elmah.Io.HResults/Facilities/FacilityUrtResolver.cs create mode 100644 src/Elmah.Io.HResults/Facilities/FacilityUsermodeFilterManagerResolver.cs create mode 100644 src/Elmah.Io.HResults/Facilities/FacilityWin32Resolver.cs create mode 100644 src/Elmah.Io.HResults/Facilities/FacilityWindowsResolver.cs create mode 100644 src/Elmah.Io.HResults/Facility.cs delete mode 100644 src/Elmah.Io.HResults/Facility/Facilities.cs delete mode 100644 src/Elmah.Io.HResults/Facility/FacilityUrt.cs delete mode 100644 src/Elmah.Io.HResults/Facility/FacilityWin32.cs delete mode 100644 src/Elmah.Io.HResults/FacilityBase.cs create mode 100644 src/Elmah.Io.HResults/IntExtensions.cs diff --git a/src/Elmah.Io.HResults/Code.cs b/src/Elmah.Io.HResults/Code.cs new file mode 100644 index 0000000..cd3130d --- /dev/null +++ b/src/Elmah.Io.HResults/Code.cs @@ -0,0 +1,30 @@ +namespace Elmah.Io.HResults +{ + /// + /// Represents a parsed code. + /// + public class Code + { + internal Code(int identifier, string name, string? description = null) + { + Identifier = identifier; + Name = name; + Description = description; + } + + /// + /// The ID of the code. Example: 2 + /// + public int Identifier { get; set; } + + /// + /// The name of the code. Example: ERROR_FILE_NOT_FOUND + /// + public string Name { get; set; } + + /// + /// A potential description of the code. + /// + public string? Description { get; set; } + } +} diff --git a/src/Elmah.Io.HResults/Facilities/FacilityBase.cs b/src/Elmah.Io.HResults/Facilities/FacilityBase.cs new file mode 100644 index 0000000..a6ab701 --- /dev/null +++ b/src/Elmah.Io.HResults/Facilities/FacilityBase.cs @@ -0,0 +1,30 @@ +namespace Elmah.Io.HResults.Facilities +{ + internal abstract class FacilityResolverBase + { + public int Identifier { get; set; } + + public string Name { get; set; } + + protected FacilityResolverBase(int identifier, string name) + { + Identifier = identifier; + Name = name; + } + + internal Facility Facility() + { + return new Facility(Identifier, Name); + } + + internal virtual Code Resolve(bool failure, int code) + { + return Unknown(code); + } + + protected Code Unknown(int code) + { + return new Code(code, $"{code}"); + } + } +} diff --git a/src/Elmah.Io.HResults/Facilities/FacilityCertResolver.cs b/src/Elmah.Io.HResults/Facilities/FacilityCertResolver.cs new file mode 100644 index 0000000..fa1cf01 --- /dev/null +++ b/src/Elmah.Io.HResults/Facilities/FacilityCertResolver.cs @@ -0,0 +1,49 @@ +namespace Elmah.Io.HResults.Facilities +{ + internal class FacilityCertResolver : FacilityResolverBase + { + public FacilityCertResolver() : base(11, "FACILITY_CERT") + { + } + + internal override Code Resolve(bool failure, int code) + { + return code switch + { + 1 => new Code(code, "TRUST_E_PROVIDER_UNKNOWN", "Unknown trust provider."), + 2 => new Code(code, "TRUST_E_ACTION_UNKNOWN", "The trust verification action specified is not supported by the specified trust provider."), + 3 => new Code(code, "TRUST_E_SUBJECT_FORM_UNKNOWN", "The form specified for the subject is not one supported or known by the specified trust provider."), + 4 => new Code(code, "TRUST_E_SUBJECT_NOT_TRUSTED", "The subject is not trusted for the specified action."), + 5 => new Code(code, "DIGSIG_E_ENCODE", "Error due to problem in ASN.1 encoding process."), + 6 => new Code(code, "DIGSIG_E_DECODE", "Error due to problem in ASN.1 decoding process."), + 7 => new Code(code, "DIGSIG_E_EXTENSIBILITY", "Reading/writing extensions where attributes are appropriate, and vice versa."), + 8 => new Code(code, "DIGSIG_E_CRYPTO", "Unspecified cryptographic failure."), + 9 => new Code(code, "PERSIST_E_SIZEDEFINITE", "The size of the data could not be determined."), + 10 => new Code(code, "PERSIST_E_SIZEINDEFINITE", "The size of the indefinite-sized data could not be determined."), + 11 => new Code(code, "PERSIST_E_NOTSELFSIZING", "This object does not read and write self-sizing data."), + 256 => new Code(code, "TRUST_E_NOSIGNATURE", "No signature was present in the subject."), + 257 => new Code(code, "CERT_E_EXPIRED", "A required certificate is not within its validity period when verifying against the current system clock or the time stamp in the signed file."), + 258 => new Code(code, "CERT_E_VALIDITYPERIODNESTING", "The validity periods of the certification chain do not nest correctly."), + 259 => new Code(code, "CERT_E_ROLE", "A certificate that can only be used as an end entity is being used as a CA or vice versa."), + 260 => new Code(code, "CERT_E_PATHLENCONST", "A path length constraint in the certification chain has been violated."), + 261 => new Code(code, "CERT_E_CRITICAL", "A certificate contains an unknown extension that is marked \"critical\"."), + 262 => new Code(code, "CERT_E_PURPOSE", "A certificate is being used for a purpose other than the ones specified by its CA."), + 263 => new Code(code, "CERT_E_ISSUERCHAINING", "A parent of a given certificate did not issue that child certificate."), + 264 => new Code(code, "CERT_E_MALFORMED", "A certificate is missing or has an empty value for an important field, such as a subject or issuer name."), + 265 => new Code(code, "CERT_E_UNTRUSTEDROOT", "A certificate chain processed, but terminated in a root certificate that is not trusted by the trust provider."), + 266 => new Code(code, "CERT_E_CHAINING", "A certificate chain could not be built to a trusted root authority."), + 267 => new Code(code, "TRUST_E_FAIL", "Generic trust failure."), + 268 => new Code(code, "CERT_E_REVOKED", "A certificate was explicitly revoked by its issuer. If the certificate is Microsoft Windows PCA 2010, then the driver was signed by a certificate no longer recognized by Windows.<3>"), + 269 => new Code(code, "CERT_E_UNTRUSTEDTESTROOT", "The certification path terminates with the test root that is not trusted with the current policy settings."), + 270 => new Code(code, "CERT_E_REVOCATION_FAILURE", "The revocation process could not continue—the certificates could not be checked."), + 271 => new Code(code, "CERT_E_CN_NO_MATCH", "The certificate's CN name does not match the passed value."), + 272 => new Code(code, "CERT_E_WRONG_USAGE", "The certificate is not valid for the requested usage."), + 273 => new Code(code, "TRUST_E_EXPLICIT_DISTRUST", "The certificate was explicitly marked as untrusted by the user."), + 274 => new Code(code, "CERT_E_UNTRUSTEDCA", "A certification chain processed correctly, but one of the CA certificates is not trusted by the policy provider."), + 275 => new Code(code, "CERT_E_INVALID_POLICY", "The certificate has invalid policy."), + 276 => new Code(code, "CERT_E_INVALID_NAME", "The certificate has an invalid name. The name is not included in the permitted list or is explicitly excluded."), + _ => Unknown(code), + }; + } + } +} diff --git a/src/Elmah.Io.HResults/Facilities/FacilityComplusResolver.cs b/src/Elmah.Io.HResults/Facilities/FacilityComplusResolver.cs new file mode 100644 index 0000000..51e6b59 --- /dev/null +++ b/src/Elmah.Io.HResults/Facilities/FacilityComplusResolver.cs @@ -0,0 +1,130 @@ +namespace Elmah.Io.HResults.Facilities +{ + internal class FacilityComplusResolver : FacilityResolverBase + { + public FacilityComplusResolver() : base(17, "FACILITY_COMPLUS") + { + } + + internal override Code Resolve(bool failure, int code) + { + return code switch + { + 1025 => new Code(code, "COMADMIN_E_OBJECTERRORS", "Errors occurred accessing one or more objects—the ErrorInfo collection contains more detail."), + 1026 => new Code(code, "COMADMIN_E_OBJECTINVALID", "One or more of the object's properties are missing or invalid."), + 1027 => new Code(code, "COMADMIN_E_KEYMISSING", "The object was not found in the catalog."), + 1028 => new Code(code, "COMADMIN_E_ALREADYINSTALLED", "The object is already registered."), + 1031 => new Code(code, "COMADMIN_E_APP_FILE_WRITEFAIL", "An error occurred writing to the application file."), + 1032 => new Code(code, "COMADMIN_E_APP_FILE_READFAIL", "An error occurred reading the application file."), + 1033 => new Code(code, "COMADMIN_E_APP_FILE_VERSION", "Invalid version number in application file."), + 1034 => new Code(code, "COMADMIN_E_BADPATH", "The file path is invalid."), + 1035 => new Code(code, "COMADMIN_E_APPLICATIONEXISTS", "The application is already installed."), + 1036 => new Code(code, "COMADMIN_E_ROLEEXISTS", "The role already exists."), + 1037 => new Code(code, "COMADMIN_E_CANTCOPYFILE", "An error occurred copying the file."), + 1039 => new Code(code, "COMADMIN_E_NOUSER", "One or more users are not valid."), + 1040 => new Code(code, "COMADMIN_E_INVALIDUSERIDS", "One or more users in the application file are not valid."), + 1041 => new Code(code, "COMADMIN_E_NOREGISTRYCLSID", "The component's CLSID is missing or corrupt."), + 1042 => new Code(code, "COMADMIN_E_BADREGISTRYPROGID", "The component's programmatic ID is missing or corrupt."), + 1043 => new Code(code, "COMADMIN_E_AUTHENTICATIONLEVEL", "Unable to set required authentication level for update request."), + 1044 => new Code(code, "COMADMIN_E_USERPASSWDNOTVALID", "The identity or password set on the application is not valid."), + 1048 => new Code(code, "COMADMIN_E_CLSIDORIIDMISMATCH", "Application file CLSIDs or instance identifiers (IIDs) do not match corresponding DLLs."), + 1049 => new Code(code, "COMADMIN_E_REMOTEINTERFACE", "Interface information is either missing or changed."), + 1050 => new Code(code, "COMADMIN_E_DLLREGISTERSERVER", "DllRegisterServer failed on component install."), + 1051 => new Code(code, "COMADMIN_E_NOSERVERSHARE", "No server file share available."), + 1053 => new Code(code, "COMADMIN_E_DLLLOADFAILED", "DLL could not be loaded."), + 1054 => new Code(code, "COMADMIN_E_BADREGISTRYLIBID", "The registered TypeLib ID is not valid."), + 1055 => new Code(code, "COMADMIN_E_APPDIRNOTFOUND", "Application install directory not found."), + 1059 => new Code(code, "COMADMIN_E_REGISTRARFAILED", "Errors occurred while in the component registrar."), + 1060 => new Code(code, "COMADMIN_E_COMPFILE_DOESNOTEXIST", "The file does not exist."), + 1061 => new Code(code, "COMADMIN_E_COMPFILE_LOADDLLFAIL", "The DLL could not be loaded."), + 1062 => new Code(code, "COMADMIN_E_COMPFILE_GETCLASSOBJ", "GetClassObject failed in the DLL."), + 1063 => new Code(code, "COMADMIN_E_COMPFILE_CLASSNOTAVAIL", "The DLL does not support the components listed in the TypeLib."), + 1064 => new Code(code, "COMADMIN_E_COMPFILE_BADTLB", "The TypeLib could not be loaded."), + 1065 => new Code(code, "COMADMIN_E_COMPFILE_NOTINSTALLABLE", "The file does not contain components or component information."), + 1066 => new Code(code, "COMADMIN_E_NOTCHANGEABLE", "Changes to this object and its subobjects have been disabled."), + 1067 => new Code(code, "COMADMIN_E_NOTDELETEABLE", "The delete function has been disabled for this object."), + 1068 => new Code(code, "COMADMIN_E_SESSION", "The server catalog version is not supported."), + 1069 => new Code(code, "COMADMIN_E_COMP_MOVE_LOCKED", "The component move was disallowed because the source or destination application is either a system application or currently locked against changes."), + 1070 => new Code(code, "COMADMIN_E_COMP_MOVE_BAD_DEST", "The component move failed because the destination application no longer exists."), + 1072 => new Code(code, "COMADMIN_E_REGISTERTLB", "The system was unable to register the TypeLib."), + 1075 => new Code(code, "COMADMIN_E_SYSTEMAPP", "This operation cannot be performed on the system application."), + 1076 => new Code(code, "COMADMIN_E_COMPFILE_NOREGISTRAR", "The component registrar referenced in this file is not available."), + 1077 => new Code(code, "COMADMIN_E_COREQCOMPINSTALLED", "A component in the same DLL is already installed."), + 1078 => new Code(code, "COMADMIN_E_SERVICENOTINSTALLED", "The service is not installed."), + 1079 => new Code(code, "COMADMIN_E_PROPERTYSAVEFAILED", "One or more property settings are either invalid or in conflict with each other."), + 1080 => new Code(code, "COMADMIN_E_OBJECTEXISTS", "The object you are attempting to add or rename already exists."), + 1081 => new Code(code, "COMADMIN_E_COMPONENTEXISTS", "The component already exists."), + 1083 => new Code(code, "COMADMIN_E_REGFILE_CORRUPT", "The registration file is corrupt."), + 1084 => new Code(code, "COMADMIN_E_PROPERTY_OVERFLOW", "The property value is too large."), + 1086 => new Code(code, "COMADMIN_E_NOTINREGISTRY", "Object was not found in registry."), + 1087 => new Code(code, "COMADMIN_E_OBJECTNOTPOOLABLE", "This object cannot be pooled."), + 1094 => new Code(code, "COMADMIN_E_APPLID_MATCHES_CLSID", "A CLSID with the same GUID as the new application ID is already installed on this machine."), + 1095 => new Code(code, "COMADMIN_E_ROLE_DOES_NOT_EXIST", "A role assigned to a component, interface, or method did not exist in the application."), + 1096 => new Code(code, "COMADMIN_E_START_APP_NEEDS_COMPONENTS", "You must have components in an application to start the application."), + 1097 => new Code(code, "COMADMIN_E_REQUIRES_DIFFERENT_PLATFORM", "This operation is not enabled on this platform."), + 1098 => new Code(code, "COMADMIN_E_CAN_NOT_EXPORT_APP_PROXY", "Application proxy is not exportable."), + 1099 => new Code(code, "COMADMIN_E_CAN_NOT_START_APP", "Failed to start application because it is either a library application or an application proxy."), + 1100 => new Code(code, "COMADMIN_E_CAN_NOT_EXPORT_SYS_APP", "System application is not exportable."), + 1101 => new Code(code, "COMADMIN_E_CANT_SUBSCRIBE_TO_COMPONENT", "Cannot subscribe to this component (the component might have been imported)."), + 1102 => new Code(code, "COMADMIN_E_EVENTCLASS_CANT_BE_SUBSCRIBER", "An event class cannot also be a subscriber component."), + 1103 => new Code(code, "COMADMIN_E_LIB_APP_PROXY_INCOMPATIBLE", "Library applications and application proxies are incompatible."), + 1104 => new Code(code, "COMADMIN_E_BASE_PARTITION_ONLY", "This function is valid for the base partition only."), + 1105 => new Code(code, "COMADMIN_E_START_APP_DISABLED", "You cannot start an application that has been disabled."), + 1111 => new Code(code, "COMADMIN_E_CAT_DUPLICATE_PARTITION_NAME", "The specified partition name is already in use on this computer."), + 1112 => new Code(code, "COMADMIN_E_CAT_INVALID_PARTITION_NAME", "The specified partition name is invalid. Check that the name contains at least one visible character."), + 1113 => new Code(code, "COMADMIN_E_CAT_PARTITION_IN_USE", "The partition cannot be deleted because it is the default partition for one or more users."), + 1114 => new Code(code, "COMADMIN_E_FILE_PARTITION_DUPLICATE_FILES", "The partition cannot be exported because one or more components in the partition have the same file name."), + 1115 => new Code(code, "COMADMIN_E_CAT_IMPORTED_COMPONENTS_NOT_ALLOWED", "Applications that contain one or more imported components cannot be installed into a nonbase partition."), + 1116 => new Code(code, "COMADMIN_E_AMBIGUOUS_APPLICATION_NAME", "The application name is not unique and cannot be resolved to an application ID."), + 1117 => new Code(code, "COMADMIN_E_AMBIGUOUS_PARTITION_NAME", "The partition name is not unique and cannot be resolved to a partition ID."), + 1138 => new Code(code, "COMADMIN_E_REGDB_NOTINITIALIZED", "The COM+ registry database has not been initialized."), + 1139 => new Code(code, "COMADMIN_E_REGDB_NOTOPEN", "The COM+ registry database is not open."), + 1140 => new Code(code, "COMADMIN_E_REGDB_SYSTEMERR", "The COM+ registry database detected a system error."), + 1141 => new Code(code, "COMADMIN_E_REGDB_ALREADYRUNNING", "The COM+ registry database is already running."), + 1152 => new Code(code, "COMADMIN_E_MIG_VERSIONNOTSUPPORTED", "This version of the COM+ registry database cannot be migrated."), + 1153 => new Code(code, "COMADMIN_E_MIG_SCHEMANOTFOUND", "The schema version to be migrated could not be found in the COM+ registry database."), + 1154 => new Code(code, "COMADMIN_E_CAT_BITNESSMISMATCH", "There was a type mismatch between binaries."), + 1155 => new Code(code, "COMADMIN_E_CAT_UNACCEPTABLEBITNESS", "A binary of unknown or invalid type was provided."), + 1156 => new Code(code, "COMADMIN_E_CAT_WRONGAPPBITNESS", "There was a type mismatch between a binary and an application."), + 1157 => new Code(code, "COMADMIN_E_CAT_PAUSE_RESUME_NOT_SUPPORTED", "The application cannot be paused or resumed."), + 1158 => new Code(code, "COMADMIN_E_CAT_SERVERFAULT", "The COM+ catalog server threw an exception during execution."), + 1536 => new Code(code, "COMQC_E_APPLICATION_NOT_QUEUED", "Only COM+ applications marked \"queued\" can be invoked using the \"queue\" moniker."), + 1537 => new Code(code, "COMQC_E_NO_QUEUEABLE_INTERFACES", "At least one interface must be marked \"queued\" to create a queued component instance with the \"queue\" moniker."), + 1538 => new Code(code, "COMQC_E_QUEUING_SERVICE_NOT_AVAILABLE", "Message Queuing is required for the requested operation and is not installed."), + 1539 => new Code(code, "COMQC_E_NO_IPERSISTSTREAM", "Unable to marshal an interface that does not support IPersistStream."), + 1540 => new Code(code, "COMQC_E_BAD_MESSAGE", "The message is improperly formatted or was damaged in transit."), + 1541 => new Code(code, "COMQC_E_UNAUTHENTICATED", "An unauthenticated message was received by an application that accepts only authenticated messages."), + 1542 => new Code(code, "COMQC_E_UNTRUSTED_ENQUEUER", "The message was requeued or moved by a user not in the QC Trusted User \"role\"."), + 1793 => new Code(code, "MSDTC_E_DUPLICATE_RESOURCE", "Cannot create a duplicate resource of type Distributed Transaction Coordinator."), + 2056 => new Code(code, "COMADMIN_E_OBJECT_PARENT_MISSING", "One of the objects being inserted or updated does not belong to a valid parent collection."), + 2057 => new Code(code, "COMADMIN_E_OBJECT_DOES_NOT_EXIST", "One of the specified objects cannot be found."), + 2058 => new Code(code, "COMADMIN_E_APP_NOT_RUNNING", "The specified application is not currently running."), + 2059 => new Code(code, "COMADMIN_E_INVALID_PARTITION", "The partitions specified are not valid."), + 2061 => new Code(code, "COMADMIN_E_SVCAPP_NOT_POOLABLE_OR_RECYCLABLE", "COM+ applications that run as Windows NT service cannot be pooled or recycled."), + 2062 => new Code(code, "COMADMIN_E_USER_IN_SET", "One or more users are already assigned to a local partition set."), + 2063 => new Code(code, "COMADMIN_E_CANTRECYCLELIBRARYAPPS", "Library applications cannot be recycled."), + 2065 => new Code(code, "COMADMIN_E_CANTRECYCLESERVICEAPPS", "Applications running as Windows NT services cannot be recycled."), + 2066 => new Code(code, "COMADMIN_E_PROCESSALREADYRECYCLED", "The process has already been recycled."), + 2067 => new Code(code, "COMADMIN_E_PAUSEDPROCESSMAYNOTBERECYCLED", "A paused process cannot be recycled."), + 2068 => new Code(code, "COMADMIN_E_CANTMAKEINPROCSERVICE", "Library applications cannot be Windows NT services."), + 2069 => new Code(code, "COMADMIN_E_PROGIDINUSEBYCLSID", "The ProgID provided to the copy operation is invalid. The ProgID is in use by another registered CLSID."), + 2070 => new Code(code, "COMADMIN_E_DEFAULT_PARTITION_NOT_IN_SET", "The partition specified as the default is not a member of the partition set."), + 2071 => new Code(code, "COMADMIN_E_RECYCLEDPROCESSMAYNOTBEPAUSED", "A recycled process cannot be paused."), + 2072 => new Code(code, "COMADMIN_E_PARTITION_ACCESSDENIED", "Access to the specified partition is denied."), + 2073 => new Code(code, "COMADMIN_E_PARTITION_MSI_ONLY", "Only application files (*.msi files) can be installed into partitions."), + 2074 => new Code(code, "COMADMIN_E_LEGACYCOMPS_NOT_ALLOWED_IN_1_0_FORMAT", "Applications containing one or more legacy components cannot be exported to 1.0 format."), + 2075 => new Code(code, "COMADMIN_E_LEGACYCOMPS_NOT_ALLOWED_IN_NONBASE_PARTITIONS", "Legacy components cannot exist in nonbase partitions."), + 2076 => new Code(code, "COMADMIN_E_COMP_MOVE_SOURCE", "A component cannot be moved (or copied) from the System Application, an application proxy, or a nonchangeable application."), + 2077 => new Code(code, "COMADMIN_E_COMP_MOVE_DEST", "A component cannot be moved (or copied) to the System Application, an application proxy or a nonchangeable application."), + 2078 => new Code(code, "COMADMIN_E_COMP_MOVE_PRIVATE", "A private component cannot be moved (or copied) to a library application or to the base partition."), + 2079 => new Code(code, "COMADMIN_E_BASEPARTITION_REQUIRED_IN_SET", "The Base Application Partition exists in all partition sets and cannot be removed."), + 2080 => new Code(code, "COMADMIN_E_CANNOT_ALIAS_EVENTCLASS", "Alas, Event Class components cannot be aliased."), + 2081 => new Code(code, "COMADMIN_E_PRIVATE_ACCESSDENIED", "Access is denied because the component is private."), + 2082 => new Code(code, "COMADMIN_E_SAFERINVALID", "The specified SAFER level is invalid."), + 2083 => new Code(code, "COMADMIN_E_REGISTRY_ACCESSDENIED", "The specified user cannot write to the system registry."), + 2084 => new Code(code, "COMADMIN_E_PARTITIONS_DISABLED", "COM+ partitions are currently disabled."), + _ => Unknown(code), + }; + } + } +} diff --git a/src/Elmah.Io.HResults/Facilities/FacilityDispatchResolver.cs b/src/Elmah.Io.HResults/Facilities/FacilityDispatchResolver.cs new file mode 100644 index 0000000..8af7bd0 --- /dev/null +++ b/src/Elmah.Io.HResults/Facilities/FacilityDispatchResolver.cs @@ -0,0 +1,61 @@ +namespace Elmah.Io.HResults.Facilities +{ + internal class FacilityDispatchResolver : FacilityResolverBase + { + public FacilityDispatchResolver() : base(2, "FACILITY_DISPATCH") + { + } + + internal override Code Resolve(bool failure, int code) + { + return code switch + { + 1 => new Code(code, "DISP_E_UNKNOWNINTERFACE", "Unknown interface."), + 3 => new Code(code, "DISP_E_MEMBERNOTFOUND", "Member not found."), + 4 => new Code(code, "DISP_E_PARAMNOTFOUND", "Parameter not found."), + 5 => new Code(code, "DISP_E_TYPEMISMATCH", "Type mismatch."), + 6 => new Code(code, "DISP_E_UNKNOWNNAME", "Unknown name."), + 7 => new Code(code, "DISP_E_NONAMEDARGS", "No named arguments."), + 8 => new Code(code, "DISP_E_BADVARTYPE", "Bad variable type."), + 9 => new Code(code, "DISP_E_EXCEPTION", "Exception occurred."), + 10 => new Code(code, "DISP_E_OVERFLOW", "Out of present range."), + 11 => new Code(code, "DISP_E_BADINDEX", "Invalid index."), + 12 => new Code(code, "DISP_E_UNKNOWNLCID", "Unknown language."), + 13 => new Code(code, "DISP_E_ARRAYISLOCKED", "Memory is locked."), + 14 => new Code(code, "DISP_E_BADPARAMCOUNT", "Invalid number of parameters."), + 15 => new Code(code, "DISP_E_PARAMNOTOPTIONAL", "Parameter not optional."), + 16 => new Code(code, "DISP_E_BADCALLEE", "Invalid callee."), + 17 => new Code(code, "DISP_E_NOTACOLLECTION", "Does not support a collection."), + 18 => new Code(code, "DISP_E_DIVBYZERO", "Division by zero."), + 19 => new Code(code, "DISP_E_BUFFERTOOSMALL", "Buffer too small."), + 32790 => new Code(code, "TYPE_E_BUFFERTOOSMALL", "Buffer too small."), + 32791 => new Code(code, "TYPE_E_FIELDNOTFOUND", "Field name not defined in the record."), + 32792 => new Code(code, "TYPE_E_INVDATAREAD", "Old format or invalid type library."), + 32793 => new Code(code, "TYPE_E_UNSUPFORMAT", "Old format or invalid type library."), + 32796 => new Code(code, "TYPE_E_REGISTRYACCESS", "Error accessing the OLE registry."), + 32797 => new Code(code, "TYPE_E_LIBNOTREGISTERED", "Library not registered."), + 32807 => new Code(code, "TYPE_E_UNDEFINEDTYPE", "Bound to unknown type."), + 32808 => new Code(code, "TYPE_E_QUALIFIEDNAMEDISALLOWED", "Qualified name disallowed."), + 32809 => new Code(code, "TYPE_E_INVALIDSTATE", "Invalid forward reference, or reference to uncompiled type."), + 32810 => new Code(code, "TYPE_E_WRONGTYPEKIND", "Type mismatch."), + 32811 => new Code(code, "TYPE_E_ELEMENTNOTFOUND", "Element not found."), + 32812 => new Code(code, "TYPE_E_AMBIGUOUSNAME", "Ambiguous name."), + 32813 => new Code(code, "TYPE_E_NAMECONFLICT", "Name already exists in the library."), + 32814 => new Code(code, "TYPE_E_UNKNOWNLCID", "Unknown language code identifier (LCID)."), + 32815 => new Code(code, "TYPE_E_DLLFUNCTIONNOTFOUND", "Function not defined in specified DLL."), + 35005 => new Code(code, "TYPE_E_BADMODULEKIND", "Wrong module kind for the operation."), + 35013 => new Code(code, "TYPE_E_SIZETOOBIG", "Size cannot exceed 64 KB."), + 35014 => new Code(code, "TYPE_E_DUPLICATEID", "Duplicate ID in inheritance hierarchy."), + 35023 => new Code(code, "TYPE_E_INVALIDID", "Incorrect inheritance depth in standard OLE hmember."), + 36000 => new Code(code, "TYPE_E_TYPEMISMATCH", "Type mismatch."), + 36001 => new Code(code, "TYPE_E_OUTOFBOUNDS", "Invalid number of arguments."), + 36002 => new Code(code, "TYPE_E_IOERROR", "I/O error."), + 36003 => new Code(code, "TYPE_E_CANTCREATETMPFILE", "Error creating unique .tmp file."), + 40010 => new Code(code, "TYPE_E_CANTLOADLIBRARY", "Error loading type library or DLL."), + 40067 => new Code(code, "TYPE_E_INCONSISTENTPROPFUNCS", "Inconsistent property functions."), + 40068 => new Code(code, "TYPE_E_CIRCULARTYPE", "Circular dependency between types and modules."), + _ => Unknown(code), + }; + } + } +} diff --git a/src/Elmah.Io.HResults/Facilities/FacilityFveResolver.cs b/src/Elmah.Io.HResults/Facilities/FacilityFveResolver.cs new file mode 100644 index 0000000..fd2b74a --- /dev/null +++ b/src/Elmah.Io.HResults/Facilities/FacilityFveResolver.cs @@ -0,0 +1,67 @@ +namespace Elmah.Io.HResults.Facilities +{ + internal class FacilityFveResolver : FacilityResolverBase + { + public FacilityFveResolver() : base(49, "FACILITY_FVE") + { + } + + internal override Code Resolve(bool failure, int code) + { + return code switch + { + 0 => new Code(code, "FVE_E_LOCKED_VOLUME", "The volume must be unlocked before it can be used."), + 1 => new Code(code, "FVE_E_NOT_ENCRYPTED", "The volume is fully decrypted and no key is available."), + 2 => new Code(code, "FVE_E_NO_TPM_BIOS", "The firmware does not support using a TPM during boot."), + 3 => new Code(code, "FVE_E_NO_MBR_METRIC", "The firmware does not use a TPM to perform initial program load (IPL) measurement."), + 4 => new Code(code, "FVE_E_NO_BOOTSECTOR_METRIC", "The master boot record (MBR) is not TPM-aware."), + 5 => new Code(code, "FVE_E_NO_BOOTMGR_METRIC", "The BOOTMGR is not being measured by the TPM."), + 6 => new Code(code, "FVE_E_WRONG_BOOTMGR", "The BOOTMGR component does not perform expected TPM measurements."), + 7 => new Code(code, "FVE_E_SECURE_KEY_REQUIRED", "No secure key protection mechanism has been defined."), + 8 => new Code(code, "FVE_E_NOT_ACTIVATED", "This volume has not been provisioned for encryption."), + 9 => new Code(code, "FVE_E_ACTION_NOT_ALLOWED", "Requested action was denied by the full-volume encryption (FVE) control engine."), + 10 => new Code(code, "FVE_E_AD_SCHEMA_NOT_INSTALLED", "The Active Directory forest does not contain the required attributes and classes to host FVE or TPM information."), + 11 => new Code(code, "FVE_E_AD_INVALID_DATATYPE", "The type of data obtained from Active Directory was not expected."), + 12 => new Code(code, "FVE_E_AD_INVALID_DATASIZE", "The size of the data obtained from Active Directory was not expected."), + 13 => new Code(code, "FVE_E_AD_NO_VALUES", "The attribute read from Active Directory has no (zero) values."), + 14 => new Code(code, "FVE_E_AD_ATTR_NOT_SET", "The attribute was not set."), + 15 => new Code(code, "FVE_E_AD_GUID_NOT_FOUND", "The specified GUID could not be found."), + 16 => new Code(code, "FVE_E_BAD_INFORMATION", "The control block for the encrypted volume is not valid."), + 17 => new Code(code, "FVE_E_TOO_SMALL", "Not enough free space remaining on volume to allow encryption."), + 18 => new Code(code, "FVE_E_SYSTEM_VOLUME", "The volume cannot be encrypted because it is required to boot the operating system."), + 19 => new Code(code, "FVE_E_FAILED_WRONG_FS", "The volume cannot be encrypted because the file system is not supported."), + 20 => new Code(code, "FVE_E_FAILED_BAD_FS", "The file system is inconsistent. Run CHKDSK."), + 21 => new Code(code, "FVE_E_NOT_SUPPORTED", "This volume cannot be encrypted."), + 22 => new Code(code, "FVE_E_BAD_DATA", "Data supplied is malformed."), + 23 => new Code(code, "FVE_E_VOLUME_NOT_BOUND", "Volume is not bound to the system."), + 24 => new Code(code, "FVE_E_TPM_NOT_OWNED", "TPM must be owned before a volume can be bound to it."), + 25 => new Code(code, "FVE_E_NOT_DATA_VOLUME", "The volume specified is not a data volume."), + 26 => new Code(code, "FVE_E_AD_INSUFFICIENT_BUFFER", "The buffer supplied to a function was insufficient to contain the returned data."), + 27 => new Code(code, "FVE_E_CONV_READ", "A read operation failed while converting the volume."), + 28 => new Code(code, "FVE_E_CONV_WRITE", "A write operation failed while converting the volume."), + 29 => new Code(code, "FVE_E_KEY_REQUIRED", "One or more key protection mechanisms are required for this volume."), + 30 => new Code(code, "FVE_E_CLUSTERING_NOT_SUPPORTED", "Cluster configurations are not supported."), + 31 => new Code(code, "FVE_E_VOLUME_BOUND_ALREADY", "The volume is already bound to the system."), + 32 => new Code(code, "FVE_E_OS_NOT_PROTECTED", "The boot OS volume is not being protected via FVE."), + 33 => new Code(code, "FVE_E_PROTECTION_DISABLED", "All protection mechanisms are effectively disabled (clear key exists)."), + 34 => new Code(code, "FVE_E_RECOVERY_KEY_REQUIRED", "A recovery key protection mechanism is required."), + 35 => new Code(code, "FVE_E_FOREIGN_VOLUME", "This volume cannot be bound to a TPM."), + 36 => new Code(code, "FVE_E_OVERLAPPED_UPDATE", "The control block for the encrypted volume was updated by another thread. Try again."), + 37 => new Code(code, "FVE_E_TPM_SRK_AUTH_NOT_ZERO", "The SRK authentication of the TPM is not zero and, therefore, is not compatible."), + 38 => new Code(code, "FVE_E_FAILED_SECTOR_SIZE", "The volume encryption algorithm cannot be used on this sector size."), + 39 => new Code(code, "FVE_E_FAILED_AUTHENTICATION", "BitLocker recovery authentication failed."), + 40 => new Code(code, "FVE_E_NOT_OS_VOLUME", "The volume specified is not the boot OS volume."), + 41 => new Code(code, "FVE_E_AUTOUNLOCK_ENABLED", "Auto-unlock information for data volumes is present on the boot OS volume."), + 42 => new Code(code, "FVE_E_WRONG_BOOTSECTOR", "The system partition boot sector does not perform TPM measurements."), + 43 => new Code(code, "FVE_E_WRONG_SYSTEM_FS", "The system partition file system must be NTFS."), + 44 => new Code(code, "FVE_E_POLICY_PASSWORD_REQUIRED", "Group policy requires a recovery password before encryption can begin."), + 45 => new Code(code, "FVE_E_CANNOT_SET_FVEK_ENCRYPTED", "The volume encryption algorithm and key cannot be set on an encrypted volume."), + 46 => new Code(code, "FVE_E_CANNOT_ENCRYPT_NO_KEY", "A key must be specified before encryption can begin."), + 48 => new Code(code, "FVE_E_BOOTABLE_CDDVD", "A bootable CD/DVD is in the system. Remove the CD/DVD and reboot the system."), + 49 => new Code(code, "FVE_E_PROTECTOR_EXISTS", "An instance of this key protector already exists on the volume."), + 50 => new Code(code, "FVE_E_RELATIVE_PATH", "The file cannot be saved to a relative path."), + _ => Unknown(code), + }; + } + } +} diff --git a/src/Elmah.Io.HResults/Facilities/FacilityFwpResolver.cs b/src/Elmah.Io.HResults/Facilities/FacilityFwpResolver.cs new file mode 100644 index 0000000..c068980 --- /dev/null +++ b/src/Elmah.Io.HResults/Facilities/FacilityFwpResolver.cs @@ -0,0 +1,74 @@ +namespace Elmah.Io.HResults.Facilities +{ + internal class FacilityFwpResolver : FacilityResolverBase + { + public FacilityFwpResolver() : base(50, "FACILITY_FWP") + { + } + + internal override Code Resolve(bool failure, int code) + { + return code switch + { + 1 => new Code(code, "FWP_E_CALLOUT_NOT_FOUND", "The callout does not exist."), + 2 => new Code(code, "FWP_E_CONDITION_NOT_FOUND", "The filter condition does not exist."), + 3 => new Code(code, "FWP_E_FILTER_NOT_FOUND", "The filter does not exist."), + 4 => new Code(code, "FWP_E_LAYER_NOT_FOUND", "The layer does not exist."), + 5 => new Code(code, "FWP_E_PROVIDER_NOT_FOUND", "The provider does not exist."), + 6 => new Code(code, "FWP_E_PROVIDER_CONTEXT_NOT_FOUND", "The provider context does not exist."), + 7 => new Code(code, "FWP_E_SUBLAYER_NOT_FOUND", "The sublayer does not exist."), + 8 => new Code(code, "FWP_E_NOT_FOUND", "The object does not exist."), + 9 => new Code(code, "FWP_E_ALREADY_EXISTS", "An object with that GUID or LUID already exists."), + 10 => new Code(code, "FWP_E_IN_USE", "The object is referenced by other objects and, therefore, cannot be deleted."), + 11 => new Code(code, "FWP_E_DYNAMIC_SESSION_IN_PROGRESS", "The call is not allowed from within a dynamic session."), + 12 => new Code(code, "FWP_E_WRONG_SESSION", "The call was made from the wrong session and, therefore, cannot be completed."), + 13 => new Code(code, "FWP_E_NO_TXN_IN_PROGRESS", "The call must be made from within an explicit transaction."), + 14 => new Code(code, "FWP_E_TXN_IN_PROGRESS", "The call is not allowed from within an explicit transaction."), + 15 => new Code(code, "FWP_E_TXN_ABORTED", "The explicit transaction has been forcibly canceled."), + 16 => new Code(code, "FWP_E_SESSION_ABORTED", "The session has been canceled."), + 17 => new Code(code, "FWP_E_INCOMPATIBLE_TXN", "The call is not allowed from within a read-only transaction."), + 18 => new Code(code, "FWP_E_TIMEOUT", "The call timed out while waiting to acquire the transaction lock."), + 19 => new Code(code, "FWP_E_NET_EVENTS_DISABLED", "Collection of network diagnostic events is disabled."), + 20 => new Code(code, "FWP_E_INCOMPATIBLE_LAYER", "The operation is not supported by the specified layer."), + 21 => new Code(code, "FWP_E_KM_CLIENTS_ONLY", "The call is allowed for kernel-mode callers only."), + 22 => new Code(code, "FWP_E_LIFETIME_MISMATCH", "The call tried to associate two objects with incompatible lifetimes."), + 23 => new Code(code, "FWP_E_BUILTIN_OBJECT", "The object is built in and, therefore, cannot be deleted."), + 24 => new Code(code, "FWP_E_TOO_MANY_BOOTTIME_FILTERS", "The maximum number of boot-time filters has been reached."), + 25 => new Code(code, "FWP_E_NOTIFICATION_DROPPED", "A notification could not be delivered because a message queue is at its maximum capacity."), + 26 => new Code(code, "FWP_E_TRAFFIC_MISMATCH", "The traffic parameters do not match those for the security association context."), + 27 => new Code(code, "FWP_E_INCOMPATIBLE_SA_STATE", "The call is not allowed for the current security association state."), + 28 => new Code(code, "FWP_E_NULL_POINTER", "A required pointer is null."), + 29 => new Code(code, "FWP_E_INVALID_ENUMERATOR", "An enumerator is not valid."), + 30 => new Code(code, "FWP_E_INVALID_FLAGS", "The flags field contains an invalid value."), + 31 => new Code(code, "FWP_E_INVALID_NET_MASK", "A network mask is not valid."), + 32 => new Code(code, "FWP_E_INVALID_RANGE", "An FWP_RANGE is not valid."), + 33 => new Code(code, "FWP_E_INVALID_INTERVAL", "The time interval is not valid."), + 34 => new Code(code, "FWP_E_ZERO_LENGTH_ARRAY", "An array that must contain at least one element that is zero-length."), + 35 => new Code(code, "FWP_E_NULL_DISPLAY_NAME", "The displayData.name field cannot be null."), + 36 => new Code(code, "FWP_E_INVALID_ACTION_TYPE", "The action type is not one of the allowed action types for a filter."), + 37 => new Code(code, "FWP_E_INVALID_WEIGHT", "The filter weight is not valid."), + 38 => new Code(code, "FWP_E_MATCH_TYPE_MISMATCH", "A filter condition contains a match type that is not compatible with the operands."), + 39 => new Code(code, "FWP_E_TYPE_MISMATCH", "An FWP_VALUE or FWPM_CONDITION_VALUE is of the wrong type."), + 40 => new Code(code, "FWP_E_OUT_OF_BOUNDS", "An integer value is outside the allowed range."), + 41 => new Code(code, "FWP_E_RESERVED", "A reserved field is nonzero."), + 42 => new Code(code, "FWP_E_DUPLICATE_CONDITION", "A filter cannot contain multiple conditions operating on a single field."), + 43 => new Code(code, "FWP_E_DUPLICATE_KEYMOD", "A policy cannot contain the same keying module more than once."), + 44 => new Code(code, "FWP_E_ACTION_INCOMPATIBLE_WITH_LAYER", "The action type is not compatible with the layer."), + 45 => new Code(code, "FWP_E_ACTION_INCOMPATIBLE_WITH_SUBLAYER", "The action type is not compatible with the sublayer."), + 46 => new Code(code, "FWP_E_CONTEXT_INCOMPATIBLE_WITH_LAYER", "The raw context or the provider context is not compatible with the layer."), + 47 => new Code(code, "FWP_E_CONTEXT_INCOMPATIBLE_WITH_CALLOUT", "The raw context or the provider context is not compatible with the callout."), + 48 => new Code(code, "FWP_E_INCOMPATIBLE_AUTH_METHOD", "The authentication method is not compatible with the policy type."), + 49 => new Code(code, "FWP_E_INCOMPATIBLE_DH_GROUP", "The Diffie-Hellman group is not compatible with the policy type."), + 50 => new Code(code, "FWP_E_EM_NOT_SUPPORTED", "An Internet Key Exchange (IKE) policy cannot contain an Extended Mode policy."), + 51 => new Code(code, "FWP_E_NEVER_MATCH", "The enumeration template or subscription will never match any objects."), + 52 => new Code(code, "FWP_E_PROVIDER_CONTEXT_MISMATCH", "The provider context is of the wrong type."), + 53 => new Code(code, "FWP_E_INVALID_PARAMETER", "The parameter is incorrect."), + 54 => new Code(code, "FWP_E_TOO_MANY_SUBLAYERS", "The maximum number of sublayers has been reached."), + 55 => new Code(code, "FWP_E_CALLOUT_NOTIFICATION_FAILED", "The notification function for a callout returned an error."), + 56 => new Code(code, "FWP_E_INCOMPATIBLE_AUTH_CONFIG", "The IPsec authentication configuration is not compatible with the authentication type."), + 57 => new Code(code, "FWP_E_INCOMPATIBLE_CIPHER_CONFIG", "The IPsec cipher configuration is not compatible with the cipher type."), + _ => Unknown(code), + }; + } + } +} diff --git a/src/Elmah.Io.HResults/Facilities/FacilityGraphicsResolver.cs b/src/Elmah.Io.HResults/Facilities/FacilityGraphicsResolver.cs new file mode 100644 index 0000000..4dbe763 --- /dev/null +++ b/src/Elmah.Io.HResults/Facilities/FacilityGraphicsResolver.cs @@ -0,0 +1,39 @@ +namespace Elmah.Io.HResults.Facilities +{ + internal class FacilityGraphicsResolver : FacilityResolverBase + { + public FacilityGraphicsResolver() : base(38, "FACILITY_GRAPHICS") + { + } + + internal override Code Resolve(bool failure, int code) + { + if (failure) + { + switch (code) + { + case 1: return new Code(code, "ERROR_HUNG_DISPLAY_DRIVER_THREAD", "{Display Driver Stopped Responding} The %hs display driver has stopped working normally. Save your work and reboot the system to restore full display functionality. The next time you reboot the machine a dialog will be displayed giving you a chance to report this failure to Microsoft."); + case 4097: return new Code(code, "ERROR_MONITOR_NO_DESCRIPTOR", "Monitor descriptor could not be obtained."); + case 4098: return new Code(code, "ERROR_MONITOR_UNKNOWN_DESCRIPTOR_FORMAT", "Format of the obtained monitor descriptor is not supported by this release."); + case 12289: return new Code(code, "DWM_E_COMPOSITIONDISABLED", "{Desktop Composition is Disabled} The operation could not be completed because desktop composition is disabled."); + case 12290: return new Code(code, "DWM_E_REMOTING_NOT_SUPPORTED", "{Some Desktop Composition APIs Are Not Supported While Remoting} Some desktop composition APIs are not supported while remoting. The operation is not supported while running in a remote session."); + case 12291: return new Code(code, "DWM_E_NO_REDIRECTION_SURFACE_AVAILABLE", "{No DWM Redirection Surface is Available} The Desktop Window Manager (DWM) was unable to provide a redirection surface to complete the DirectX present."); + case 12292: return new Code(code, "DWM_E_NOT_QUEUING_PRESENTS", "{DWM Is Not Queuing Presents for the Specified Window} The window specified is not currently using queued presents."); + } + } + else + { + switch (code) + { + case 8967: return new Code(code, "ERROR_GRAPHICS_MODE_NOT_PINNED", "No mode is pinned on the specified VidPN source or target."); + case 8990: return new Code(code, "ERROR_GRAPHICS_NO_PREFERRED_MODE", "Specified mode set does not specify preference for one of its modes."); + case 9035: return new Code(code, "ERROR_GRAPHICS_DATASET_IS_EMPTY", "Specified data set (for example, mode set, frequency range set, descriptor set, and topology) is empty."); + case 9036: return new Code(code, "ERROR_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET", "Specified data set (for example, mode set, frequency range set, descriptor set, and topology) does not contain any more elements."); + case 9041: return new Code(code, "ERROR_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_PINNED", "Specified content transformation is not pinned on the specified VidPN present path."); + } + } + + return Unknown(code); + } + } +} diff --git a/src/Elmah.Io.HResults/Facilities/FacilityItfResolver.cs b/src/Elmah.Io.HResults/Facilities/FacilityItfResolver.cs new file mode 100644 index 0000000..e5839ec --- /dev/null +++ b/src/Elmah.Io.HResults/Facilities/FacilityItfResolver.cs @@ -0,0 +1,310 @@ +namespace Elmah.Io.HResults.Facilities +{ + internal class FacilityItfResolver : FacilityResolverBase + { + public FacilityItfResolver() : base(4, "FACILITY_ITF") + { + } + + internal override Code Resolve(bool failure, int code) + { + if (failure) + { + switch (code) + { + case 0: return new Code(code, "OLE_E_OLEVERB", "Invalid OLEVERB structure."); + case 1: return new Code(code, "OLE_E_ADVF", "Invalid advise flags."); + case 2: return new Code(code, "OLE_E_ENUM_NOMORE", "Cannot enumerate any more because the associated data is missing."); + case 3: return new Code(code, "OLE_E_ADVISENOTSUPPORTED", "This implementation does not take advises."); + case 4: return new Code(code, "OLE_E_NOCONNECTION", "There is no connection for this connection ID."); + case 5: return new Code(code, "OLE_E_NOTRUNNING", "Need to run the object to perform this operation."); + case 6: return new Code(code, "OLE_E_NOCACHE", "There is no cache to operate on."); + case 7: return new Code(code, "OLE_E_BLANK", "Uninitialized object."); + case 8: return new Code(code, "OLE_E_CLASSDIFF", "Linked object's source class has changed."); + case 9: return new Code(code, "OLE_E_CANT_GETMONIKER", "Not able to get the moniker of the object."); + case 10: return new Code(code, "OLE_E_CANT_BINDTOSOURCE", "Not able to bind to the source."); + case 11: return new Code(code, "OLE_E_STATIC", "Object is static; operation not allowed."); + case 12: return new Code(code, "OLE_E_PROMPTSAVECANCELLED", "User canceled out of the Save dialog box."); + case 13: return new Code(code, "OLE_E_INVALIDRECT", "Invalid rectangle."); + case 14: return new Code(code, "OLE_E_WRONGCOMPOBJ", "compobj.dll is too old for the ole2.dll initialized."); + case 15: return new Code(code, "OLE_E_INVALIDHWND", "Invalid window handle."); + case 16: return new Code(code, "OLE_E_NOT_INPLACEACTIVE", "Object is not in any of the inplace active states."); + case 17: return new Code(code, "OLE_E_CANTCONVERT", "Not able to convert object."); + case 18: return new Code(code, "OLE_E_NOSTORAGE", "Not able to perform the operation because object is not given storage yet."); + case 100: return new Code(code, "DV_E_FORMATETC", "Invalid FORMATETC structure."); + case 101: return new Code(code, "DV_E_DVTARGETDEVICE", "Invalid DVTARGETDEVICE structure."); + case 102: return new Code(code, "DV_E_STGMEDIUM", "Invalid STDGMEDIUM structure."); + case 103: return new Code(code, "DV_E_STATDATA", "Invalid STATDATA structure."); + case 104: return new Code(code, "DV_E_LINDEX", "Invalid lindex."); + case 105: return new Code(code, "DV_E_TYMED", "Invalid TYMED structure."); + case 106: return new Code(code, "DV_E_CLIPFORMAT", "Invalid clipboard format."); + case 107: return new Code(code, "DV_E_DVASPECT", "Invalid aspects."); + case 108: return new Code(code, "DV_E_DVTARGETDEVICE_SIZE", "The tdSize parameter of the DVTARGETDEVICE structure is invalid."); + case 109: return new Code(code, "DV_E_NOIVIEWOBJECT", "Object does not support IViewObject interface."); + case 256: return new Code(code, "DRAGDROP_E_NOTREGISTERED", "Trying to revoke a drop target that has not been registered."); + case 257: return new Code(code, "DRAGDROP_E_ALREADYREGISTERED", "This window has already been registered as a drop target."); + case 258: return new Code(code, "DRAGDROP_E_INVALIDHWND", "Invalid window handle."); + case 272: return new Code(code, "CLASS_E_NOAGGREGATION", "Class does not support aggregation (or class object is remote)."); + case 273: return new Code(code, "CLASS_E_CLASSNOTAVAILABLE", "ClassFactory cannot supply requested class."); + case 274: return new Code(code, "CLASS_E_NOTLICENSED", "Class is not licensed for use."); + case 320: return new Code(code, "VIEW_E_DRAW", "Error drawing view."); + case 336: return new Code(code, "REGDB_E_READREGDB", "Could not read key from registry."); + case 337: return new Code(code, "REGDB_E_WRITEREGDB", "Could not write key to registry."); + case 338: return new Code(code, "REGDB_E_KEYMISSING", "Could not find the key in the registry."); + case 339: return new Code(code, "REGDB_E_INVALIDVALUE", "Invalid value for registry."); + case 340: return new Code(code, "REGDB_E_CLASSNOTREG", "Class not registered."); + case 341: return new Code(code, "REGDB_E_IIDNOTREG", "Interface not registered."); + case 342: return new Code(code, "REGDB_E_BADTHREADINGMODEL", "Threading model entry is not valid."); + case 352: return new Code(code, "CAT_E_CATIDNOEXIST", "CATID does not exist."); + case 353: return new Code(code, "CAT_E_NODESCRIPTION", "Description not found."); + case 356: return new Code(code, "CS_E_PACKAGE_NOTFOUND", "No package in the software installation data in Active Directory meets this criteria."); + case 357: return new Code(code, "CS_E_NOT_DELETABLE", "Deleting this will break the referential integrity of the software installation data in Active Directory."); + case 358: return new Code(code, "CS_E_CLASS_NOTFOUND", "The CLSID was not found in the software installation data in Active Directory."); + case 359: return new Code(code, "CS_E_INVALID_VERSION", "The software installation data in Active Directory is corrupt."); + case 360: return new Code(code, "CS_E_NO_CLASSSTORE", "There is no software installation data in Active Directory."); + case 361: return new Code(code, "CS_E_OBJECT_NOTFOUND", "There is no software installation data object in Active Directory."); + case 362: return new Code(code, "CS_E_OBJECT_ALREADY_EXISTS", "The software installation data object in Active Directory already exists."); + case 363: return new Code(code, "CS_E_INVALID_PATH", "The path to the software installation data in Active Directory is not correct."); + case 364: return new Code(code, "CS_E_NETWORK_ERROR", "A network error interrupted the operation."); + case 365: return new Code(code, "CS_E_ADMIN_LIMIT_EXCEEDED", "The size of this object exceeds the maximum size set by the administrator."); + case 366: return new Code(code, "CS_E_SCHEMA_MISMATCH", "The schema for the software installation data in Active Directory does not match the required schema."); + case 367: return new Code(code, "CS_E_INTERNAL_ERROR", "An error occurred in the software installation data in Active Directory."); + case 368: return new Code(code, "CACHE_E_NOCACHE_UPDATED", "Cache not updated."); + case 384: return new Code(code, "OLEOBJ_E_NOVERBS", "No verbs for OLE object."); + case 385: return new Code(code, "OLEOBJ_E_INVALIDVERB", "Invalid verb for OLE object."); + case 416: return new Code(code, "INPLACE_E_NOTUNDOABLE", "Undo is not available."); + case 417: return new Code(code, "INPLACE_E_NOTOOLSPACE", "Space for tools is not available."); + case 448: return new Code(code, "CONVERT10_E_OLESTREAM_GET", "OLESTREAM Get method failed."); + case 449: return new Code(code, "CONVERT10_E_OLESTREAM_PUT", "OLESTREAM Put method failed."); + case 450: return new Code(code, "CONVERT10_E_OLESTREAM_FMT", "Contents of the OLESTREAM not in correct format."); + case 451: return new Code(code, "CONVERT10_E_OLESTREAM_BITMAP_TO_DIB", "There was an error in a Windows GDI call while converting the bitmap to a device-independent bitmap (DIB)."); + case 452: return new Code(code, "CONVERT10_E_STG_FMT", "Contents of the IStorage not in correct format."); + case 453: return new Code(code, "CONVERT10_E_STG_NO_STD_STREAM", "Contents of IStorage is missing one of the standard streams."); + case 454: return new Code(code, "CONVERT10_E_STG_DIB_TO_BITMAP", "There was an error in a Windows Graphics Device Interface (GDI) call while converting the DIB to a bitmap."); + case 464: return new Code(code, "CLIPBRD_E_CANT_OPEN", "OpenClipboard failed."); + case 465: return new Code(code, "CLIPBRD_E_CANT_EMPTY", "EmptyClipboard failed."); + case 466: return new Code(code, "CLIPBRD_E_CANT_SET", "SetClipboard failed."); + case 467: return new Code(code, "CLIPBRD_E_BAD_DATA", "Data on clipboard is invalid."); + case 468: return new Code(code, "CLIPBRD_E_CANT_CLOSE", "CloseClipboard failed."); + case 480: return new Code(code, "MK_E_CONNECTMANUALLY", "Moniker needs to be connected manually."); + case 481: return new Code(code, "MK_E_EXCEEDEDDEADLINE", "Operation exceeded deadline."); + case 482: return new Code(code, "MK_E_NEEDGENERIC", "Moniker needs to be generic."); + case 483: return new Code(code, "MK_E_UNAVAILABLE", "Operation unavailable."); + case 484: return new Code(code, "MK_E_SYNTAX", "Invalid syntax."); + case 485: return new Code(code, "MK_E_NOOBJECT", "No object for moniker."); + case 486: return new Code(code, "MK_E_INVALIDEXTENSION", "Bad extension for file."); + case 487: return new Code(code, "MK_E_INTERMEDIATEINTERFACENOTSUPPORTED", "Intermediate operation failed."); + case 488: return new Code(code, "MK_E_NOTBINDABLE", "Moniker is not bindable."); + case 489: return new Code(code, "MK_E_NOTBOUND", "Moniker is not bound."); + case 490: return new Code(code, "MK_E_CANTOPENFILE", "Moniker cannot open file."); + case 491: return new Code(code, "MK_E_MUSTBOTHERUSER", "User input required for operation to succeed."); + case 492: return new Code(code, "MK_E_NOINVERSE", "Moniker class has no inverse."); + case 493: return new Code(code, "MK_E_NOSTORAGE", "Moniker does not refer to storage."); + case 494: return new Code(code, "MK_E_NOPREFIX", "No common prefix."); + case 495: return new Code(code, "MK_E_ENUMERATION_FAILED", "Moniker could not be enumerated."); + case 496: return new Code(code, "CO_E_NOTINITIALIZED", "CoInitialize has not been called."); + case 497: return new Code(code, "CO_E_ALREADYINITIALIZED", "CoInitialize has already been called."); + case 498: return new Code(code, "CO_E_CANTDETERMINECLASS", "Class of object cannot be determined."); + case 499: return new Code(code, "CO_E_CLASSSTRING", "Invalid class string."); + case 500: return new Code(code, "CO_E_IIDSTRING", "Invalid interface string."); + case 501: return new Code(code, "CO_E_APPNOTFOUND", "Application not found."); + case 502: return new Code(code, "CO_E_APPSINGLEUSE", "Application cannot be run more than once."); + case 503: return new Code(code, "CO_E_ERRORINAPP", "Some error in application."); + case 504: return new Code(code, "CO_E_DLLNOTFOUND", "DLL for class not found."); + case 505: return new Code(code, "CO_E_ERRORINDLL", "Error in the DLL."); + case 506: return new Code(code, "CO_E_WRONGOSFORAPP", "Wrong operating system or operating system version for application."); + case 507: return new Code(code, "CO_E_OBJNOTREG", "Object is not registered."); + case 508: return new Code(code, "CO_E_OBJISREG", "Object is already registered."); + case 509: return new Code(code, "CO_E_OBJNOTCONNECTED", "Object is not connected to server."); + case 510: return new Code(code, "CO_E_APPDIDNTREG", "Application was launched, but it did not register a class factory."); + case 511: return new Code(code, "CO_E_RELEASED", "Object has been released."); + case 513: return new Code(code, "EVENT_E_ALL_SUBSCRIBERS_FAILED", "An event was unable to invoke any of the subscribers."); + case 515: return new Code(code, "EVENT_E_QUERYSYNTAX", "A syntax error occurred trying to evaluate a query string."); + case 516: return new Code(code, "EVENT_E_QUERYFIELD", "An invalid field name was used in a query string."); + case 517: return new Code(code, "EVENT_E_INTERNALEXCEPTION", "An unexpected exception was raised."); + case 518: return new Code(code, "EVENT_E_INTERNALERROR", "An unexpected internal error was detected."); + case 519: return new Code(code, "EVENT_E_INVALID_PER_USER_SID", "The owner security identifier (SID) on a per-user subscription does not exist."); + case 520: return new Code(code, "EVENT_E_USER_EXCEPTION", "A user-supplied component or subscriber raised an exception."); + case 521: return new Code(code, "EVENT_E_TOO_MANY_METHODS", "An interface has too many methods to fire events from."); + case 522: return new Code(code, "EVENT_E_MISSING_EVENTCLASS", "A subscription cannot be stored unless its event class already exists."); + case 523: return new Code(code, "EVENT_E_NOT_ALL_REMOVED", "Not all the objects requested could be removed."); + case 524: return new Code(code, "EVENT_E_COMPLUS_NOT_INSTALLED", "COM+ is required for this operation, but it is not installed."); + case 525: return new Code(code, "EVENT_E_CANT_MODIFY_OR_DELETE_UNCONFIGURED_OBJECT", "Cannot modify or delete an object that was not added using the COM+ Administrative SDK."); + case 526: return new Code(code, "EVENT_E_CANT_MODIFY_OR_DELETE_CONFIGURED_OBJECT", "Cannot modify or delete an object that was added using the COM+ Administrative SDK."); + case 527: return new Code(code, "EVENT_E_INVALID_EVENT_CLASS_PARTITION", "The event class for this subscription is in an invalid partition."); + case 528: return new Code(code, "EVENT_E_PER_USER_SID_NOT_LOGGED_ON", "The owner of the PerUser subscription is not logged on to the system specified."); + case 4873: return new Code(code, "SCHED_E_TRIGGER_NOT_FOUND", "Trigger not found."); + case 4874: return new Code(code, "SCHED_E_TASK_NOT_READY", "One or more of the properties that are needed to run this task have not been set."); + case 4875: return new Code(code, "SCHED_E_TASK_NOT_RUNNING", "There is no running instance of the task."); + case 4876: return new Code(code, "SCHED_E_SERVICE_NOT_INSTALLED", "The Task Scheduler service is not installed on this computer."); + case 4877: return new Code(code, "SCHED_E_CANNOT_OPEN_TASK", "The task object could not be opened."); + case 4878: return new Code(code, "SCHED_E_INVALID_TASK", "The object is either an invalid task object or is not a task object."); + case 4879: return new Code(code, "SCHED_E_ACCOUNT_INFORMATION_NOT_SET", "No account information could be found in the Task Scheduler security database for the task indicated."); + case 4880: return new Code(code, "SCHED_E_ACCOUNT_NAME_NOT_FOUND", "Unable to establish existence of the account specified."); + case 4881: return new Code(code, "SCHED_E_ACCOUNT_DBASE_CORRUPT", "Corruption was detected in the Task Scheduler security database; the database has been reset."); + case 4882: return new Code(code, "SCHED_E_NO_SECURITY_SERVICES", "Task Scheduler security services are available only on Windows NT operating system."); + case 4883: return new Code(code, "SCHED_E_UNKNOWN_OBJECT_VERSION", "The task object version is either unsupported or invalid."); + case 4884: return new Code(code, "SCHED_E_UNSUPPORTED_ACCOUNT_OPTION", "The task has been configured with an unsupported combination of account settings and run-time options."); + case 4885: return new Code(code, "SCHED_E_SERVICE_NOT_RUNNING", "The Task Scheduler service is not running."); + case 4886: return new Code(code, "SCHED_E_UNEXPECTEDNODE", "The task XML contains an unexpected node."); + case 4887: return new Code(code, "SCHED_E_NAMESPACE", "The task XML contains an element or attribute from an unexpected namespace."); + case 4888: return new Code(code, "SCHED_E_INVALIDVALUE", "The task XML contains a value that is incorrectly formatted or out of range."); + case 4889: return new Code(code, "SCHED_E_MISSINGNODE", "The task XML is missing a required element or attribute."); + case 4890: return new Code(code, "SCHED_E_MALFORMEDXML", "The task XML is malformed."); + case 4893: return new Code(code, "SCHED_E_TOO_MANY_NODES", "The task XML contains too many nodes of the same type."); + case 4894: return new Code(code, "SCHED_E_PAST_END_BOUNDARY", "The task cannot be started after the trigger's end boundary."); + case 4895: return new Code(code, "SCHED_E_ALREADY_RUNNING", "An instance of this task is already running."); + case 4896: return new Code(code, "SCHED_E_USER_NOT_LOGGED_ON", "The task will not run because the user is not logged on."); + case 4897: return new Code(code, "SCHED_E_INVALID_TASK_HASH", "The task image is corrupt or has been tampered with."); + case 4898: return new Code(code, "SCHED_E_SERVICE_NOT_AVAILABLE", "The Task Scheduler service is not available."); + case 4899: return new Code(code, "SCHED_E_SERVICE_TOO_BUSY", "The Task Scheduler service is too busy to handle your request. Try again later."); + case 4900: return new Code(code, "SCHED_E_TASK_ATTEMPTED", "The Task Scheduler service attempted to run the task, but the task did not run due to one of the constraints in the task definition."); + case 53248: return new Code(code, "XACT_E_ALREADYOTHERSINGLEPHASE", "Another single phase resource manager has already been enlisted in this transaction."); + case 53249: return new Code(code, "XACT_E_CANTRETAIN", "A retaining commit or abort is not supported."); + case 53250: return new Code(code, "XACT_E_COMMITFAILED", "The transaction failed to commit for an unknown reason. The transaction was aborted."); + case 53251: return new Code(code, "XACT_E_COMMITPREVENTED", "Cannot call commit on this transaction object because the calling application did not initiate the transaction."); + case 53252: return new Code(code, "XACT_E_HEURISTICABORT", "Instead of committing, the resource heuristically aborted."); + case 53253: return new Code(code, "XACT_E_HEURISTICCOMMIT", "Instead of aborting, the resource heuristically committed."); + case 53254: return new Code(code, "XACT_E_HEURISTICDAMAGE", "Some of the states of the resource were committed while others were aborted, likely because of heuristic decisions."); + case 53255: return new Code(code, "XACT_E_HEURISTICDANGER", "Some of the states of the resource might have been committed while others were aborted, likely because of heuristic decisions."); + case 53256: return new Code(code, "XACT_E_ISOLATIONLEVEL", "The requested isolation level is not valid or supported."); + case 53257: return new Code(code, "XACT_E_NOASYNC", "The transaction manager does not support an asynchronous operation for this method."); + case 53258: return new Code(code, "XACT_E_NOENLIST", "Unable to enlist in the transaction."); + case 53259: return new Code(code, "XACT_E_NOISORETAIN", "The requested semantics of retention of isolation across retaining commit and abort boundaries cannot be supported by this transaction implementation, or isoFlags was not equal to 0."); + case 53260: return new Code(code, "XACT_E_NORESOURCE", "There is no resource presently associated with this enlistment."); + case 53261: return new Code(code, "XACT_E_NOTCURRENT", "The transaction failed to commit due to the failure of optimistic concurrency control in at least one of the resource managers."); + case 53262: return new Code(code, "XACT_E_NOTRANSACTION", "The transaction has already been implicitly or explicitly committed or aborted."); + case 53263: return new Code(code, "XACT_E_NOTSUPPORTED", "An invalid combination of flags was specified."); + case 53264: return new Code(code, "XACT_E_UNKNOWNRMGRID", "The resource manager ID is not associated with this transaction or the transaction manager."); + case 53265: return new Code(code, "XACT_E_WRONGSTATE", "This method was called in the wrong state."); + case 53266: return new Code(code, "XACT_E_WRONGUOW", "The indicated unit of work does not match the unit of work expected by the resource manager."); + case 53267: return new Code(code, "XACT_E_XTIONEXISTS", "An enlistment in a transaction already exists."); + case 53268: return new Code(code, "XACT_E_NOIMPORTOBJECT", "An import object for the transaction could not be found."); + case 53269: return new Code(code, "XACT_E_INVALIDCOOKIE", "The transaction cookie is invalid."); + case 53270: return new Code(code, "XACT_E_INDOUBT", "The transaction status is in doubt. A communication failure occurred, or a transaction manager or resource manager has failed."); + case 53271: return new Code(code, "XACT_E_NOTIMEOUT", "A time-out was specified, but time-outs are not supported."); + case 53272: return new Code(code, "XACT_E_ALREADYINPROGRESS", "The requested operation is already in progress for the transaction."); + case 53273: return new Code(code, "XACT_E_ABORTED", "The transaction has already been aborted."); + case 53274: return new Code(code, "XACT_E_LOGFULL", "The Transaction Manager returned a log full error."); + case 53275: return new Code(code, "XACT_E_TMNOTAVAILABLE", "The transaction manager is not available."); + case 53276: return new Code(code, "XACT_E_CONNECTION_DOWN", "A connection with the transaction manager was lost."); + case 53277: return new Code(code, "XACT_E_CONNECTION_DENIED", "A request to establish a connection with the transaction manager was denied."); + case 53278: return new Code(code, "XACT_E_REENLISTTIMEOUT", "Resource manager reenlistment to determine transaction status timed out."); + case 53279: return new Code(code, "XACT_E_TIP_CONNECT_FAILED", "The transaction manager failed to establish a connection with another Transaction Internet Protocol (TIP) transaction manager."); + case 53280: return new Code(code, "XACT_E_TIP_PROTOCOL_ERROR", "The transaction manager encountered a protocol error with another TIP transaction manager."); + case 53281: return new Code(code, "XACT_E_TIP_PULL_FAILED", "The transaction manager could not propagate a transaction from another TIP transaction manager."); + case 53282: return new Code(code, "XACT_E_DEST_TMNOTAVAILABLE", "The transaction manager on the destination machine is not available."); + case 53283: return new Code(code, "XACT_E_TIP_DISABLED", "The transaction manager has disabled its support for TIP."); + case 53284: return new Code(code, "XACT_E_NETWORK_TX_DISABLED", "The transaction manager has disabled its support for remote or network transactions."); + case 53285: return new Code(code, "XACT_E_PARTNER_NETWORK_TX_DISABLED", "The partner transaction manager has disabled its support for remote or network transactions."); + case 53286: return new Code(code, "XACT_E_XA_TX_DISABLED", "The transaction manager has disabled its support for XA transactions."); + case 53287: return new Code(code, "XACT_E_UNABLE_TO_READ_DTC_CONFIG", "Microsoft Distributed Transaction Coordinator (MSDTC) was unable to read its configuration information."); + case 53288: return new Code(code, "XACT_E_UNABLE_TO_LOAD_DTC_PROXY", "MSDTC was unable to load the DTC proxy DLL."); + case 53289: return new Code(code, "XACT_E_ABORTING", "The local transaction has aborted."); + case 53376: return new Code(code, "XACT_E_CLERKNOTFOUND", "The specified CRM clerk was not found. It might have completed before it could be held."); + case 53377: return new Code(code, "XACT_E_CLERKEXISTS", "The specified CRM clerk does not exist."); + case 53378: return new Code(code, "XACT_E_RECOVERYINPROGRESS", "Recovery of the CRM log file is still in progress."); + case 53379: return new Code(code, "XACT_E_TRANSACTIONCLOSED", "The transaction has completed, and the log records have been discarded from the log file. They are no longer available."); + case 53380: return new Code(code, "XACT_E_INVALIDLSN", "lsnToRead is outside of the current limits of the log"); + case 53381: return new Code(code, "XACT_E_REPLAYREQUEST", "The COM+ Compensating Resource Manager has records it wishes to replay."); + case 53504: return new Code(code, "XACT_E_CONNECTION_REQUEST_DENIED", "The request to connect to the specified transaction coordinator was denied."); + case 53505: return new Code(code, "XACT_E_TOOMANY_ENLISTMENTS", "The maximum number of enlistments for the specified transaction has been reached."); + case 53506: return new Code(code, "XACT_E_DUPLICATE_GUID", "A resource manager with the same identifier is already registered with the specified transaction coordinator."); + case 53507: return new Code(code, "XACT_E_NOTSINGLEPHASE", "The prepare request given was not eligible for single-phase optimizations."); + case 53508: return new Code(code, "XACT_E_RECOVERYALREADYDONE", "RecoveryComplete has already been called for the given resource manager."); + case 53509: return new Code(code, "XACT_E_PROTOCOL", "The interface call made was incorrect for the current state of the protocol."); + case 53510: return new Code(code, "XACT_E_RM_FAILURE", "The xa_open call failed for the XA resource."); + case 53511: return new Code(code, "XACT_E_RECOVERY_FAILED", "The xa_recover call failed for the XA resource."); + case 53512: return new Code(code, "XACT_E_LU_NOT_FOUND", "The logical unit of work specified cannot be found."); + case 53513: return new Code(code, "XACT_E_DUPLICATE_LU", "The specified logical unit of work already exists."); + case 53514: return new Code(code, "XACT_E_LU_NOT_CONNECTED", "Subordinate creation failed. The specified logical unit of work was not connected."); + case 53515: return new Code(code, "XACT_E_DUPLICATE_TRANSID", "A transaction with the given identifier already exists."); + case 53516: return new Code(code, "XACT_E_LU_BUSY", "The resource is in use."); + case 53517: return new Code(code, "XACT_E_LU_NO_RECOVERY_PROCESS", "The LU Recovery process is down."); + case 53518: return new Code(code, "XACT_E_LU_DOWN", "The remote session was lost."); + case 53519: return new Code(code, "XACT_E_LU_RECOVERING", "The resource is currently recovering."); + case 53520: return new Code(code, "XACT_E_LU_RECOVERY_MISMATCH", "There was a mismatch in driving recovery."); + case 53521: return new Code(code, "XACT_E_RM_UNAVAILABLE", "An error occurred with the XA resource."); + case 57346: return new Code(code, "CONTEXT_E_ABORTED", "The root transaction wanted to commit, but the transaction aborted."); + case 57347: return new Code(code, "CONTEXT_E_ABORTING", "The COM+ component on which the method call was made has a transaction that has already aborted or is in the process of aborting."); + case 57348: return new Code(code, "CONTEXT_E_NOCONTEXT", "There is no Microsoft Transaction Server (MTS) object context."); + case 57349: return new Code(code, "CONTEXT_E_WOULD_DEADLOCK", "The component is configured to use synchronization, and this method call would cause a deadlock to occur."); + case 57350: return new Code(code, "CONTEXT_E_SYNCH_TIMEOUT", "The component is configured to use synchronization, and a thread has timed out waiting to enter the context."); + case 57351: return new Code(code, "CONTEXT_E_OLDREF", "You made a method call on a COM+ component that has a transaction that has already committed or aborted."); + case 57356: return new Code(code, "CONTEXT_E_ROLENOTFOUND", "The specified role was not configured for the application."); + case 57359: return new Code(code, "CONTEXT_E_TMNOTAVAILABLE", "COM+ was unable to talk to the MSDTC."); + case 57377: return new Code(code, "CO_E_ACTIVATIONFAILED", "An unexpected error occurred during COM+ activation."); + case 57378: return new Code(code, "CO_E_ACTIVATIONFAILED_EVENTLOGGED", "COM+ activation failed. Check the event log for more information."); + case 57379: return new Code(code, "CO_E_ACTIVATIONFAILED_CATALOGERROR", "COM+ activation failed due to a catalog or configuration error."); + case 57380: return new Code(code, "CO_E_ACTIVATIONFAILED_TIMEOUT", "COM+ activation failed because the activation could not be completed in the specified amount of time."); + case 57381: return new Code(code, "CO_E_INITIALIZATIONFAILED", "COM+ activation failed because an initialization function failed. Check the event log for more information."); + case 57382: return new Code(code, "CONTEXT_E_NOJIT", "The requested operation requires that just-in-time (JIT) be in the current context, and it is not."); + case 57383: return new Code(code, "CONTEXT_E_NOTRANSACTION", "The requested operation requires that the current context have a transaction, and it does not."); + case 57384: return new Code(code, "CO_E_THREADINGMODEL_CHANGED", "The components threading model has changed after install into a COM+ application. Re-install component."); + case 57385: return new Code(code, "CO_E_NOIISINTRINSICS", "Internet Information Services (IIS) intrinsics not available. Start your work with IIS."); + case 57386: return new Code(code, "CO_E_NOCOOKIES", "An attempt to write a cookie failed."); + case 57387: return new Code(code, "CO_E_DBERROR", "An attempt to use a database generated a database-specific error."); + case 57388: return new Code(code, "CO_E_NOTPOOLED", "The COM+ component you created must use object pooling to work."); + case 57389: return new Code(code, "CO_E_NOTCONSTRUCTED", "The COM+ component you created must use object construction to work correctly."); + case 57390: return new Code(code, "CO_E_NOSYNCHRONIZATION", "The COM+ component requires synchronization, and it is not configured for it."); + case 57391: return new Code(code, "CO_E_ISOLEVELMISMATCH", "The TxIsolation Level property for the COM+ component being created is stronger than the TxIsolationLevel for the root."); + case 57392: return new Code(code, "CO_E_CALL_OUT_OF_TX_SCOPE_NOT_ALLOWED", "The component attempted to make a cross-context call between invocations of EnterTransactionScope and ExitTransactionScope. This is not allowed. Cross-context calls cannot be made while inside a transaction scope."); + case 57393: return new Code(code, "CO_E_EXIT_TRANSACTION_SCOPE_NOT_CALLED", "The component made a call to EnterTransactionScope, but did not make a corresponding call to ExitTransactionScope before returning."); + } + } + else + { + switch (code) + { + case 0: return new Code(code, "OLE_S_USEREG", "Use the registry database to provide the requested information."); + case 1: return new Code(code, "OLE_S_STATIC", "Success, but static."); + case 2: return new Code(code, "OLE_S_MAC_CLIPFORMAT", "Macintosh clipboard format."); + case 256: return new Code(code, "DRAGDROP_S_DROP", "Successful drop took place."); + case 257: return new Code(code, "DRAGDROP_S_CANCEL", "Drag-drop operation canceled."); + case 258: return new Code(code, "DRAGDROP_S_USEDEFAULTCURSORS", "Use the default cursor."); + case 304: return new Code(code, "DATA_S_SAMEFORMATETC", "Data has same FORMATETC."); + case 320: return new Code(code, "VIEW_S_ALREADY_FROZEN", "View is already frozen."); + case 368: return new Code(code, "CACHE_S_FORMATETC_NOTSUPPORTED", "FORMATETC not supported."); + case 369: return new Code(code, "CACHE_S_SAMECACHE", "Same cache."); + case 370: return new Code(code, "CACHE_S_SOMECACHES_NOTUPDATED", "Some caches are not updated."); + case 384: return new Code(code, "OLEOBJ_S_INVALIDVERB", "Invalid verb for OLE object."); + case 385: return new Code(code, "OLEOBJ_S_CANNOT_DOVERB_NOW", "Verb number is valid but verb cannot be done now."); + case 386: return new Code(code, "OLEOBJ_S_INVALIDHWND", "Invalid window handle passed."); + case 416: return new Code(code, "INPLACE_S_TRUNCATED", "Message is too long; some of it had to be truncated before displaying."); + case 448: return new Code(code, "CONVERT10_S_NO_PRESENTATION", "Unable to convert OLESTREAM to IStorage."); + case 482: return new Code(code, "MK_S_REDUCED_TO_SELF", "Moniker reduced to itself."); + case 484: return new Code(code, "MK_S_ME", "Common prefix is this moniker."); + case 485: return new Code(code, "MK_S_HIM", "Common prefix is input moniker."); + case 486: return new Code(code, "MK_S_US", "Common prefix is both monikers."); + case 487: return new Code(code, "MK_S_MONIKERALREADYREGISTERED", "Moniker is already registered in running object table."); + case 512: return new Code(code, "EVENT_S_SOME_SUBSCRIBERS_FAILED", "An event was able to invoke some, but not all, of the subscribers."); + case 514: return new Code(code, "EVENT_S_NOSUBSCRIBERS", "An event was delivered, but there were no subscribers."); + case 4864: return new Code(code, "SCHED_S_TASK_READY", "The task is ready to run at its next scheduled time."); + case 4865: return new Code(code, "SCHED_S_TASK_RUNNING", "The task is currently running."); + case 4866: return new Code(code, "SCHED_S_TASK_DISABLED", "The task will not run at the scheduled times because it has been disabled."); + case 4867: return new Code(code, "SCHED_S_TASK_HAS_NOT_RUN", "The task has not yet run."); + case 4868: return new Code(code, "SCHED_S_TASK_NO_MORE_RUNS", "There are no more runs scheduled for this task."); + case 4869: return new Code(code, "SCHED_S_TASK_NOT_SCHEDULED", "One or more of the properties that are needed to run this task on a schedule have not been set."); + case 4870: return new Code(code, "SCHED_S_TASK_TERMINATED", "The last run of the task was terminated by the user."); + case 4871: return new Code(code, "SCHED_S_TASK_NO_VALID_TRIGGERS", "Either the task has no triggers, or the existing triggers are disabled or not set."); + case 4872: return new Code(code, "SCHED_S_EVENT_TRIGGER", "Event triggers do not have set run times."); + case 4891: return new Code(code, "SCHED_S_SOME_TRIGGERS_FAILED", "The task is registered, but not all specified triggers will start the task."); + case 4892: return new Code(code, "SCHED_S_BATCH_LOGON_PROBLEM", "The task is registered, but it might fail to start. Batch logon privilege needs to be enabled for the task principal."); + case 53248: return new Code(code, "XACT_S_ASYNC", "An asynchronous operation was specified. The operation has begun, but its outcome is not known yet."); + case 53250: return new Code(code, "XACT_S_READONLY", "The method call succeeded because the transaction was read-only."); + case 53251: return new Code(code, "XACT_S_SOMENORETAIN", "The transaction was successfully aborted. However, this is a coordinated transaction, and a number of enlisted resources were aborted outright because they could not support abort-retaining semantics."); + case 53252: return new Code(code, "XACT_S_OKINFORM", "No changes were made during this call, but the sink wants another chance to look if any other sinks make further changes."); + case 53253: return new Code(code, "XACT_S_MADECHANGESCONTENT", "The sink is content and wants the transaction to proceed. Changes were made to one or more resources during this call."); + case 53254: return new Code(code, "XACT_S_MADECHANGESINFORM", "The sink is for the moment and wants the transaction to proceed, but if other changes are made following this return by other event sinks, this sink wants another chance to look."); + case 53255: return new Code(code, "XACT_S_ALLNORETAIN", "The transaction was successfully aborted. However, the abort was nonretaining."); + case 53256: return new Code(code, "XACT_S_ABORTING", "An abort operation was already in progress."); + case 53257: return new Code(code, "XACT_S_SINGLEPHASE", "The resource manager has performed a single-phase commit of the transaction."); + case 53258: return new Code(code, "XACT_S_LOCALLY_OK", "The local transaction has not aborted."); + case 53264: return new Code(code, "XACT_S_LASTRESOURCEMANAGER", "The resource manager has requested to be the coordinator (last resource manager) for the transaction."); + } + } + + return Unknown(code); + } + } +} diff --git a/src/Elmah.Io.HResults/Facilities/FacilityMediaserverResolver.cs b/src/Elmah.Io.HResults/Facilities/FacilityMediaserverResolver.cs new file mode 100644 index 0000000..3558c0e --- /dev/null +++ b/src/Elmah.Io.HResults/Facilities/FacilityMediaserverResolver.cs @@ -0,0 +1,82 @@ +namespace Elmah.Io.HResults.Facilities +{ + internal class FacilityMediaserverResolver : FacilityResolverBase + { + public FacilityMediaserverResolver() : base(13, "FACILITY_MEDIASERVER") + { + } + + internal override Code Resolve(bool failure, int code) + { + if (failure) + { + switch (code) + { + case 3: return new Code(code, "NS_W_SERVER_BANDWIDTH_LIMIT", "The maximum filebitrate value specified is greater than the server's configured maximum bandwidth."); + case 4: return new Code(code, "NS_W_FILE_BANDWIDTH_LIMIT", "The maximum bandwidth value specified is less than the maximum filebitrate."); + case 96: return new Code(code, "NS_W_UNKNOWN_EVENT", "Unknown %1 event encountered."); + case 409: return new Code(code, "NS_I_CATATONIC_FAILURE", "Disk %1 ( %2 ) on Content Server %3, will be failed because it is catatonic."); + case 410: return new Code(code, "NS_I_CATATONIC_AUTO_UNFAIL", "Disk %1 ( %2 ) on Content Server %3, auto online from catatonic state."); + } + } + else + { + switch (code) + { + case 0: return new Code(code, "NS_S_CALLPENDING", "The requested operation is pending completion."); + case 1: return new Code(code, "NS_S_CALLABORTED", "The requested operation was aborted by the client."); + case 2: return new Code(code, "NS_S_STREAM_TRUNCATED", "The stream was purposefully stopped before completion."); + case 3016: return new Code(code, "NS_S_REBUFFERING", "The requested operation has caused the source to rebuffer."); + case 3017: return new Code(code, "NS_S_DEGRADING_QUALITY", "The requested operation has caused the source to degrade codec quality."); + case 3035: return new Code(code, "NS_S_TRANSCRYPTOR_EOF", "The transcryptor object has reached end of file."); + case 4072: return new Code(code, "NS_S_WMP_UI_VERSIONMISMATCH", "An upgrade is needed for the theme manager to correctly show this skin. Skin reports version: %.1f."); + case 4073: return new Code(code, "NS_S_WMP_EXCEPTION", "An error occurred in one of the UI components."); + case 4160: return new Code(code, "NS_S_WMP_LOADED_GIF_IMAGE", "Successfully loaded a GIF file."); + case 4161: return new Code(code, "NS_S_WMP_LOADED_PNG_IMAGE", "Successfully loaded a PNG file."); + case 4162: return new Code(code, "NS_S_WMP_LOADED_BMP_IMAGE", "Successfully loaded a BMP file."); + case 4163: return new Code(code, "NS_S_WMP_LOADED_JPG_IMAGE", "Successfully loaded a JPG file."); + case 4175: return new Code(code, "NS_S_WMG_FORCE_DROP_FRAME", "Drop this frame."); + case 4191: return new Code(code, "NS_S_WMR_ALREADYRENDERED", "The specified stream has already been rendered."); + case 4192: return new Code(code, "NS_S_WMR_PINTYPEPARTIALMATCH", "The specified type partially matches this pin type."); + case 4193: return new Code(code, "NS_S_WMR_PINTYPEFULLMATCH", "The specified type fully matches this pin type."); + case 4198: return new Code(code, "NS_S_WMG_ADVISE_DROP_FRAME", "The timestamp is late compared to the current render position. Advise dropping this frame."); + case 4199: return new Code(code, "NS_S_WMG_ADVISE_DROP_TO_KEYFRAME", "The timestamp is severely late compared to the current render position. Advise dropping everything up to the next key frame."); + case 4315: return new Code(code, "NS_S_NEED_TO_BUY_BURN_RIGHTS", "No burn rights. You will be prompted to buy burn rights when you try to burn this file to an audio CD."); + case 4350: return new Code(code, "NS_S_WMPCORE_PLAYLISTCLEARABORT", "Failed to clear playlist because it was aborted by user."); + case 4351: return new Code(code, "NS_S_WMPCORE_PLAYLISTREMOVEITEMABORT", "Failed to remove item in the playlist since it was aborted by user."); + case 4354: return new Code(code, "NS_S_WMPCORE_PLAYLIST_CREATION_PENDING", "Playlist is being generated asynchronously."); + case 4355: return new Code(code, "NS_S_WMPCORE_MEDIA_VALIDATION_PENDING", "Validation of the media is pending."); + case 4356: return new Code(code, "NS_S_WMPCORE_PLAYLIST_REPEAT_SECONDARY_SEGMENTS_IGNORED", "Encountered more than one Repeat block during ASX processing."); + case 4357: return new Code(code, "NS_S_WMPCORE_COMMAND_NOT_AVAILABLE", "Current state of WMP disallows calling this method or property."); + case 4358: return new Code(code, "NS_S_WMPCORE_PLAYLIST_NAME_AUTO_GENERATED", "Name for the playlist has been auto generated."); + case 4359: return new Code(code, "NS_S_WMPCORE_PLAYLIST_IMPORT_MISSING_ITEMS", "The imported playlist does not contain all items from the original."); + case 4360: return new Code(code, "NS_S_WMPCORE_PLAYLIST_COLLAPSED_TO_SINGLE_MEDIA", "The M3U playlist has been ignored because it only contains one item."); + case 4361: return new Code(code, "NS_S_WMPCORE_MEDIA_CHILD_PLAYLIST_OPEN_PENDING", "The open for the child playlist associated with this media is pending."); + case 4362: return new Code(code, "NS_S_WMPCORE_MORE_NODES_AVAIABLE", "More nodes support the interface requested, but the array for returning them is full."); + case 4405: return new Code(code, "NS_S_WMPBR_SUCCESS", "Backup or Restore successful!."); + case 4406: return new Code(code, "NS_S_WMPBR_PARTIALSUCCESS", "Transfer complete with limitations."); + case 4420: return new Code(code, "NS_S_WMPEFFECT_TRANSPARENT", "Request to the effects control to change transparency status to transparent."); + case 4421: return new Code(code, "NS_S_WMPEFFECT_OPAQUE", "Request to the effects control to change transparency status to opaque."); + case 4430: return new Code(code, "NS_S_OPERATION_PENDING", "The requested application pane is performing an operation and will not be released."); + case 4953: return new Code(code, "NS_S_TRACK_BUY_REQUIRES_ALBUM_PURCHASE", "The file is only available for purchase when you buy the entire album."); + case 4958: return new Code(code, "NS_S_NAVIGATION_COMPLETE_WITH_ERRORS", "There were problems completing the requested navigation. There are identifiers missing in the catalog."); + case 4961: return new Code(code, "NS_S_TRACK_ALREADY_DOWNLOADED", "Track already downloaded."); + case 5401: return new Code(code, "NS_S_PUBLISHING_POINT_STARTED_WITH_FAILED_SINKS", "The publishing point successfully started, but one or more of the requested data writer plug-ins failed."); + case 10022: return new Code(code, "NS_S_DRM_LICENSE_ACQUIRED", "Status message: The license was acquired."); + case 10023: return new Code(code, "NS_S_DRM_INDIVIDUALIZED", "Status message: The security upgrade has been completed."); + case 10054: return new Code(code, "NS_S_DRM_MONITOR_CANCELLED", "Status message: License monitoring has been canceled."); + case 10055: return new Code(code, "NS_S_DRM_ACQUIRE_CANCELLED", "Status message: License acquisition has been canceled."); + case 10094: return new Code(code, "NS_S_DRM_BURNABLE_TRACK", "The track is burnable and had no playlist burn limit."); + case 10095: return new Code(code, "NS_S_DRM_BURNABLE_TRACK_WITH_PLAYLIST_RESTRICTION", "The track is burnable but has a playlist burn limit."); + case 10206: return new Code(code, "NS_S_DRM_NEEDS_INDIVIDUALIZATION", "A security upgrade is required to perform the operation on this media file."); + case 11000: return new Code(code, "NS_S_REBOOT_RECOMMENDED", "Installation was successful; however, some file cleanup is not complete. For best results, restart your computer."); + case 11001: return new Code(code, "NS_S_REBOOT_REQUIRED", "Installation was successful; however, some file cleanup is not complete. To continue, you must restart your computer."); + case 12041: return new Code(code, "NS_S_EOSRECEDING", "EOS hit during rewinding."); + case 12045: return new Code(code, "NS_S_CHANGENOTICE", "Internal."); + } + } + + return Unknown(code); + } + } +} diff --git a/src/Elmah.Io.HResults/Facilities/FacilityNdisResolver.cs b/src/Elmah.Io.HResults/Facilities/FacilityNdisResolver.cs new file mode 100644 index 0000000..acdc3c9 --- /dev/null +++ b/src/Elmah.Io.HResults/Facilities/FacilityNdisResolver.cs @@ -0,0 +1,64 @@ +namespace Elmah.Io.HResults.Facilities +{ + internal class FacilityNdisResolver : FacilityResolverBase + { + public FacilityNdisResolver() : base(52, "FACILITY_NDIS") + { + } + + internal override Code Resolve(bool failure, int code) + { + if (failure) + { + switch (code) + { + case 2: return new Code(code, "ERROR_NDIS_INTERFACE_CLOSING", "The binding to the network interface is being closed."); + case 4: return new Code(code, "ERROR_NDIS_BAD_VERSION", "An invalid version was specified."); + case 5: return new Code(code, "ERROR_NDIS_BAD_CHARACTERISTICS", "An invalid characteristics table was used."); + case 6: return new Code(code, "ERROR_NDIS_ADAPTER_NOT_FOUND", "Failed to find the network interface, or the network interface is not ready."); + case 7: return new Code(code, "ERROR_NDIS_OPEN_FAILED", "Failed to open the network interface."); + case 8: return new Code(code, "ERROR_NDIS_DEVICE_FAILED", "The network interface has encountered an internal unrecoverable failure."); + case 9: return new Code(code, "ERROR_NDIS_MULTICAST_FULL", "The multicast list on the network interface is full."); + case 10: return new Code(code, "ERROR_NDIS_MULTICAST_EXISTS", "An attempt was made to add a duplicate multicast address to the list."); + case 11: return new Code(code, "ERROR_NDIS_MULTICAST_NOT_FOUND", "At attempt was made to remove a multicast address that was never added."); + case 12: return new Code(code, "ERROR_NDIS_REQUEST_ABORTED", "The network interface aborted the request."); + case 13: return new Code(code, "ERROR_NDIS_RESET_IN_PROGRESS", "The network interface cannot process the request because it is being reset."); + case 15: return new Code(code, "ERROR_NDIS_INVALID_PACKET", "An attempt was made to send an invalid packet on a network interface."); + case 16: return new Code(code, "ERROR_NDIS_INVALID_DEVICE_REQUEST", "The specified request is not a valid operation for the target device."); + case 17: return new Code(code, "ERROR_NDIS_ADAPTER_NOT_READY", "The network interface is not ready to complete this operation."); + case 20: return new Code(code, "ERROR_NDIS_INVALID_LENGTH", "The length of the buffer submitted for this operation is not valid."); + case 21: return new Code(code, "ERROR_NDIS_INVALID_DATA", "The data used for this operation is not valid."); + case 22: return new Code(code, "ERROR_NDIS_BUFFER_TOO_SHORT", "The length of the buffer submitted for this operation is too small."); + case 23: return new Code(code, "ERROR_NDIS_INVALID_OID", "The network interface does not support this OID."); + case 24: return new Code(code, "ERROR_NDIS_ADAPTER_REMOVED", "The network interface has been removed."); + case 25: return new Code(code, "ERROR_NDIS_UNSUPPORTED_MEDIA", "The network interface does not support this media type."); + case 26: return new Code(code, "ERROR_NDIS_GROUP_ADDRESS_IN_USE", "An attempt was made to remove a token ring group address that is in use by other components."); + case 27: return new Code(code, "ERROR_NDIS_FILE_NOT_FOUND", "An attempt was made to map a file that cannot be found."); + case 28: return new Code(code, "ERROR_NDIS_ERROR_READING_FILE", "An error occurred while the NDIS tried to map the file."); + case 29: return new Code(code, "ERROR_NDIS_ALREADY_MAPPED", "An attempt was made to map a file that is already mapped."); + case 30: return new Code(code, "ERROR_NDIS_RESOURCE_CONFLICT", "An attempt to allocate a hardware resource failed because the resource is used by another component."); + case 31: return new Code(code, "ERROR_NDIS_MEDIA_DISCONNECTED", "The I/O operation failed because network media is disconnected or the wireless access point is out of range."); + case 34: return new Code(code, "ERROR_NDIS_INVALID_ADDRESS", "The network address used in the request is invalid."); + case 42: return new Code(code, "ERROR_NDIS_PAUSED", "The offload operation on the network interface has been paused."); + case 43: return new Code(code, "ERROR_NDIS_INTERFACE_NOT_FOUND", "The network interface was not found."); + case 44: return new Code(code, "ERROR_NDIS_UNSUPPORTED_REVISION", "The revision number specified in the structure is not supported."); + case 45: return new Code(code, "ERROR_NDIS_INVALID_PORT", "The specified port does not exist on this network interface."); + case 46: return new Code(code, "ERROR_NDIS_INVALID_PORT_STATE", "The current state of the specified port on this network interface does not support the requested operation."); + case 187: return new Code(code, "ERROR_NDIS_NOT_SUPPORTED", "The network interface does not support this request."); + case 8192: return new Code(code, "ERROR_NDIS_DOT11_AUTO_CONFIG_ENABLED", "The wireless local area network (LAN) interface is in auto-configuration mode and does not support the requested parameter change operation."); + case 8193: return new Code(code, "ERROR_NDIS_DOT11_MEDIA_IN_USE", "The wireless LAN interface is busy and cannot perform the requested operation."); + case 8194: return new Code(code, "ERROR_NDIS_DOT11_POWER_STATE_INVALID", "The wireless LAN interface is shutting down and does not support the requested operation."); + } + } + else + { + switch (code) + { + case 1: return new Code(code, "ERROR_NDIS_INDICATION_REQUIRED", "The request will be completed later by a Network Driver Interface Specification (NDIS) status indication."); + } + } + + return Unknown(code); + } + } +} diff --git a/src/Elmah.Io.HResults/Facilities/FacilityNullResolver.cs b/src/Elmah.Io.HResults/Facilities/FacilityNullResolver.cs new file mode 100644 index 0000000..e796fa7 --- /dev/null +++ b/src/Elmah.Io.HResults/Facilities/FacilityNullResolver.cs @@ -0,0 +1,20 @@ +namespace Elmah.Io.HResults.Facilities +{ + internal class FacilityNullResolver : FacilityResolverBase + { + public FacilityNullResolver() : base(0, "FACILITY_NULL") + { + } + + internal override Code Resolve(bool failure, int code) + { + return code switch + { + 1 => new Code(code, "ERROR_AUDITING_DISABLED", "The specified event is currently not being audited."), + 2 => new Code(code, "ERROR_ALL_SIDS_FILTERED", "The SID filtering operation removed all SIDs."), + 3 => new Code(code, "ERROR_BIZRULES_NOT_ENABLED", "Business rule scripts are disabled for the calling application."), + _ => Unknown(code), + }; + } + } +} diff --git a/src/Elmah.Io.HResults/Facilities/FacilityPlaResolver.cs b/src/Elmah.Io.HResults/Facilities/FacilityPlaResolver.cs new file mode 100644 index 0000000..8bd52c9 --- /dev/null +++ b/src/Elmah.Io.HResults/Facilities/FacilityPlaResolver.cs @@ -0,0 +1,50 @@ +namespace Elmah.Io.HResults.Facilities +{ + internal class FacilityPlaResolver : FacilityResolverBase + { + public FacilityPlaResolver() : base(48, "FACILITY_PLA") + { + } + + internal override Code Resolve(bool failure, int code) + { + if (failure) + { + switch (code) + { + case 2: return new Code(code, "PLA_E_DCS_NOT_FOUND", "A Data Collector Set was not found."); + case 69: return new Code(code, "PLA_E_TOO_MANY_FOLDERS", "Unable to start Data Collector Set because there are too many folders."); + case 112: return new Code(code, "PLA_E_NO_MIN_DISK", "Not enough free disk space to start Data Collector Set."); + case 170: return new Code(code, "PLA_E_DCS_IN_USE", "Data Collector Set is in use."); + case 183: return new Code(code, "PLA_E_DCS_ALREADY_EXISTS", "Data Collector Set already exists."); + case 257: return new Code(code, "PLA_E_PROPERTY_CONFLICT", "Property value conflict."); + case 258: return new Code(code, "PLA_E_DCS_SINGLETON_REQUIRED", "The current configuration for this Data Collector Set requires that it contain exactly one Data Collector."); + case 259: return new Code(code, "PLA_E_CREDENTIALS_REQUIRED", "A user account is required to commit the current Data Collector Set properties."); + case 260: return new Code(code, "PLA_E_DCS_NOT_RUNNING", "Data Collector Set is not running."); + case 261: return new Code(code, "PLA_E_CONFLICT_INCL_EXCL_API", "A conflict was detected in the list of include and exclude APIs. Do not specify the same API in both the include list and the exclude list."); + case 262: return new Code(code, "PLA_E_NETWORK_EXE_NOT_VALID", "The executable path specified refers to a network share or UNC path."); + case 263: return new Code(code, "PLA_E_EXE_ALREADY_CONFIGURED", "The executable path specified is already configured for API tracing."); + case 264: return new Code(code, "PLA_E_EXE_PATH_NOT_VALID", "The executable path specified does not exist. Verify that the specified path is correct."); + case 265: return new Code(code, "PLA_E_DC_ALREADY_EXISTS", "Data Collector already exists."); + case 266: return new Code(code, "PLA_E_DCS_START_WAIT_TIMEOUT", "The wait for the Data Collector Set start notification has timed out."); + case 267: return new Code(code, "PLA_E_DC_START_WAIT_TIMEOUT", "The wait for the Data Collector to start has timed out."); + case 268: return new Code(code, "PLA_E_REPORT_WAIT_TIMEOUT", "The wait for the report generation tool to finish has timed out."); + case 269: return new Code(code, "PLA_E_NO_DUPLICATES", "Duplicate items are not allowed."); + case 270: return new Code(code, "PLA_E_EXE_FULL_PATH_REQUIRED", "When specifying the executable to trace, you must specify a full path to the executable and not just a file name."); + case 271: return new Code(code, "PLA_E_INVALID_SESSION_NAME", "The session name provided is invalid."); + case 272: return new Code(code, "PLA_E_PLA_CHANNEL_NOT_ENABLED", "The Event Log channel Microsoft-Windows-Diagnosis-PLA/Operational must be enabled to perform this operation."); + case 273: return new Code(code, "PLA_E_TASKSCHED_CHANNEL_NOT_ENABLED", "The Event Log channel Microsoft-Windows-TaskScheduler must be enabled to perform this operation."); + } + } + else + { + switch (code) + { + case 256: return new Code(code, "PLA_S_PROPERTY_IGNORED", "Property value will be ignored."); + } + } + + return Unknown(code); + } + } +} diff --git a/src/Elmah.Io.HResults/Facilities/FacilityRpcResolver.cs b/src/Elmah.Io.HResults/Facilities/FacilityRpcResolver.cs new file mode 100644 index 0000000..8a5bb2d --- /dev/null +++ b/src/Elmah.Io.HResults/Facilities/FacilityRpcResolver.cs @@ -0,0 +1,100 @@ +namespace Elmah.Io.HResults.Facilities +{ + internal class FacilityRpcResolver : FacilityResolverBase + { + public FacilityRpcResolver() : base(1, "FACILITY_RPC") + { + } + + internal override Code Resolve(bool failure, int code) + { + return code switch + { + 1 => new Code(code, "RPC_E_CALL_REJECTED", "Call was rejected by callee."), + 2 => new Code(code, "RPC_E_CALL_CANCELED", "Call was canceled by the message filter."), + 3 => new Code(code, "RPC_E_CANTPOST_INSENDCALL", "The caller is dispatching an intertask SendMessage call and cannot call out via PostMessage."), + 4 => new Code(code, "RPC_E_CANTCALLOUT_INASYNCCALL", "The caller is dispatching an asynchronous call and cannot make an outgoing call on behalf of this call."), + 5 => new Code(code, "RPC_E_CANTCALLOUT_INEXTERNALCALL", "It is illegal to call out while inside message filter."), + 6 => new Code(code, "RPC_E_CONNECTION_TERMINATED", "The connection terminated or is in a bogus state and can no longer be used. Other connections are still valid."), + 7 => new Code(code, "RPC_E_SERVER_DIED", "The callee (the server, not the server application) is not available and disappeared; all connections are invalid. The call might have executed."), + 8 => new Code(code, "RPC_E_CLIENT_DIED", "The caller (client) disappeared while the callee (server) was processing a call."), + 9 => new Code(code, "RPC_E_INVALID_DATAPACKET", "The data packet with the marshaled parameter data is incorrect."), + 10 => new Code(code, "RPC_E_CANTTRANSMIT_CALL", "The call was not transmitted properly; the message queue was full and was not emptied after yielding."), + 11 => new Code(code, "RPC_E_CLIENT_CANTMARSHAL_DATA", "The client RPC caller cannot marshal the parameter data due to errors (such as low memory)."), + 12 => new Code(code, "RPC_E_CLIENT_CANTUNMARSHAL_DATA", "The client RPC caller cannot unmarshal the return data due to errors (such as low memory)."), + 13 => new Code(code, "RPC_E_SERVER_CANTMARSHAL_DATA", "The server RPC callee cannot marshal the return data due to errors (such as low memory)."), + 14 => new Code(code, "RPC_E_SERVER_CANTUNMARSHAL_DATA", "The server RPC callee cannot unmarshal the parameter data due to errors (such as low memory)."), + 15 => new Code(code, "RPC_E_INVALID_DATA", "Received data is invalid. The data might be server or client data."), + 16 => new Code(code, "RPC_E_INVALID_PARAMETER", "A particular parameter is invalid and cannot be (un)marshaled."), + 17 => new Code(code, "RPC_E_CANTCALLOUT_AGAIN", "There is no second outgoing call on same channel in DDE conversation."), + 18 => new Code(code, "RPC_E_SERVER_DIED_DNE", "The callee (the server, not the server application) is not available and disappeared; all connections are invalid. The call did not execute."), + 256 => new Code(code, "RPC_E_SYS_CALL_FAILED", "System call failed."), + 257 => new Code(code, "RPC_E_OUT_OF_RESOURCES", "Could not allocate some required resource (such as memory or events)"), + 258 => new Code(code, "RPC_E_ATTEMPTED_MULTITHREAD", "Attempted to make calls on more than one thread in single-threaded mode."), + 259 => new Code(code, "RPC_E_NOT_REGISTERED", "The requested interface is not registered on the server object."), + 260 => new Code(code, "RPC_E_FAULT", "RPC could not call the server or could not return the results of calling the server."), + 261 => new Code(code, "RPC_E_SERVERFAULT", "The server threw an exception."), + 262 => new Code(code, "RPC_E_CHANGED_MODE", "Cannot change thread mode after it is set."), + 263 => new Code(code, "RPC_E_INVALIDMETHOD", "The method called does not exist on the server."), + 264 => new Code(code, "RPC_E_DISCONNECTED", "The object invoked has disconnected from its clients."), + 265 => new Code(code, "RPC_E_RETRY", "The object invoked chose not to process the call now. Try again later."), + 266 => new Code(code, "RPC_E_SERVERCALL_RETRYLATER", "The message filter indicated that the application is busy."), + 267 => new Code(code, "RPC_E_SERVERCALL_REJECTED", "The message filter rejected the call."), + 268 => new Code(code, "RPC_E_INVALID_CALLDATA", "A call control interface was called with invalid data."), + 269 => new Code(code, "RPC_E_CANTCALLOUT_ININPUTSYNCCALL", "An outgoing call cannot be made because the application is dispatching an input-synchronous call."), + 270 => new Code(code, "RPC_E_WRONG_THREAD", "The application called an interface that was marshaled for a different thread."), + 271 => new Code(code, "RPC_E_THREAD_NOT_INIT", "CoInitialize has not been called on the current thread."), + 272 => new Code(code, "RPC_E_VERSION_MISMATCH", "The version of OLE on the client and server machines does not match."), + 273 => new Code(code, "RPC_E_INVALID_HEADER", "OLE received a packet with an invalid header."), + 274 => new Code(code, "RPC_E_INVALID_EXTENSION", "OLE received a packet with an invalid extension."), + 275 => new Code(code, "RPC_E_INVALID_IPID", "The requested object or interface does not exist."), + 276 => new Code(code, "RPC_E_INVALID_OBJECT", "The requested object does not exist."), + 277 => new Code(code, "RPC_S_CALLPENDING", "OLE has sent a request and is waiting for a reply."), + 278 => new Code(code, "RPC_S_WAITONTIMER", "OLE is waiting before retrying a request."), + 279 => new Code(code, "RPC_E_CALL_COMPLETE", "Call context cannot be accessed after call completed."), + 280 => new Code(code, "RPC_E_UNSECURE_CALL", "Impersonate on unsecure calls is not supported."), + 281 => new Code(code, "RPC_E_TOO_LATE", "Security must be initialized before any interfaces are marshaled or unmarshaled. It cannot be changed after initialized."), + 282 => new Code(code, "RPC_E_NO_GOOD_SECURITY_PACKAGES", "No security packages are installed on this machine, the user is not logged on, or there are no compatible security packages between the client and server."), + 283 => new Code(code, "RPC_E_ACCESS_DENIED", "Access is denied."), + 284 => new Code(code, "RPC_E_REMOTE_DISABLED", "Remote calls are not allowed for this process."), + 285 => new Code(code, "RPC_E_INVALID_OBJREF", "The marshaled interface data packet (OBJREF) has an invalid or unknown format."), + 286 => new Code(code, "RPC_E_NO_CONTEXT", "No context is associated with this call. This happens for some custom marshaled calls and on the client side of the call."), + 287 => new Code(code, "RPC_E_TIMEOUT", "This operation returned because the time-out period expired."), + 288 => new Code(code, "RPC_E_NO_SYNC", "There are no synchronize objects to wait on."), + 289 => new Code(code, "RPC_E_FULLSIC_REQUIRED", "Full subject issuer chain Secure Sockets Layer (SSL) principal name expected from the server."), + 290 => new Code(code, "RPC_E_INVALID_STD_NAME", "Principal name is not a valid Microsoft standard (msstd) name."), + 291 => new Code(code, "CO_E_FAILEDTOIMPERSONATE", "Unable to impersonate DCOM client."), + 292 => new Code(code, "CO_E_FAILEDTOGETSECCTX", "Unable to obtain server's security context."), + 293 => new Code(code, "CO_E_FAILEDTOOPENTHREADTOKEN", "Unable to open the access token of the current thread."), + 294 => new Code(code, "CO_E_FAILEDTOGETTOKENINFO", "Unable to obtain user information from an access token."), + 295 => new Code(code, "CO_E_TRUSTEEDOESNTMATCHCLIENT", "The client who called IAccessControl::IsAccessPermitted was not the trustee provided to the method."), + 296 => new Code(code, "CO_E_FAILEDTOQUERYCLIENTBLANKET", "Unable to obtain the client's security blanket."), + 297 => new Code(code, "CO_E_FAILEDTOSETDACL", "Unable to set a discretionary access control list (ACL) into a security descriptor."), + 298 => new Code(code, "CO_E_ACCESSCHECKFAILED", "The system function AccessCheck returned false."), + 299 => new Code(code, "CO_E_NETACCESSAPIFAILED", "Either NetAccessDel or NetAccessAdd returned an error code."), + 300 => new Code(code, "CO_E_WRONGTRUSTEENAMESYNTAX", "One of the trustee strings provided by the user did not conform to the \\ syntax and it was not the *\" string\"."), + 301 => new Code(code, "CO_E_INVALIDSID", "One of the security identifiers provided by the user was invalid."), + 302 => new Code(code, "CO_E_CONVERSIONFAILED", "Unable to convert a wide character trustee string to a multiple-byte trustee string."), + 303 => new Code(code, "CO_E_NOMATCHINGSIDFOUND", "Unable to find a security identifier that corresponds to a trustee string provided by the user."), + 304 => new Code(code, "CO_E_LOOKUPACCSIDFAILED", "The system function LookupAccountSID failed."), + 305 => new Code(code, "CO_E_NOMATCHINGNAMEFOUND", "Unable to find a trustee name that corresponds to a security identifier provided by the user."), + 306 => new Code(code, "CO_E_LOOKUPACCNAMEFAILED", "The system function LookupAccountName failed."), + 307 => new Code(code, "CO_E_SETSERLHNDLFAILED", "Unable to set or reset a serialization handle."), + 308 => new Code(code, "CO_E_FAILEDTOGETWINDIR", "Unable to obtain the Windows directory."), + 309 => new Code(code, "CO_E_PATHTOOLONG", "Path too long."), + 310 => new Code(code, "CO_E_FAILEDTOGENUUID", "Unable to generate a UUID."), + 311 => new Code(code, "CO_E_FAILEDTOCREATEFILE", "Unable to create file."), + 312 => new Code(code, "CO_E_FAILEDTOCLOSEHANDLE", "Unable to close a serialization handle or a file handle."), + 313 => new Code(code, "CO_E_EXCEEDSYSACLLIMIT", "The number of access control entries (ACEs) in an ACL exceeds the system limit."), + 314 => new Code(code, "CO_E_ACESINWRONGORDER", "Not all the DENY_ACCESS ACEs are arranged in front of the GRANT_ACCESS ACEs in the stream."), + 315 => new Code(code, "CO_E_INCOMPATIBLESTREAMVERSION", "The version of ACL format in the stream is not supported by this implementation of IAccessControl."), + 316 => new Code(code, "CO_E_FAILEDTOOPENPROCESSTOKEN", "Unable to open the access token of the server process."), + 317 => new Code(code, "CO_E_DECODEFAILED", "Unable to decode the ACL in the stream provided by the user."), + 319 => new Code(code, "CO_E_ACNOTINITIALIZED", "The COM IAccessControl object is not initialized."), + 320 => new Code(code, "CO_E_CANCEL_DISABLED", "Call Cancellation is disabled."), + 65535 => new Code(code, "RPC_E_UNEXPECTED", "An internal error occurred."), + _ => Unknown(code), + }; + } + } +} diff --git a/src/Elmah.Io.HResults/Facilities/FacilityScardResolver.cs b/src/Elmah.Io.HResults/Facilities/FacilityScardResolver.cs new file mode 100644 index 0000000..6e42d26 --- /dev/null +++ b/src/Elmah.Io.HResults/Facilities/FacilityScardResolver.cs @@ -0,0 +1,77 @@ +namespace Elmah.Io.HResults.Facilities +{ + internal class FacilityScardResolver : FacilityResolverBase + { + public FacilityScardResolver() : base(16, "FACILITY_SCARD") + { + } + + internal override Code Resolve(bool failure, int code) + { + return code switch + { + 1 => new Code(code, "SCARD_F_INTERNAL_ERROR", "An internal consistency check failed."), + 2 => new Code(code, "SCARD_E_CANCELLED", "The action was canceled by an SCardCancel request."), + 3 => new Code(code, "SCARD_E_INVALID_HANDLE", "The supplied handle was invalid."), + 4 => new Code(code, "SCARD_E_INVALID_PARAMETER", "One or more of the supplied parameters could not be properly interpreted."), + 5 => new Code(code, "SCARD_E_INVALID_TARGET", "Registry startup information is missing or invalid."), + 6 => new Code(code, "SCARD_E_NO_MEMORY", "Not enough memory available to complete this command."), + 7 => new Code(code, "SCARD_F_WAITED_TOO_LONG", "An internal consistency timer has expired."), + 8 => new Code(code, "SCARD_E_INSUFFICIENT_BUFFER", "The data buffer to receive returned data is too small for the returned data."), + 9 => new Code(code, "SCARD_E_UNKNOWN_READER", "The specified reader name is not recognized."), + 10 => new Code(code, "SCARD_E_TIMEOUT", "The user-specified time-out value has expired."), + 11 => new Code(code, "SCARD_E_SHARING_VIOLATION", "The smart card cannot be accessed because of other connections outstanding."), + 12 => new Code(code, "SCARD_E_NO_SMARTCARD", "The operation requires a smart card, but no smart card is currently in the device."), + 13 => new Code(code, "SCARD_E_UNKNOWN_CARD", "The specified smart card name is not recognized."), + 14 => new Code(code, "SCARD_E_CANT_DISPOSE", "The system could not dispose of the media in the requested manner."), + 15 => new Code(code, "SCARD_E_PROTO_MISMATCH", "The requested protocols are incompatible with the protocol currently in use with the smart card."), + 16 => new Code(code, "SCARD_E_NOT_READY", "The reader or smart card is not ready to accept commands."), + 17 => new Code(code, "SCARD_E_INVALID_VALUE", "One or more of the supplied parameters values could not be properly interpreted."), + 18 => new Code(code, "SCARD_E_SYSTEM_CANCELLED", "The action was canceled by the system, presumably to log off or shut down."), + 19 => new Code(code, "SCARD_F_COMM_ERROR", "An internal communications error has been detected."), + 20 => new Code(code, "SCARD_F_UNKNOWN_ERROR", "An internal error has been detected, but the source is unknown."), + 21 => new Code(code, "SCARD_E_INVALID_ATR", "An automatic terminal recognition (ATR) obtained from the registry is not a valid ATR string."), + 22 => new Code(code, "SCARD_E_NOT_TRANSACTED", "An attempt was made to end a nonexistent transaction."), + 23 => new Code(code, "SCARD_E_READER_UNAVAILABLE", "The specified reader is not currently available for use."), + 24 => new Code(code, "SCARD_P_SHUTDOWN", "The operation has been aborted to allow the server application to exit."), + 25 => new Code(code, "SCARD_E_PCI_TOO_SMALL", "The peripheral component interconnect (PCI) Receive buffer was too small."), + 26 => new Code(code, "SCARD_E_READER_UNSUPPORTED", "The reader driver does not meet minimal requirements for support."), + 27 => new Code(code, "SCARD_E_DUPLICATE_READER", "The reader driver did not produce a unique reader name."), + 28 => new Code(code, "SCARD_E_CARD_UNSUPPORTED", "The smart card does not meet minimal requirements for support."), + 29 => new Code(code, "SCARD_E_NO_SERVICE", "The smart card resource manager is not running."), + 30 => new Code(code, "SCARD_E_SERVICE_STOPPED", "The smart card resource manager has shut down."), + 31 => new Code(code, "SCARD_E_UNEXPECTED", "An unexpected card error has occurred."), + 32 => new Code(code, "SCARD_E_ICC_INSTALLATION", "No primary provider can be found for the smart card."), + 33 => new Code(code, "SCARD_E_ICC_CREATEORDER", "The requested order of object creation is not supported."), + 34 => new Code(code, "SCARD_E_UNSUPPORTED_FEATURE", "This smart card does not support the requested feature."), + 35 => new Code(code, "SCARD_E_DIR_NOT_FOUND", "The identified directory does not exist in the smart card."), + 36 => new Code(code, "SCARD_E_FILE_NOT_FOUND", "The identified file does not exist in the smart card."), + 37 => new Code(code, "SCARD_E_NO_DIR", "The supplied path does not represent a smart card directory."), + 38 => new Code(code, "SCARD_E_NO_FILE", "The supplied path does not represent a smart card file."), + 39 => new Code(code, "SCARD_E_NO_ACCESS", "Access is denied to this file."), + 40 => new Code(code, "SCARD_E_WRITE_TOO_MANY", "The smart card does not have enough memory to store the information."), + 41 => new Code(code, "SCARD_E_BAD_SEEK", "There was an error trying to set the smart card file object pointer."), + 42 => new Code(code, "SCARD_E_INVALID_CHV", "The supplied PIN is incorrect."), + 43 => new Code(code, "SCARD_E_UNKNOWN_RES_MNG", "An unrecognized error code was returned from a layered component."), + 44 => new Code(code, "SCARD_E_NO_SUCH_CERTIFICATE", "The requested certificate does not exist."), + 45 => new Code(code, "SCARD_E_CERTIFICATE_UNAVAILABLE", "The requested certificate could not be obtained."), + 46 => new Code(code, "SCARD_E_NO_READERS_AVAILABLE", "Cannot find a smart card reader."), + 47 => new Code(code, "SCARD_E_COMM_DATA_LOST", "A communications error with the smart card has been detected. Retry the operation."), + 48 => new Code(code, "SCARD_E_NO_KEY_CONTAINER", "The requested key container does not exist on the smart card."), + 49 => new Code(code, "SCARD_E_SERVER_TOO_BUSY", "The smart card resource manager is too busy to complete this operation."), + 101 => new Code(code, "SCARD_W_UNSUPPORTED_CARD", "The reader cannot communicate with the smart card, due to ATR configuration conflicts."), + 102 => new Code(code, "SCARD_W_UNRESPONSIVE_CARD", "The smart card is not responding to a reset."), + 103 => new Code(code, "SCARD_W_UNPOWERED_CARD", "Power has been removed from the smart card, so that further communication is not possible."), + 104 => new Code(code, "SCARD_W_RESET_CARD", "The smart card has been reset, so any shared state information is invalid."), + 105 => new Code(code, "SCARD_W_REMOVED_CARD", "The smart card has been removed, so that further communication is not possible."), + 106 => new Code(code, "SCARD_W_SECURITY_VIOLATION", "Access was denied because of a security violation."), + 107 => new Code(code, "SCARD_W_WRONG_CHV", "The card cannot be accessed because the wrong PIN was presented."), + 108 => new Code(code, "SCARD_W_CHV_BLOCKED", "The card cannot be accessed because the maximum number of PIN entry attempts has been reached."), + 109 => new Code(code, "SCARD_W_EOF", "The end of the smart card file has been reached."), + 110 => new Code(code, "SCARD_W_CANCELLED_BY_USER", "The action was canceled by the user."), + 111 => new Code(code, "SCARD_W_CARD_NOT_AUTHENTICATED", "No PIN was presented to the smart card."), + _ => Unknown(code), + }; + } + } +} diff --git a/src/Elmah.Io.HResults/Facilities/FacilitySecurityResolver.cs b/src/Elmah.Io.HResults/Facilities/FacilitySecurityResolver.cs new file mode 100644 index 0000000..0b1b35e --- /dev/null +++ b/src/Elmah.Io.HResults/Facilities/FacilitySecurityResolver.cs @@ -0,0 +1,351 @@ +namespace Elmah.Io.HResults.Facilities +{ + internal class FacilitySecurityResolver : FacilityResolverBase + { + public FacilitySecurityResolver() : base(9, "FACILITY_SECURITY") + { + } + + internal override Code Resolve(bool failure, int code) + { + if (failure) + { + switch (code) + { + case 1: return new Code(code, "NTE_BAD_UID", "Bad UID."); + case 2: return new Code(code, "NTE_BAD_HASH", "Bad hash."); + case 3: return new Code(code, "NTE_BAD_KEY", "Bad key."); + case 4: return new Code(code, "NTE_BAD_LEN", "Bad length."); + case 5: return new Code(code, "NTE_BAD_DATA", "Bad data."); + case 6: return new Code(code, "NTE_BAD_SIGNATURE", "Invalid signature."); + case 7: return new Code(code, "NTE_BAD_VER", "Bad version of provider."); + case 8: return new Code(code, "NTE_BAD_ALGID", "Invalid algorithm specified."); + case 9: return new Code(code, "NTE_BAD_FLAGS", "Invalid flags specified."); + case 10: return new Code(code, "NTE_BAD_TYPE", "Invalid type specified."); + case 11: return new Code(code, "NTE_BAD_KEY_STATE", "Key not valid for use in specified state."); + case 12: return new Code(code, "NTE_BAD_HASH_STATE", "Hash not valid for use in specified state."); + case 13: return new Code(code, "NTE_NO_KEY", "Key does not exist."); + case 14: return new Code(code, "NTE_NO_MEMORY", "Insufficient memory available for the operation."); + case 15: return new Code(code, "NTE_EXISTS", "Object already exists."); + case 16: return new Code(code, "NTE_PERM", "Access denied."); + case 17: return new Code(code, "NTE_NOT_FOUND", "Object was not found."); + case 18: return new Code(code, "NTE_DOUBLE_ENCRYPT", "Data already encrypted."); + case 19: return new Code(code, "NTE_BAD_PROVIDER", "Invalid provider specified."); + case 20: return new Code(code, "NTE_BAD_PROV_TYPE", "Invalid provider type specified."); + case 21: return new Code(code, "NTE_BAD_PUBLIC_KEY", "Provider's public key is invalid."); + case 22: return new Code(code, "NTE_BAD_KEYSET", "Key set does not exist."); + case 23: return new Code(code, "NTE_PROV_TYPE_NOT_DEF", "Provider type not defined."); + case 24: return new Code(code, "NTE_PROV_TYPE_ENTRY_BAD", "The provider type, as registered, is invalid."); + case 25: return new Code(code, "NTE_KEYSET_NOT_DEF", "The key set is not defined."); + case 26: return new Code(code, "NTE_KEYSET_ENTRY_BAD", "The key set, as registered, is invalid."); + case 27: return new Code(code, "NTE_PROV_TYPE_NO_MATCH", "Provider type does not match registered value."); + case 28: return new Code(code, "NTE_SIGNATURE_FILE_BAD", "The digital signature file is corrupt."); + case 29: return new Code(code, "NTE_PROVIDER_DLL_FAIL", "Provider DLL failed to initialize correctly."); + case 30: return new Code(code, "NTE_PROV_DLL_NOT_FOUND", "Provider DLL could not be found."); + case 31: return new Code(code, "NTE_BAD_KEYSET_PARAM", "The keyset parameter is invalid."); + case 32: return new Code(code, "NTE_FAIL", "An internal error occurred."); + case 33: return new Code(code, "NTE_SYS_ERR", "A base error occurred."); + case 34: return new Code(code, "NTE_SILENT_CONTEXT", "Provider could not perform the action because the context was acquired as silent."); + case 35: return new Code(code, "NTE_TOKEN_KEYSET_STORAGE_FULL", "The security token does not have storage space available for an additional container."); + case 36: return new Code(code, "NTE_TEMPORARY_PROFILE", "The profile for the user is a temporary profile."); + case 37: return new Code(code, "NTE_FIXEDPARAMETER", "The key parameters could not be set because the configuration service provider (CSP) uses fixed parameters."); + case 38: return new Code(code, "NTE_INVALID_HANDLE", "The supplied handle is invalid."); + case 39: return new Code(code, "NTE_INVALID_PARAMETER", "The parameter is incorrect."); + case 40: return new Code(code, "NTE_BUFFER_TOO_SMALL", "The buffer supplied to a function was too small."); + case 41: return new Code(code, "NTE_NOT_SUPPORTED", "The requested operation is not supported."); + case 42: return new Code(code, "NTE_NO_MORE_ITEMS", "No more data is available."); + case 43: return new Code(code, "NTE_BUFFERS_OVERLAP", "The supplied buffers overlap incorrectly."); + case 44: return new Code(code, "NTE_DECRYPTION_FAILURE", "The specified data could not be decrypted."); + case 45: return new Code(code, "NTE_INTERNAL_ERROR", "An internal consistency check failed."); + case 46: return new Code(code, "NTE_UI_REQUIRED", "This operation requires input from the user."); + case 47: return new Code(code, "NTE_HMAC_NOT_SUPPORTED", "The cryptographic provider does not support Hash Message Authentication Code (HMAC)."); + case 768: return new Code(code, "SEC_E_INSUFFICIENT_MEMORY", "Not enough memory is available to complete this request."); + case 769: return new Code(code, "SEC_E_INVALID_HANDLE", "The handle specified is invalid."); + case 770: return new Code(code, "SEC_E_UNSUPPORTED_FUNCTION", "The function requested is not supported."); + case 771: return new Code(code, "SEC_E_TARGET_UNKNOWN", "The specified target is unknown or unreachable."); + case 772: return new Code(code, "SEC_E_INTERNAL_ERROR", "The Local Security Authority (LSA) cannot be contacted."); + case 773: return new Code(code, "SEC_E_SECPKG_NOT_FOUND", "The requested security package does not exist."); + case 774: return new Code(code, "SEC_E_NOT_OWNER", "The caller is not the owner of the desired credentials."); + case 775: return new Code(code, "SEC_E_CANNOT_INSTALL", "The security package failed to initialize and cannot be installed."); + case 776: return new Code(code, "SEC_E_INVALID_TOKEN", "The token supplied to the function is invalid."); + case 777: return new Code(code, "SEC_E_CANNOT_PACK", "The security package is not able to marshal the logon buffer, so the logon attempt has failed."); + case 778: return new Code(code, "SEC_E_QOP_NOT_SUPPORTED", "The per-message quality of protection is not supported by the security package."); + case 779: return new Code(code, "SEC_E_NO_IMPERSONATION", "The security context does not allow impersonation of the client."); + case 780: return new Code(code, "SEC_E_LOGON_DENIED", "The logon attempt failed."); + case 781: return new Code(code, "SEC_E_UNKNOWN_CREDENTIALS", "The credentials supplied to the package were not recognized."); + case 782: return new Code(code, "SEC_E_NO_CREDENTIALS", "No credentials are available in the security package."); + case 783: return new Code(code, "SEC_E_MESSAGE_ALTERED", "The message or signature supplied for verification has been altered."); + case 784: return new Code(code, "SEC_E_OUT_OF_SEQUENCE", "The message supplied for verification is out of sequence."); + case 785: return new Code(code, "SEC_E_NO_AUTHENTICATING_AUTHORITY", "No authority could be contacted for authentication."); + case 790: return new Code(code, "SEC_E_BAD_PKGID", "The requested security package does not exist."); + case 791: return new Code(code, "SEC_E_CONTEXT_EXPIRED", "The context has expired and can no longer be used."); + case 792: return new Code(code, "SEC_E_INCOMPLETE_MESSAGE", "The supplied message is incomplete. The signature was not verified."); + case 800: return new Code(code, "SEC_E_INCOMPLETE_CREDENTIALS", "The credentials supplied were not complete and could not be verified. The context could not be initialized."); + case 801: return new Code(code, "SEC_E_BUFFER_TOO_SMALL", "The buffers supplied to a function was too small."); + case 802: return new Code(code, "SEC_E_WRONG_PRINCIPAL", "The target principal name is incorrect."); + case 804: return new Code(code, "SEC_E_TIME_SKEW", "The clocks on the client and server machines are skewed."); + case 805: return new Code(code, "SEC_E_UNTRUSTED_ROOT", "The certificate chain was issued by an authority that is not trusted."); + case 806: return new Code(code, "SEC_E_ILLEGAL_MESSAGE", "The message received was unexpected or badly formatted."); + case 807: return new Code(code, "SEC_E_CERT_UNKNOWN", "An unknown error occurred while processing the certificate."); + case 808: return new Code(code, "SEC_E_CERT_EXPIRED", "The received certificate has expired."); + case 809: return new Code(code, "SEC_E_ENCRYPT_FAILURE", "The specified data could not be encrypted."); + case 816: return new Code(code, "SEC_E_DECRYPT_FAILURE", "The specified data could not be decrypted."); + case 817: return new Code(code, "SEC_E_ALGORITHM_MISMATCH", "The client and server cannot communicate because they do not possess a common algorithm."); + case 818: return new Code(code, "SEC_E_SECURITY_QOS_FAILED", "The security context could not be established due to a failure in the requested quality of service (for example, mutual authentication or delegation)."); + case 819: return new Code(code, "SEC_E_UNFINISHED_CONTEXT_DELETED", "A security context was deleted before the context was completed. This is considered a logon failure."); + case 820: return new Code(code, "SEC_E_NO_TGT_REPLY", "The client is trying to negotiate a context and the server requires user-to-user but did not send a ticket granting ticket (TGT) reply."); + case 821: return new Code(code, "SEC_E_NO_IP_ADDRESSES", "Unable to accomplish the requested task because the local machine does not have an IP addresses."); + case 822: return new Code(code, "SEC_E_WRONG_CREDENTIAL_HANDLE", "The supplied credential handle does not match the credential associated with the security context."); + case 823: return new Code(code, "SEC_E_CRYPTO_SYSTEM_INVALID", "The cryptographic system or checksum function is invalid because a required function is unavailable."); + case 824: return new Code(code, "SEC_E_MAX_REFERRALS_EXCEEDED", "The number of maximum ticket referrals has been exceeded."); + case 825: return new Code(code, "SEC_E_MUST_BE_KDC", "The local machine must be a Kerberos domain controller (KDC), and it is not."); + case 826: return new Code(code, "SEC_E_STRONG_CRYPTO_NOT_SUPPORTED", "The other end of the security negotiation requires strong cryptographics, but it is not supported on the local machine."); + case 827: return new Code(code, "SEC_E_TOO_MANY_PRINCIPALS", "The KDC reply contained more than one principal name."); + case 828: return new Code(code, "SEC_E_NO_PA_DATA", "Expected to find PA data for a hint of what etype to use, but it was not found."); + case 829: return new Code(code, "SEC_E_PKINIT_NAME_MISMATCH", "The client certificate does not contain a valid user principal name (UPN), or does not match the client name in the logon request. Contact your administrator."); + case 830: return new Code(code, "SEC_E_SMARTCARD_LOGON_REQUIRED", "Smart card logon is required and was not used."); + case 831: return new Code(code, "SEC_E_SHUTDOWN_IN_PROGRESS", "A system shutdown is in progress."); + case 832: return new Code(code, "SEC_E_KDC_INVALID_REQUEST", "An invalid request was sent to the KDC."); + case 833: return new Code(code, "SEC_E_KDC_UNABLE_TO_REFER", "The KDC was unable to generate a referral for the service requested."); + case 834: return new Code(code, "SEC_E_KDC_UNKNOWN_ETYPE", "The encryption type requested is not supported by the KDC."); + case 835: return new Code(code, "SEC_E_UNSUPPORTED_PREAUTH", "An unsupported pre-authentication mechanism was presented to the Kerberos package."); + case 837: return new Code(code, "SEC_E_DELEGATION_REQUIRED", "The requested operation cannot be completed. The computer must be trusted for delegation, and the current user account must be configured to allow delegation."); + case 838: return new Code(code, "SEC_E_BAD_BINDINGS", "Client's supplied Security Support Provider Interface (SSPI) channel bindings were incorrect."); + case 839: return new Code(code, "SEC_E_MULTIPLE_ACCOUNTS", "The received certificate was mapped to multiple accounts."); + case 840: return new Code(code, "SEC_E_NO_KERB_KEY", "No Kerberos key was found."); + case 841: return new Code(code, "SEC_E_CERT_WRONG_USAGE", "The certificate is not valid for the requested usage."); + case 848: return new Code(code, "SEC_E_DOWNGRADE_DETECTED", "The system detected a possible attempt to compromise security. Ensure that you can contact the server that authenticated you."); + case 849: return new Code(code, "SEC_E_SMARTCARD_CERT_REVOKED", "The smart card certificate used for authentication has been revoked. Contact your system administrator. The event log might contain additional information."); + case 850: return new Code(code, "SEC_E_ISSUING_CA_UNTRUSTED", "An untrusted certification authority (CA) was detected while processing the smart card certificate used for authentication. Contact your system administrator."); + case 851: return new Code(code, "SEC_E_REVOCATION_OFFLINE_C", "The revocation status of the smart card certificate used for authentication could not be determined. Contact your system administrator."); + case 852: return new Code(code, "SEC_E_PKINIT_CLIENT_FAILURE", "The smart card certificate used for authentication was not trusted. Contact your system administrator."); + case 853: return new Code(code, "SEC_E_SMARTCARD_CERT_EXPIRED", "The smart card certificate used for authentication has expired. Contact your system administrator."); + case 854: return new Code(code, "SEC_E_NO_S4U_PROT_SUPPORT", "The Kerberos subsystem encountered an error. A service for user protocol requests was made against a domain controller that does not support services for users."); + case 855: return new Code(code, "SEC_E_CROSSREALM_DELEGATION_FAILURE", "An attempt was made by this server to make a Kerberos-constrained delegation request for a target outside the server's realm. This is not supported and indicates a misconfiguration on this server's allowed-to-delegate-to list. Contact your administrator."); + case 856: return new Code(code, "SEC_E_REVOCATION_OFFLINE_KDC", "The revocation status of the domain controller certificate used for smart card authentication could not be determined. The system event log contains additional information. Contact your system administrator."); + case 857: return new Code(code, "SEC_E_ISSUING_CA_UNTRUSTED_KDC", "An untrusted CA was detected while processing the domain controller certificate used for authentication. The system event log contains additional information. Contact your system administrator."); + case 858: return new Code(code, "SEC_E_KDC_CERT_EXPIRED", "The domain controller certificate used for smart card logon has expired. Contact your system administrator with the contents of your system event log."); + case 859: return new Code(code, "SEC_E_KDC_CERT_REVOKED", "The domain controller certificate used for smart card logon has been revoked. Contact your system administrator with the contents of your system event log."); + case 861: return new Code(code, "SEC_E_INVALID_PARAMETER", "One or more of the parameters passed to the function were invalid."); + case 862: return new Code(code, "SEC_E_DELEGATION_POLICY", "The client policy does not allow credential delegation to the target server."); + case 863: return new Code(code, "SEC_E_POLICY_NLTM_ONLY", "The client policy does not allow credential delegation to the target server with NLTM only authentication."); + case 4097: return new Code(code, "CRYPT_E_MSG_ERROR", "An error occurred while performing an operation on a cryptographic message."); + case 4098: return new Code(code, "CRYPT_E_UNKNOWN_ALGO", "Unknown cryptographic algorithm."); + case 4099: return new Code(code, "CRYPT_E_OID_FORMAT", "The object identifier is poorly formatted."); + case 4100: return new Code(code, "CRYPT_E_INVALID_MSG_TYPE", "Invalid cryptographic message type."); + case 4101: return new Code(code, "CRYPT_E_UNEXPECTED_ENCODING", "Unexpected cryptographic message encoding."); + case 4102: return new Code(code, "CRYPT_E_AUTH_ATTR_MISSING", "The cryptographic message does not contain an expected authenticated attribute."); + case 4103: return new Code(code, "CRYPT_E_HASH_VALUE", "The hash value is not correct."); + case 4104: return new Code(code, "CRYPT_E_INVALID_INDEX", "The index value is not valid."); + case 4105: return new Code(code, "CRYPT_E_ALREADY_DECRYPTED", "The content of the cryptographic message has already been decrypted."); + case 4106: return new Code(code, "CRYPT_E_NOT_DECRYPTED", "The content of the cryptographic message has not been decrypted yet."); + case 4107: return new Code(code, "CRYPT_E_RECIPIENT_NOT_FOUND", "The enveloped-data message does not contain the specified recipient."); + case 4108: return new Code(code, "CRYPT_E_CONTROL_TYPE", "Invalid control type."); + case 4109: return new Code(code, "CRYPT_E_ISSUER_SERIALNUMBER", "Invalid issuer or serial number."); + case 4110: return new Code(code, "CRYPT_E_SIGNER_NOT_FOUND", "Cannot find the original signer."); + case 4111: return new Code(code, "CRYPT_E_ATTRIBUTES_MISSING", "The cryptographic message does not contain all of the requested attributes."); + case 4112: return new Code(code, "CRYPT_E_STREAM_MSG_NOT_READY", "The streamed cryptographic message is not ready to return data."); + case 4113: return new Code(code, "CRYPT_E_STREAM_INSUFFICIENT_DATA", "The streamed cryptographic message requires more data to complete the decode operation."); + case 8193: return new Code(code, "CRYPT_E_BAD_LEN", "The length specified for the output data was insufficient."); + case 8194: return new Code(code, "CRYPT_E_BAD_ENCODE", "An error occurred during the encode or decode operation."); + case 8195: return new Code(code, "CRYPT_E_FILE_ERROR", "An error occurred while reading or writing to a file."); + case 8196: return new Code(code, "CRYPT_E_NOT_FOUND", "Cannot find object or property."); + case 8197: return new Code(code, "CRYPT_E_EXISTS", "The object or property already exists."); + case 8198: return new Code(code, "CRYPT_E_NO_PROVIDER", "No provider was specified for the store or object."); + case 8199: return new Code(code, "CRYPT_E_SELF_SIGNED", "The specified certificate is self-signed."); + case 8200: return new Code(code, "CRYPT_E_DELETED_PREV", "The previous certificate or certificate revocation list (CRL) context was deleted."); + case 8201: return new Code(code, "CRYPT_E_NO_MATCH", "Cannot find the requested object."); + case 8202: return new Code(code, "CRYPT_E_UNEXPECTED_MSG_TYPE", "The certificate does not have a property that references a private key."); + case 8203: return new Code(code, "CRYPT_E_NO_KEY_PROPERTY", "Cannot find the certificate and private key for decryption."); + case 8204: return new Code(code, "CRYPT_E_NO_DECRYPT_CERT", "Cannot find the certificate and private key to use for decryption."); + case 8205: return new Code(code, "CRYPT_E_BAD_MSG", "Not a cryptographic message or the cryptographic message is not formatted correctly."); + case 8206: return new Code(code, "CRYPT_E_NO_SIGNER", "The signed cryptographic message does not have a signer for the specified signer index."); + case 8207: return new Code(code, "CRYPT_E_PENDING_CLOSE", "Final closure is pending until additional frees or closes."); + case 8208: return new Code(code, "CRYPT_E_REVOKED", "The certificate is revoked."); + case 8209: return new Code(code, "CRYPT_E_NO_REVOCATION_DLL", "No DLL or exported function was found to verify revocation."); + case 8210: return new Code(code, "CRYPT_E_NO_REVOCATION_CHECK", "The revocation function was unable to check revocation for the certificate."); + case 8211: return new Code(code, "CRYPT_E_REVOCATION_OFFLINE", "The revocation function was unable to check revocation because the revocation server was offline."); + case 8212: return new Code(code, "CRYPT_E_NOT_IN_REVOCATION_DATABASE", "The certificate is not in the revocation server's database."); + case 8224: return new Code(code, "CRYPT_E_INVALID_NUMERIC_STRING", "The string contains a non-numeric character."); + case 8225: return new Code(code, "CRYPT_E_INVALID_PRINTABLE_STRING", "The string contains a nonprintable character."); + case 8226: return new Code(code, "CRYPT_E_INVALID_IA5_STRING", "The string contains a character not in the 7-bit ASCII character set."); + case 8227: return new Code(code, "CRYPT_E_INVALID_X500_STRING", "The string contains an invalid X500 name attribute key, object identifier (OID), value, or delimiter."); + case 8228: return new Code(code, "CRYPT_E_NOT_CHAR_STRING", "The dwValueType for the CERT_NAME_VALUE is not one of the character strings. Most likely it is either a CERT_RDN_ENCODED_BLOB or CERT_TDN_OCTED_STRING."); + case 8229: return new Code(code, "CRYPT_E_FILERESIZED", "The Put operation cannot continue. The file needs to be resized. However, there is already a signature present. A complete signing operation must be done."); + case 8230: return new Code(code, "CRYPT_E_SECURITY_SETTINGS", "The cryptographic operation failed due to a local security option setting."); + case 8231: return new Code(code, "CRYPT_E_NO_VERIFY_USAGE_DLL", "No DLL or exported function was found to verify subject usage."); + case 8232: return new Code(code, "CRYPT_E_NO_VERIFY_USAGE_CHECK", "The called function was unable to perform a usage check on the subject."); + case 8233: return new Code(code, "CRYPT_E_VERIFY_USAGE_OFFLINE", "The called function was unable to complete the usage check because the server was offline."); + case 8234: return new Code(code, "CRYPT_E_NOT_IN_CTL", "The subject was not found in a certificate trust list (CTL)."); + case 8235: return new Code(code, "CRYPT_E_NO_TRUSTED_SIGNER", "None of the signers of the cryptographic message or certificate trust list is trusted."); + case 8236: return new Code(code, "CRYPT_E_MISSING_PUBKEY_PARA", "The public key's algorithm parameters are missing."); + case 12288: return new Code(code, "CRYPT_E_OSS_ERROR", "OSS Certificate encode/decode error code base."); + case 12289: return new Code(code, "OSS_MORE_BUF", "OSS ASN.1 Error: Output Buffer is too small."); + case 12290: return new Code(code, "OSS_NEGATIVE_UINTEGER", "OSS ASN.1 Error: Signed integer is encoded as a unsigned integer."); + case 12291: return new Code(code, "OSS_PDU_RANGE", "OSS ASN.1 Error: Unknown ASN.1 data type."); + case 12292: return new Code(code, "OSS_MORE_INPUT", "OSS ASN.1 Error: Output buffer is too small; the decoded data has been truncated."); + case 12293: return new Code(code, "OSS_DATA_ERROR", "OSS ASN.1 Error: Invalid data."); + case 12294: return new Code(code, "OSS_BAD_ARG", "OSS ASN.1 Error: Invalid argument."); + case 12295: return new Code(code, "OSS_BAD_VERSION", "OSS ASN.1 Error: Encode/Decode version mismatch."); + case 12296: return new Code(code, "OSS_OUT_MEMORY", "OSS ASN.1 Error: Out of memory."); + case 12297: return new Code(code, "OSS_PDU_MISMATCH", "OSS ASN.1 Error: Encode/Decode error."); + case 12298: return new Code(code, "OSS_LIMITED", "OSS ASN.1 Error: Internal error."); + case 12299: return new Code(code, "OSS_BAD_PTR", "OSS ASN.1 Error: Invalid data."); + case 12300: return new Code(code, "OSS_BAD_TIME", "OSS ASN.1 Error: Invalid data."); + case 12301: return new Code(code, "OSS_INDEFINITE_NOT_SUPPORTED", "OSS ASN.1 Error: Unsupported BER indefinite-length encoding."); + case 12302: return new Code(code, "OSS_MEM_ERROR", "OSS ASN.1 Error: Access violation."); + case 12303: return new Code(code, "OSS_BAD_TABLE", "OSS ASN.1 Error: Invalid data."); + case 12304: return new Code(code, "OSS_TOO_LONG", "OSS ASN.1 Error: Invalid data."); + case 12305: return new Code(code, "OSS_CONSTRAINT_VIOLATED", "OSS ASN.1 Error: Invalid data."); + case 12306: return new Code(code, "OSS_FATAL_ERROR", "OSS ASN.1 Error: Internal error."); + case 12307: return new Code(code, "OSS_ACCESS_SERIALIZATION_ERROR", "OSS ASN.1 Error: Multithreading conflict."); + case 12308: return new Code(code, "OSS_NULL_TBL", "OSS ASN.1 Error: Invalid data."); + case 12309: return new Code(code, "OSS_NULL_FCN", "OSS ASN.1 Error: Invalid data."); + case 12310: return new Code(code, "OSS_BAD_ENCRULES", "OSS ASN.1 Error: Invalid data."); + case 12311: return new Code(code, "OSS_UNAVAIL_ENCRULES", "OSS ASN.1 Error: Encode/Decode function not implemented."); + case 12312: return new Code(code, "OSS_CANT_OPEN_TRACE_WINDOW", "OSS ASN.1 Error: Trace file error."); + case 12313: return new Code(code, "OSS_UNIMPLEMENTED", "OSS ASN.1 Error: Function not implemented."); + case 12314: return new Code(code, "OSS_OID_DLL_NOT_LINKED", "OSS ASN.1 Error: Program link error."); + case 12315: return new Code(code, "OSS_CANT_OPEN_TRACE_FILE", "OSS ASN.1 Error: Trace file error."); + case 12316: return new Code(code, "OSS_TRACE_FILE_ALREADY_OPEN", "OSS ASN.1 Error: Trace file error."); + case 12317: return new Code(code, "OSS_TABLE_MISMATCH", "OSS ASN.1 Error: Invalid data."); + case 12318: return new Code(code, "OSS_TYPE_NOT_SUPPORTED", "OSS ASN.1 Error: Invalid data."); + case 12319: return new Code(code, "OSS_REAL_DLL_NOT_LINKED", "OSS ASN.1 Error: Program link error."); + case 12320: return new Code(code, "OSS_REAL_CODE_NOT_LINKED", "OSS ASN.1 Error: Program link error."); + case 12321: return new Code(code, "OSS_OUT_OF_RANGE", "OSS ASN.1 Error: Program link error."); + case 12322: return new Code(code, "OSS_COPIER_DLL_NOT_LINKED", "OSS ASN.1 Error: Program link error."); + case 12323: return new Code(code, "OSS_CONSTRAINT_DLL_NOT_LINKED", "OSS ASN.1 Error: Program link error."); + case 12324: return new Code(code, "OSS_COMPARATOR_DLL_NOT_LINKED", "OSS ASN.1 Error: Program link error."); + case 12325: return new Code(code, "OSS_COMPARATOR_CODE_NOT_LINKED", "OSS ASN.1 Error: Program link error."); + case 12326: return new Code(code, "OSS_MEM_MGR_DLL_NOT_LINKED", "OSS ASN.1 Error: Program link error."); + case 12327: return new Code(code, "OSS_PDV_DLL_NOT_LINKED", "OSS ASN.1 Error: Program link error."); + case 12328: return new Code(code, "OSS_PDV_CODE_NOT_LINKED", "OSS ASN.1 Error: Program link error."); + case 12329: return new Code(code, "OSS_API_DLL_NOT_LINKED", "OSS ASN.1 Error: Program link error."); + case 12330: return new Code(code, "OSS_BERDER_DLL_NOT_LINKED", "OSS ASN.1 Error: Program link error."); + case 12331: return new Code(code, "OSS_PER_DLL_NOT_LINKED", "OSS ASN.1 Error: Program link error."); + case 12332: return new Code(code, "OSS_OPEN_TYPE_ERROR", "OSS ASN.1 Error: Program link error."); + case 12333: return new Code(code, "OSS_MUTEX_NOT_CREATED", "OSS ASN.1 Error: System resource error."); + case 12334: return new Code(code, "OSS_CANT_CLOSE_TRACE_FILE", "OSS ASN.1 Error: Trace file error."); + case 12544: return new Code(code, "CRYPT_E_ASN1_ERROR", "ASN1 Certificate encode/decode error code base."); + case 12545: return new Code(code, "CRYPT_E_ASN1_INTERNAL", "ASN1 internal encode or decode error."); + case 12546: return new Code(code, "CRYPT_E_ASN1_EOD", "ASN1 unexpected end of data."); + case 12547: return new Code(code, "CRYPT_E_ASN1_CORRUPT", "ASN1 corrupted data."); + case 12548: return new Code(code, "CRYPT_E_ASN1_LARGE", "ASN1 value too large."); + case 12549: return new Code(code, "CRYPT_E_ASN1_CONSTRAINT", "ASN1 constraint violated."); + case 12550: return new Code(code, "CRYPT_E_ASN1_MEMORY", "ASN1 out of memory."); + case 12551: return new Code(code, "CRYPT_E_ASN1_OVERFLOW", "ASN1 buffer overflow."); + case 12552: return new Code(code, "CRYPT_E_ASN1_BADPDU", "ASN1 function not supported for this protocol data unit (PDU)."); + case 12553: return new Code(code, "CRYPT_E_ASN1_BADARGS", "ASN1 bad arguments to function call."); + case 12554: return new Code(code, "CRYPT_E_ASN1_BADREAL", "ASN1 bad real value."); + case 12555: return new Code(code, "CRYPT_E_ASN1_BADTAG", "ASN1 bad tag value met."); + case 12556: return new Code(code, "CRYPT_E_ASN1_CHOICE", "ASN1 bad choice value."); + case 12557: return new Code(code, "CRYPT_E_ASN1_RULE", "ASN1 bad encoding rule."); + case 12558: return new Code(code, "CRYPT_E_ASN1_UTF8", "ASN1 bad Unicode (UTF8)."); + case 12595: return new Code(code, "CRYPT_E_ASN1_PDU_TYPE", "ASN1 bad PDU type."); + case 12596: return new Code(code, "CRYPT_E_ASN1_NYI", "ASN1 not yet implemented."); + case 12801: return new Code(code, "CRYPT_E_ASN1_EXTENDED", "ASN1 skipped unknown extensions."); + case 12802: return new Code(code, "CRYPT_E_ASN1_NOEOD", "ASN1 end of data expected."); + case 16385: return new Code(code, "CERTSRV_E_BAD_REQUESTSUBJECT", "The request subject name is invalid or too long."); + case 16386: return new Code(code, "CERTSRV_E_NO_REQUEST", "The request does not exist."); + case 16387: return new Code(code, "CERTSRV_E_BAD_REQUESTSTATUS", "The request's current status does not allow this operation."); + case 16388: return new Code(code, "CERTSRV_E_PROPERTY_EMPTY", "The requested property value is empty."); + case 16389: return new Code(code, "CERTSRV_E_INVALID_CA_CERTIFICATE", "The CA's certificate contains invalid data."); + case 16390: return new Code(code, "CERTSRV_E_SERVER_SUSPENDED", "Certificate service has been suspended for a database restore operation."); + case 16391: return new Code(code, "CERTSRV_E_ENCODING_LENGTH", "The certificate contains an encoded length that is potentially incompatible with older enrollment software."); + case 16392: return new Code(code, "CERTSRV_E_ROLECONFLICT", "The operation is denied. The user has multiple roles assigned, and the CA is configured to enforce role separation."); + case 16393: return new Code(code, "CERTSRV_E_RESTRICTEDOFFICER", "The operation is denied. It can only be performed by a certificate manager that is allowed to manage certificates for the current requester."); + case 16394: return new Code(code, "CERTSRV_E_KEY_ARCHIVAL_NOT_CONFIGURED", "Cannot archive private key. The CA is not configured for key archival."); + case 16395: return new Code(code, "CERTSRV_E_NO_VALID_KRA", "Cannot archive private key. The CA could not verify one or more key recovery certificates."); + case 16396: return new Code(code, "CERTSRV_E_BAD_REQUEST_KEY_ARCHIVAL", "The request is incorrectly formatted. The encrypted private key must be in an unauthenticated attribute in an outermost signature."); + case 16397: return new Code(code, "CERTSRV_E_NO_CAADMIN_DEFINED", "At least one security principal must have the permission to manage this CA."); + case 16398: return new Code(code, "CERTSRV_E_BAD_RENEWAL_CERT_ATTRIBUTE", "The request contains an invalid renewal certificate attribute."); + case 16399: return new Code(code, "CERTSRV_E_NO_DB_SESSIONS", "An attempt was made to open a CA database session, but there are already too many active sessions. The server needs to be configured to allow additional sessions."); + case 16400: return new Code(code, "CERTSRV_E_ALIGNMENT_FAULT", "A memory reference caused a data alignment fault."); + case 16401: return new Code(code, "CERTSRV_E_ENROLL_DENIED", "The permissions on this CA do not allow the current user to enroll for certificates."); + case 16402: return new Code(code, "CERTSRV_E_TEMPLATE_DENIED", "The permissions on the certificate template do not allow the current user to enroll for this type of certificate."); + case 16403: return new Code(code, "CERTSRV_E_DOWNLEVEL_DC_SSL_OR_UPGRADE", "The contacted domain controller cannot support signed Lightweight Directory Access Protocol (LDAP) traffic. Update the domain controller or configure Certificate Services to use SSL for Active Directory access."); + case 18432: return new Code(code, "CERTSRV_E_UNSUPPORTED_CERT_TYPE", "The requested certificate template is not supported by this CA."); + case 18433: return new Code(code, "CERTSRV_E_NO_CERT_TYPE", "The request contains no certificate template information."); + case 18434: return new Code(code, "CERTSRV_E_TEMPLATE_CONFLICT", "The request contains conflicting template information."); + case 18435: return new Code(code, "CERTSRV_E_SUBJECT_ALT_NAME_REQUIRED", "The request is missing a required Subject Alternate name extension."); + case 18436: return new Code(code, "CERTSRV_E_ARCHIVED_KEY_REQUIRED", "The request is missing a required private key for archival by the server."); + case 18437: return new Code(code, "CERTSRV_E_SMIME_REQUIRED", "The request is missing a required SMIME capabilities extension."); + case 18438: return new Code(code, "CERTSRV_E_BAD_RENEWAL_SUBJECT", "The request was made on behalf of a subject other than the caller. The certificate template must be configured to require at least one signature to authorize the request."); + case 18439: return new Code(code, "CERTSRV_E_BAD_TEMPLATE_VERSION", "The request template version is newer than the supported template version."); + case 18440: return new Code(code, "CERTSRV_E_TEMPLATE_POLICY_REQUIRED", "The template is missing a required signature policy attribute."); + case 18441: return new Code(code, "CERTSRV_E_SIGNATURE_POLICY_REQUIRED", "The request is missing required signature policy information."); + case 18442: return new Code(code, "CERTSRV_E_SIGNATURE_COUNT", "The request is missing one or more required signatures."); + case 18443: return new Code(code, "CERTSRV_E_SIGNATURE_REJECTED", "One or more signatures did not include the required application or issuance policies. The request is missing one or more required valid signatures."); + case 18444: return new Code(code, "CERTSRV_E_ISSUANCE_POLICY_REQUIRED", "The request is missing one or more required signature issuance policies."); + case 18445: return new Code(code, "CERTSRV_E_SUBJECT_UPN_REQUIRED", "The UPN is unavailable and cannot be added to the Subject Alternate name."); + case 18446: return new Code(code, "CERTSRV_E_SUBJECT_DIRECTORY_GUID_REQUIRED", "The Active Directory GUID is unavailable and cannot be added to the Subject Alternate name."); + case 18447: return new Code(code, "CERTSRV_E_SUBJECT_DNS_REQUIRED", "The Domain Name System (DNS) name is unavailable and cannot be added to the Subject Alternate name."); + case 18448: return new Code(code, "CERTSRV_E_ARCHIVED_KEY_UNEXPECTED", "The request includes a private key for archival by the server, but key archival is not enabled for the specified certificate template."); + case 18449: return new Code(code, "CERTSRV_E_KEY_LENGTH", "The public key does not meet the minimum size required by the specified certificate template."); + case 18450: return new Code(code, "CERTSRV_E_SUBJECT_EMAIL_REQUIRED", "The email name is unavailable and cannot be added to the Subject or Subject Alternate name."); + case 18451: return new Code(code, "CERTSRV_E_UNKNOWN_CERT_TYPE", "One or more certificate templates to be enabled on this CA could not be found."); + case 18452: return new Code(code, "CERTSRV_E_CERT_TYPE_OVERLAP", "The certificate template renewal period is longer than the certificate validity period. The template should be reconfigured or the CA certificate renewed."); + case 18453: return new Code(code, "CERTSRV_E_TOO_MANY_SIGNATURES", "The certificate template requires too many return authorization (RA) signatures. Only one RA signature is allowed."); + case 18454: return new Code(code, "CERTSRV_E_RENEWAL_BAD_PUBLIC_KEY", "The key used in a renewal request does not match one of the certificates being renewed."); + case 18455: return new Code(code, "CERTSRV_E_INVALID_EK", "The endorsement key certificate is not valid."); + case 18458: return new Code(code, "CERTSRV_E_KEY_ATTESTATION", "Key attestation did not succeed."); + case 20480: return new Code(code, "XENROLL_E_KEY_NOT_EXPORTABLE", "The key is not exportable."); + case 20481: return new Code(code, "XENROLL_E_CANNOT_ADD_ROOT_CERT", "You cannot add the root CA certificate into your local store."); + case 20482: return new Code(code, "XENROLL_E_RESPONSE_KA_HASH_NOT_FOUND", "The key archival hash attribute was not found in the response."); + case 20483: return new Code(code, "XENROLL_E_RESPONSE_UNEXPECTED_KA_HASH", "An unexpected key archival hash attribute was found in the response."); + case 20484: return new Code(code, "XENROLL_E_RESPONSE_KA_HASH_MISMATCH", "There is a key archival hash mismatch between the request and the response."); + case 20485: return new Code(code, "XENROLL_E_KEYSPEC_SMIME_MISMATCH", "Signing certificate cannot include SMIME extension."); + case 24577: return new Code(code, "TRUST_E_SYSTEM_ERROR", "A system-level error occurred while verifying trust."); + case 24578: return new Code(code, "TRUST_E_NO_SIGNER_CERT", "The certificate for the signer of the message is invalid or not found."); + case 24579: return new Code(code, "TRUST_E_COUNTER_SIGNER", "One of the counter signatures was invalid."); + case 24580: return new Code(code, "TRUST_E_CERT_SIGNATURE", "The signature of the certificate cannot be verified."); + case 24581: return new Code(code, "TRUST_E_TIME_STAMP", "The time-stamp signature or certificate could not be verified or is malformed."); + case 24592: return new Code(code, "TRUST_E_BAD_DIGEST", "The digital signature of the object did not verify."); + case 24601: return new Code(code, "TRUST_E_BASIC_CONSTRAINTS", "A certificate's basic constraint extension has not been observed."); + case 24606: return new Code(code, "TRUST_E_FINANCIAL_CRITERIA", "The certificate does not meet or contain the Authenticode financial extensions."); + case 28673: return new Code(code, "MSSIPOTF_E_OUTOFMEMRANGE", "Tried to reference a part of the file outside the proper range."); + case 28674: return new Code(code, "MSSIPOTF_E_CANTGETOBJECT", "Could not retrieve an object from the file."); + case 28675: return new Code(code, "MSSIPOTF_E_NOHEADTABLE", "Could not find the head table in the file."); + case 28676: return new Code(code, "MSSIPOTF_E_BAD_MAGICNUMBER", "The magic number in the head table is incorrect."); + case 28677: return new Code(code, "MSSIPOTF_E_BAD_OFFSET_TABLE", "The offset table has incorrect values."); + case 28678: return new Code(code, "MSSIPOTF_E_TABLE_TAGORDER", "Duplicate table tags or the tags are out of alphabetical order."); + case 28679: return new Code(code, "MSSIPOTF_E_TABLE_LONGWORD", "A table does not start on a long word boundary."); + case 28680: return new Code(code, "MSSIPOTF_E_BAD_FIRST_TABLE_PLACEMENT", "First table does not appear after header information."); + case 28681: return new Code(code, "MSSIPOTF_E_TABLES_OVERLAP", "Two or more tables overlap."); + case 28682: return new Code(code, "MSSIPOTF_E_TABLE_PADBYTES", "Too many pad bytes between tables, or pad bytes are not 0."); + case 28683: return new Code(code, "MSSIPOTF_E_FILETOOSMALL", "File is too small to contain the last table."); + case 28684: return new Code(code, "MSSIPOTF_E_TABLE_CHECKSUM", "A table checksum is incorrect."); + case 28685: return new Code(code, "MSSIPOTF_E_FILE_CHECKSUM", "The file checksum is incorrect."); + case 28688: return new Code(code, "MSSIPOTF_E_FAILED_POLICY", "The signature does not have the correct attributes for the policy."); + case 28689: return new Code(code, "MSSIPOTF_E_FAILED_HINTS_CHECK", "The file did not pass the hints check."); + case 28690: return new Code(code, "MSSIPOTF_E_NOT_OPENTYPE", "The file is not an OpenType file."); + case 28691: return new Code(code, "MSSIPOTF_E_FILE", "Failed on a file operation (such as open, map, read, or write)."); + case 28692: return new Code(code, "MSSIPOTF_E_CRYPT", "A call to a CryptoAPI function failed."); + case 28693: return new Code(code, "MSSIPOTF_E_BADVERSION", "There is a bad version number in the file."); + case 28694: return new Code(code, "MSSIPOTF_E_DSIG_STRUCTURE", "The structure of the DSIG table is incorrect."); + case 28695: return new Code(code, "MSSIPOTF_E_PCONST_CHECK", "A check failed in a partially constant table."); + case 28696: return new Code(code, "MSSIPOTF_E_STRUCTURE", "Some kind of structural error."); + case 28697: return new Code(code, "ERROR_CRED_REQUIRES_CONFIRMATION", "The requested credential requires confirmation."); + } + } + else + { + switch (code) + { + case 786: return new Code(code, "SEC_I_CONTINUE_NEEDED", "The function completed successfully, but it must be called again to complete the context."); + case 787: return new Code(code, "SEC_I_COMPLETE_NEEDED", "The function completed successfully, but CompleteToken must be called."); + case 788: return new Code(code, "SEC_I_COMPLETE_AND_CONTINUE", "The function completed successfully, but both CompleteToken and this function must be called to complete the context."); + case 789: return new Code(code, "SEC_I_LOCAL_LOGON", "The logon was completed, but no network authority was available. The logon was made using locally known information."); + case 791: return new Code(code, "SEC_I_CONTEXT_EXPIRED", "The context has expired and can no longer be used."); + case 800: return new Code(code, "SEC_I_INCOMPLETE_CREDENTIALS", "The credentials supplied were not complete and could not be verified. Additional information can be returned from the context."); + case 801: return new Code(code, "SEC_I_RENEGOTIATE", "The context data must be renegotiated with the peer."); + case 803: return new Code(code, "SEC_I_NO_LSA_CONTEXT", "There is no LSA mode context associated with this context."); + case 860: return new Code(code, "SEC_I_SIGNATURE_NEEDED", "A signature operation must be performed before the user can authenticate."); + case 4114: return new Code(code, "CRYPT_I_NEW_PROTECTION_REQUIRED", "The protected data needs to be reprotected."); + } + } + + return Unknown(code); + } + } +} diff --git a/src/Elmah.Io.HResults/Facilities/FacilitySetupapiResolver.cs b/src/Elmah.Io.HResults/Facilities/FacilitySetupapiResolver.cs new file mode 100644 index 0000000..d119b81 --- /dev/null +++ b/src/Elmah.Io.HResults/Facilities/FacilitySetupapiResolver.cs @@ -0,0 +1,104 @@ +namespace Elmah.Io.HResults.Facilities +{ + internal class FacilitySetupapiResolver : FacilityResolverBase + { + public FacilitySetupapiResolver() : base(15, "FACILITY_SETUPAPI") + { + } + + internal override Code Resolve(bool failure, int code) + { + return code switch + { + 0 => new Code(code, "SPAPI_E_EXPECTED_SECTION_NAME", "A non-empty line was encountered in the INF before the start of a section."), + 1 => new Code(code, "SPAPI_E_BAD_SECTION_NAME_LINE", "A section name marker in the information file (INF) is not complete or does not exist on a line by itself."), + 2 => new Code(code, "SPAPI_E_SECTION_NAME_TOO_LONG", "An INF section was encountered whose name exceeds the maximum section name length."), + 3 => new Code(code, "SPAPI_E_GENERAL_SYNTAX", "The syntax of the INF is invalid."), + 256 => new Code(code, "SPAPI_E_WRONG_INF_STYLE", "The style of the INF is different than what was requested."), + 257 => new Code(code, "SPAPI_E_SECTION_NOT_FOUND", "The required section was not found in the INF."), + 258 => new Code(code, "SPAPI_E_LINE_NOT_FOUND", "The required line was not found in the INF."), + 259 => new Code(code, "SPAPI_E_NO_BACKUP", "The files affected by the installation of this file queue have not been backed up for uninstall."), + 512 => new Code(code, "SPAPI_E_NO_ASSOCIATED_CLASS", "The INF or the device information set or element does not have an associated install class."), + 513 => new Code(code, "SPAPI_E_CLASS_MISMATCH", "The INF or the device information set or element does not match the specified install class."), + 514 => new Code(code, "SPAPI_E_DUPLICATE_FOUND", "An existing device was found that is a duplicate of the device being manually installed."), + 515 => new Code(code, "SPAPI_E_NO_DRIVER_SELECTED", "There is no driver selected for the device information set or element."), + 516 => new Code(code, "SPAPI_E_KEY_DOES_NOT_EXIST", "The requested device registry key does not exist."), + 517 => new Code(code, "SPAPI_E_INVALID_DEVINST_NAME", "The device instance name is invalid."), + 518 => new Code(code, "SPAPI_E_INVALID_CLASS", "The install class is not present or is invalid."), + 519 => new Code(code, "SPAPI_E_DEVINST_ALREADY_EXISTS", "The device instance cannot be created because it already exists."), + 520 => new Code(code, "SPAPI_E_DEVINFO_NOT_REGISTERED", "The operation cannot be performed on a device information element that has not been registered."), + 521 => new Code(code, "SPAPI_E_INVALID_REG_PROPERTY", "The device property code is invalid."), + 522 => new Code(code, "SPAPI_E_NO_INF", "The INF from which a driver list is to be built does not exist."), + 523 => new Code(code, "SPAPI_E_NO_SUCH_DEVINST", "The device instance does not exist in the hardware tree."), + 524 => new Code(code, "SPAPI_E_CANT_LOAD_CLASS_ICON", "The icon representing this install class cannot be loaded."), + 525 => new Code(code, "SPAPI_E_INVALID_CLASS_INSTALLER", "The class installer registry entry is invalid."), + 526 => new Code(code, "SPAPI_E_DI_DO_DEFAULT", "The class installer has indicated that the default action should be performed for this installation request."), + 527 => new Code(code, "SPAPI_E_DI_NOFILECOPY", "The operation does not require any files to be copied."), + 528 => new Code(code, "SPAPI_E_INVALID_HWPROFILE", "The specified hardware profile does not exist."), + 529 => new Code(code, "SPAPI_E_NO_DEVICE_SELECTED", "There is no device information element currently selected for this device information set."), + 530 => new Code(code, "SPAPI_E_DEVINFO_LIST_LOCKED", "The operation cannot be performed because the device information set is locked."), + 531 => new Code(code, "SPAPI_E_DEVINFO_DATA_LOCKED", "The operation cannot be performed because the device information element is locked."), + 532 => new Code(code, "SPAPI_E_DI_BAD_PATH", "The specified path does not contain any applicable device INFs."), + 533 => new Code(code, "SPAPI_E_NO_CLASSINSTALL_PARAMS", "No class installer parameters have been set for the device information set or element."), + 534 => new Code(code, "SPAPI_E_FILEQUEUE_LOCKED", "The operation cannot be performed because the file queue is locked."), + 535 => new Code(code, "SPAPI_E_BAD_SERVICE_INSTALLSECT", "A service installation section in this INF is invalid."), + 536 => new Code(code, "SPAPI_E_NO_CLASS_DRIVER_LIST", "There is no class driver list for the device information element."), + 537 => new Code(code, "SPAPI_E_NO_ASSOCIATED_SERVICE", "The installation failed because a function driver was not specified for this device instance."), + 538 => new Code(code, "SPAPI_E_NO_DEFAULT_DEVICE_INTERFACE", "There is presently no default device interface designated for this interface class."), + 539 => new Code(code, "SPAPI_E_DEVICE_INTERFACE_ACTIVE", "The operation cannot be performed because the device interface is currently active."), + 540 => new Code(code, "SPAPI_E_DEVICE_INTERFACE_REMOVED", "The operation cannot be performed because the device interface has been removed from the system."), + 541 => new Code(code, "SPAPI_E_BAD_INTERFACE_INSTALLSECT", "An interface installation section in this INF is invalid."), + 542 => new Code(code, "SPAPI_E_NO_SUCH_INTERFACE_CLASS", "This interface class does not exist in the system."), + 543 => new Code(code, "SPAPI_E_INVALID_REFERENCE_STRING", "The reference string supplied for this interface device is invalid."), + 544 => new Code(code, "SPAPI_E_INVALID_MACHINENAME", "The specified machine name does not conform to Universal Naming Convention (UNCs)."), + 545 => new Code(code, "SPAPI_E_REMOTE_COMM_FAILURE", "A general remote communication error occurred."), + 546 => new Code(code, "SPAPI_E_MACHINE_UNAVAILABLE", "The machine selected for remote communication is not available at this time."), + 547 => new Code(code, "SPAPI_E_NO_CONFIGMGR_SERVICES", "The Plug and Play service is not available on the remote machine."), + 548 => new Code(code, "SPAPI_E_INVALID_PROPPAGE_PROVIDER", "The property page provider registry entry is invalid."), + 549 => new Code(code, "SPAPI_E_NO_SUCH_DEVICE_INTERFACE", "The requested device interface is not present in the system."), + 550 => new Code(code, "SPAPI_E_DI_POSTPROCESSING_REQUIRED", "The device's co-installer has additional work to perform after installation is complete."), + 551 => new Code(code, "SPAPI_E_INVALID_COINSTALLER", "The device's co-installer is invalid."), + 552 => new Code(code, "SPAPI_E_NO_COMPAT_DRIVERS", "There are no compatible drivers for this device."), + 553 => new Code(code, "SPAPI_E_NO_DEVICE_ICON", "There is no icon that represents this device or device type."), + 554 => new Code(code, "SPAPI_E_INVALID_INF_LOGCONFIG", "A logical configuration specified in this INF is invalid."), + 555 => new Code(code, "SPAPI_E_DI_DONT_INSTALL", "The class installer has denied the request to install or upgrade this device."), + 556 => new Code(code, "SPAPI_E_INVALID_FILTER_DRIVER", "One of the filter drivers installed for this device is invalid."), + 557 => new Code(code, "SPAPI_E_NON_WINDOWS_NT_DRIVER", "The driver selected for this device does not support Windows XP operating system."), + 558 => new Code(code, "SPAPI_E_NON_WINDOWS_DRIVER", "The driver selected for this device does not support Windows."), + 559 => new Code(code, "SPAPI_E_NO_CATALOG_FOR_OEM_INF", "The third-party INF does not contain digital signature information."), + 560 => new Code(code, "SPAPI_E_DEVINSTALL_QUEUE_NONNATIVE", "An invalid attempt was made to use a device installation file queue for verification of digital signatures relative to other platforms."), + 561 => new Code(code, "SPAPI_E_NOT_DISABLEABLE", "The device cannot be disabled."), + 562 => new Code(code, "SPAPI_E_CANT_REMOVE_DEVINST", "The device could not be dynamically removed."), + 563 => new Code(code, "SPAPI_E_INVALID_TARGET", "Cannot copy to specified target."), + 564 => new Code(code, "SPAPI_E_DRIVER_NONNATIVE", "Driver is not intended for this platform."), + 565 => new Code(code, "SPAPI_E_IN_WOW64", "Operation not allowed in WOW64."), + 566 => new Code(code, "SPAPI_E_SET_SYSTEM_RESTORE_POINT", "The operation involving unsigned file copying was rolled back, so that a system restore point could be set."), + 567 => new Code(code, "SPAPI_E_INCORRECTLY_COPIED_INF", "An INF was copied into the Windows INF directory in an improper manner."), + 568 => new Code(code, "SPAPI_E_SCE_DISABLED", "The Security Configuration Editor (SCE) APIs have been disabled on this embedded product."), + 569 => new Code(code, "SPAPI_E_UNKNOWN_EXCEPTION", "An unknown exception was encountered."), + 570 => new Code(code, "SPAPI_E_PNP_REGISTRY_ERROR", "A problem was encountered when accessing the Plug and Play registry database."), + 571 => new Code(code, "SPAPI_E_REMOTE_REQUEST_UNSUPPORTED", "The requested operation is not supported for a remote machine."), + 572 => new Code(code, "SPAPI_E_NOT_AN_INSTALLED_OEM_INF", "The specified file is not an installed original equipment manufacturer (OEM) INF."), + 573 => new Code(code, "SPAPI_E_INF_IN_USE_BY_DEVICES", "One or more devices are presently installed using the specified INF."), + 574 => new Code(code, "SPAPI_E_DI_FUNCTION_OBSOLETE", "The requested device install operation is obsolete."), + 575 => new Code(code, "SPAPI_E_NO_AUTHENTICODE_CATALOG", "A file could not be verified because it does not have an associated catalog signed via Authenticode."), + 576 => new Code(code, "SPAPI_E_AUTHENTICODE_DISALLOWED", "Authenticode signature verification is not supported for the specified INF."), + 577 => new Code(code, "SPAPI_E_AUTHENTICODE_TRUSTED_PUBLISHER", "The INF was signed with an Authenticode catalog from a trusted publisher."), + 578 => new Code(code, "SPAPI_E_AUTHENTICODE_TRUST_NOT_ESTABLISHED", "The publisher of an Authenticode-signed catalog has not yet been established as trusted."), + 579 => new Code(code, "SPAPI_E_AUTHENTICODE_PUBLISHER_NOT_TRUSTED", "The publisher of an Authenticode-signed catalog was not established as trusted."), + 580 => new Code(code, "SPAPI_E_SIGNATURE_OSATTRIBUTE_MISMATCH", "The software was tested for compliance with Windows logo requirements on a different version of Windows and might not be compatible with this version."), + 581 => new Code(code, "SPAPI_E_ONLY_VALIDATE_VIA_AUTHENTICODE", "The file can be validated only by a catalog signed via Authenticode."), + 582 => new Code(code, "SPAPI_E_DEVICE_INSTALLER_NOT_READY", "One of the installers for this device cannot perform the installation at this time."), + 583 => new Code(code, "SPAPI_E_DRIVER_STORE_ADD_FAILED", "A problem was encountered while attempting to add the driver to the store."), + 584 => new Code(code, "SPAPI_E_DEVICE_INSTALL_BLOCKED", "The installation of this device is forbidden by system policy. Contact your system administrator."), + 585 => new Code(code, "SPAPI_E_DRIVER_INSTALL_BLOCKED", "The installation of this driver is forbidden by system policy. Contact your system administrator."), + 586 => new Code(code, "SPAPI_E_WRONG_INF_TYPE", "The specified INF is the wrong type for this operation."), + 587 => new Code(code, "SPAPI_E_FILE_HASH_NOT_IN_CATALOG", "The hash for the file is not present in the specified catalog file. The file is likely corrupt or the victim of tampering."), + 588 => new Code(code, "SPAPI_E_DRIVER_STORE_DELETE_FAILED", "A problem was encountered while attempting to delete the driver from the store."), + 768 => new Code(code, "SPAPI_E_UNRECOVERABLE_STACK_OVERFLOW", "An unrecoverable stack overflow was encountered."), + 4096 => new Code(code, "SPAPI_E_ERROR_NOT_INSTALLED", "No installed components were detected."), + _ => Unknown(code), + }; + } + } +} diff --git a/src/Elmah.Io.HResults/Facilities/FacilityStorageResolver.cs b/src/Elmah.Io.HResults/Facilities/FacilityStorageResolver.cs new file mode 100644 index 0000000..99559f0 --- /dev/null +++ b/src/Elmah.Io.HResults/Facilities/FacilityStorageResolver.cs @@ -0,0 +1,81 @@ +namespace Elmah.Io.HResults.Facilities +{ + internal class FacilityStorageResolver : FacilityResolverBase + { + public FacilityStorageResolver() : base(3, "FACILITY_STORAGE") + { + } + + internal override Code Resolve(bool failure, int code) + { + if (failure) + { + switch (code) + { + case 1: return new Code(code, "STG_E_INVALIDFUNCTION", "Unable to perform requested operation."); + case 2: return new Code(code, "STG_E_FILENOTFOUND", "%1 could not be found."); + case 3: return new Code(code, "STG_E_PATHNOTFOUND", "The path %1 could not be found."); + case 4: return new Code(code, "STG_E_TOOMANYOPENFILES", "There are insufficient resources to open another file."); + case 5: return new Code(code, "STG_E_ACCESSDENIED", "Access denied."); + case 6: return new Code(code, "STG_E_INVALIDHANDLE", "Attempted an operation on an invalid object."); + case 8: return new Code(code, "STG_E_INSUFFICIENTMEMORY", "There is insufficient memory available to complete operation."); + case 9: return new Code(code, "STG_E_INVALIDPOINTER", "Invalid pointer error."); + case 18: return new Code(code, "STG_E_NOMOREFILES", "There are no more entries to return."); + case 19: return new Code(code, "STG_E_DISKISWRITEPROTECTED", "Disk is write-protected."); + case 25: return new Code(code, "STG_E_SEEKERROR", "An error occurred during a seek operation."); + case 29: return new Code(code, "STG_E_WRITEFAULT", "A disk error occurred during a write operation."); + case 30: return new Code(code, "STG_E_READFAULT", "A disk error occurred during a read operation."); + case 32: return new Code(code, "STG_E_SHAREVIOLATION", "A share violation has occurred."); + case 33: return new Code(code, "STG_E_LOCKVIOLATION", "A lock violation has occurred."); + case 80: return new Code(code, "STG_E_FILEALREADYEXISTS", "%1 already exists."); + case 87: return new Code(code, "STG_E_INVALIDPARAMETER", "Invalid parameter error."); + case 112: return new Code(code, "STG_E_MEDIUMFULL", "There is insufficient disk space to complete operation."); + case 240: return new Code(code, "STG_E_PROPSETMISMATCHED", "Illegal write of non-simple property to simple property set."); + case 250: return new Code(code, "STG_E_ABNORMALAPIEXIT", "An application programming interface (API) call exited abnormally."); + case 251: return new Code(code, "STG_E_INVALIDHEADER", "The file %1 is not a valid compound file."); + case 252: return new Code(code, "STG_E_INVALIDNAME", "The name %1 is not valid."); + case 253: return new Code(code, "STG_E_UNKNOWN", "An unexpected error occurred."); + case 254: return new Code(code, "STG_E_UNIMPLEMENTEDFUNCTION", "That function is not implemented."); + case 255: return new Code(code, "STG_E_INVALIDFLAG", "Invalid flag error."); + case 256: return new Code(code, "STG_E_INUSE", "Attempted to use an object that is busy."); + case 257: return new Code(code, "STG_E_NOTCURRENT", "The storage has been changed since the last commit."); + case 258: return new Code(code, "STG_E_REVERTED", "Attempted to use an object that has ceased to exist."); + case 259: return new Code(code, "STG_E_CANTSAVE", "Cannot save."); + case 260: return new Code(code, "STG_E_OLDFORMAT", "The compound file %1 was produced with an incompatible version of storage."); + case 261: return new Code(code, "STG_E_OLDDLL", "The compound file %1 was produced with a newer version of storage."); + case 262: return new Code(code, "STG_E_SHAREREQUIRED", "Share.exe or equivalent is required for operation."); + case 263: return new Code(code, "STG_E_NOTFILEBASEDSTORAGE", "Illegal operation called on non-file based storage."); + case 264: return new Code(code, "STG_E_EXTANTMARSHALLINGS", "Illegal operation called on object with extant marshalings."); + case 265: return new Code(code, "STG_E_DOCFILECORRUPT", "The docfile has been corrupted."); + case 272: return new Code(code, "STG_E_BADBASEADDRESS", "OLE32.DLL has been loaded at the wrong address."); + case 273: return new Code(code, "STG_E_DOCFILETOOLARGE", "The compound file is too large for the current implementation."); + case 274: return new Code(code, "STG_E_NOTSIMPLEFORMAT", "The compound file was not created with the STGM_SIMPLE flag."); + case 513: return new Code(code, "STG_E_INCOMPLETE", "The file download was aborted abnormally. The file is incomplete."); + case 514: return new Code(code, "STG_E_TERMINATED", "The file download has been terminated."); + case 773: return new Code(code, "STG_E_STATUS_COPY_PROTECTION_FAILURE", "Generic Copy Protection Error."); + case 774: return new Code(code, "STG_E_CSS_AUTHENTICATION_FAILURE", "Copy Protection Error—DVD CSS Authentication failed."); + case 775: return new Code(code, "STG_E_CSS_KEY_NOT_PRESENT", "Copy Protection Error—The given sector does not have a valid CSS key."); + case 776: return new Code(code, "STG_E_CSS_KEY_NOT_ESTABLISHED", "Copy Protection Error—DVD session key not established."); + case 777: return new Code(code, "STG_E_CSS_SCRAMBLED_SECTOR", "Copy Protection Error—The read failed because the sector is encrypted."); + case 778: return new Code(code, "STG_E_CSS_REGION_MISMATCH", "Copy Protection Error—The current DVD's region does not correspond to the region setting of the drive."); + case 779: return new Code(code, "STG_E_RESETS_EXHAUSTED", "Copy Protection Error—The drive's region setting might be permanent or the number of user resets has been exhausted."); + } + } + else + { + switch (code) + { + case 512: return new Code(code, "STG_S_CONVERTED", "The underlying file was converted to compound file format."); + case 513: return new Code(code, "STG_S_BLOCK", "The storage operation should block until more data is available."); + case 514: return new Code(code, "STG_S_RETRYNOW", "The storage operation should retry immediately."); + case 515: return new Code(code, "STG_S_MONITORING", "The notified event sink will not influence the storage operation."); + case 516: return new Code(code, "STG_S_MULTIPLEOPENS", "Multiple opens prevent consolidated (commit succeeded)."); + case 517: return new Code(code, "STG_S_CONSOLIDATIONFAILED", "Consolidation of the storage file failed (commit succeeded)."); + case 518: return new Code(code, "STG_S_CANNOTCONSOLIDATE", "Consolidation of the storage file is inappropriate (commit succeeded)."); + } + } + + return Unknown(code); + } + } +} diff --git a/src/Elmah.Io.HResults/Facilities/FacilityTpmServicesResolver.cs b/src/Elmah.Io.HResults/Facilities/FacilityTpmServicesResolver.cs new file mode 100644 index 0000000..a1d9209 --- /dev/null +++ b/src/Elmah.Io.HResults/Facilities/FacilityTpmServicesResolver.cs @@ -0,0 +1,139 @@ +namespace Elmah.Io.HResults.Facilities +{ + internal class FacilityTpmServicesResolver : FacilityResolverBase + { + public FacilityTpmServicesResolver() : base(40, "FACILITY_TPM_SERVICES") + { + } + + internal override Code Resolve(bool failure, int code) + { + return code switch + { + 0 => new Code(code, "TPM_E_ERROR_MASK", "This is an error mask to convert Trusted Platform Module (TPM) hardware errors to Win32 errors."), + 1 => new Code(code, "TPM_E_AUTHFAIL", "Authentication failed."), + 2 => new Code(code, "TPM_E_BADINDEX", "The index to a Platform Configuration Register (PCR), DIR, or other register is incorrect."), + 3 => new Code(code, "TPM_E_BAD_PARAMETER", "One or more parameters are bad."), + 4 => new Code(code, "TPM_E_AUDITFAILURE", "An operation completed successfully but the auditing of that operation failed."), + 5 => new Code(code, "TPM_E_CLEAR_DISABLED", "The clear disable flag is set and all clear operations now require physical access."), + 6 => new Code(code, "TPM_E_DEACTIVATED", "The TPM is deactivated."), + 7 => new Code(code, "TPM_E_DISABLED", "The TPM is disabled."), + 8 => new Code(code, "TPM_E_DISABLED_CMD", "The target command has been disabled."), + 9 => new Code(code, "TPM_E_FAIL", "The operation failed."), + 10 => new Code(code, "TPM_E_BAD_ORDINAL", "The ordinal was unknown or inconsistent."), + 11 => new Code(code, "TPM_E_INSTALL_DISABLED", "The ability to install an owner is disabled."), + 12 => new Code(code, "TPM_E_INVALID_KEYHANDLE", "The key handle cannot be interpreted."), + 13 => new Code(code, "TPM_E_KEYNOTFOUND", "The key handle points to an invalid key."), + 14 => new Code(code, "TPM_E_INAPPROPRIATE_ENC", "Unacceptable encryption scheme."), + 15 => new Code(code, "TPM_E_MIGRATEFAIL", "Migration authorization failed."), + 16 => new Code(code, "TPM_E_INVALID_PCR_INFO", "PCR information could not be interpreted."), + 17 => new Code(code, "TPM_E_NOSPACE", "No room to load key."), + 18 => new Code(code, "TPM_E_NOSRK", "There is no storage root key (SRK) set."), + 19 => new Code(code, "TPM_E_NOTSEALED_BLOB", "An encrypted blob is invalid or was not created by this TPM."), + 20 => new Code(code, "TPM_E_OWNER_SET", "There is already an owner."), + 21 => new Code(code, "TPM_E_RESOURCES", "The TPM has insufficient internal resources to perform the requested action."), + 22 => new Code(code, "TPM_E_SHORTRANDOM", "A random string was too short."), + 23 => new Code(code, "TPM_E_SIZE", "The TPM does not have the space to perform the operation."), + 24 => new Code(code, "TPM_E_WRONGPCRVAL", "The named PCR value does not match the current PCR value."), + 25 => new Code(code, "TPM_E_BAD_PARAM_SIZE", "The paramSize argument to the command has the incorrect value."), + 26 => new Code(code, "TPM_E_SHA_THREAD", "There is no existing SHA-1 thread."), + 27 => new Code(code, "TPM_E_SHA_ERROR", "The calculation is unable to proceed because the existing SHA-1 thread has already encountered an error."), + 28 => new Code(code, "TPM_E_FAILEDSELFTEST", "Self-test has failed and the TPM has shut down."), + 29 => new Code(code, "TPM_E_AUTH2FAIL", "The authorization for the second key in a two-key function failed authorization."), + 30 => new Code(code, "TPM_E_BADTAG", "The tag value sent to for a command is invalid."), + 31 => new Code(code, "TPM_E_IOERROR", "An I/O error occurred transmitting information to the TPM."), + 32 => new Code(code, "TPM_E_ENCRYPT_ERROR", "The encryption process had a problem."), + 33 => new Code(code, "TPM_E_DECRYPT_ERROR", "The decryption process did not complete."), + 34 => new Code(code, "TPM_E_INVALID_AUTHHANDLE", "An invalid handle was used."), + 35 => new Code(code, "TPM_E_NO_ENDORSEMENT", "The TPM does not have an endorsement key (EK) installed."), + 36 => new Code(code, "TPM_E_INVALID_KEYUSAGE", "The usage of a key is not allowed."), + 37 => new Code(code, "TPM_E_WRONG_ENTITYTYPE", "The submitted entity type is not allowed."), + 38 => new Code(code, "TPM_E_INVALID_POSTINIT", "The command was received in the wrong sequence relative to TPM_Init and a subsequent TPM_Startup."), + 39 => new Code(code, "TPM_E_INAPPROPRIATE_SIG", "Signed data cannot include additional DER information."), + 40 => new Code(code, "TPM_E_BAD_KEY_PROPERTY", "The key properties in TPM_KEY_PARMs are not supported by this TPM."), + 41 => new Code(code, "TPM_E_BAD_MIGRATION", "The migration properties of this key are incorrect."), + 42 => new Code(code, "TPM_E_BAD_SCHEME", "The signature or encryption scheme for this key is incorrect or not permitted in this situation."), + 43 => new Code(code, "TPM_E_BAD_DATASIZE", "The size of the data (or blob) parameter is bad or inconsistent with the referenced key."), + 44 => new Code(code, "TPM_E_BAD_MODE", "A mode parameter is bad, such as capArea or subCapArea for TPM_GetCapability, physicalPresence parameter for TPM_PhysicalPresence, or migrationType for TPM_CreateMigrationBlob."), + 45 => new Code(code, "TPM_E_BAD_PRESENCE", "Either the physicalPresence or physicalPresenceLock bits have the wrong value."), + 46 => new Code(code, "TPM_E_BAD_VERSION", "The TPM cannot perform this version of the capability."), + 47 => new Code(code, "TPM_E_NO_WRAP_TRANSPORT", "The TPM does not allow for wrapped transport sessions."), + 48 => new Code(code, "TPM_E_AUDITFAIL_UNSUCCESSFUL", "TPM audit construction failed and the underlying command was returning a failure code also."), + 49 => new Code(code, "TPM_E_AUDITFAIL_SUCCESSFUL", "TPM audit construction failed and the underlying command was returning success."), + 50 => new Code(code, "TPM_E_NOTRESETABLE", "Attempt to reset a PCR that does not have the resettable attribute."), + 51 => new Code(code, "TPM_E_NOTLOCAL", "Attempt to reset a PCR register that requires locality and the locality modifier not part of command transport."), + 52 => new Code(code, "TPM_E_BAD_TYPE", "Make identity blob not properly typed."), + 53 => new Code(code, "TPM_E_INVALID_RESOURCE", "When saving context identified resource type does not match actual resource."), + 54 => new Code(code, "TPM_E_NOTFIPS", "The TPM is attempting to execute a command only available when in Federal Information Processing Standards (FIPS) mode."), + 55 => new Code(code, "TPM_E_INVALID_FAMILY", "The command is attempting to use an invalid family ID."), + 56 => new Code(code, "TPM_E_NO_NV_PERMISSION", "The permission to manipulate the NV storage is not available."), + 57 => new Code(code, "TPM_E_REQUIRES_SIGN", "The operation requires a signed command."), + 58 => new Code(code, "TPM_E_KEY_NOTSUPPORTED", "Wrong operation to load an NV key."), + 59 => new Code(code, "TPM_E_AUTH_CONFLICT", "NV_LoadKey blob requires both owner and blob authorization."), + 60 => new Code(code, "TPM_E_AREA_LOCKED", "The NV area is locked and not writable."), + 61 => new Code(code, "TPM_E_BAD_LOCALITY", "The locality is incorrect for the attempted operation."), + 62 => new Code(code, "TPM_E_READ_ONLY", "The NV area is read-only and cannot be written to."), + 63 => new Code(code, "TPM_E_PER_NOWRITE", "There is no protection on the write to the NV area."), + 64 => new Code(code, "TPM_E_FAMILYCOUNT", "The family count value does not match."), + 65 => new Code(code, "TPM_E_WRITE_LOCKED", "The NV area has already been written to."), + 66 => new Code(code, "TPM_E_BAD_ATTRIBUTES", "The NV area attributes conflict."), + 67 => new Code(code, "TPM_E_INVALID_STRUCTURE", "The structure tag and version are invalid or inconsistent."), + 68 => new Code(code, "TPM_E_KEY_OWNER_CONTROL", "The key is under control of the TPM owner and can only be evicted by the TPM owner."), + 69 => new Code(code, "TPM_E_BAD_COUNTER", "The counter handle is incorrect."), + 70 => new Code(code, "TPM_E_NOT_FULLWRITE", "The write is not a complete write of the area."), + 71 => new Code(code, "TPM_E_CONTEXT_GAP", "The gap between saved context counts is too large."), + 72 => new Code(code, "TPM_E_MAXNVWRITES", "The maximum number of NV writes without an owner has been exceeded."), + 73 => new Code(code, "TPM_E_NOOPERATOR", "No operator AuthData value is set."), + 74 => new Code(code, "TPM_E_RESOURCEMISSING", "The resource pointed to by context is not loaded."), + 75 => new Code(code, "TPM_E_DELEGATE_LOCK", "The delegate administration is locked."), + 76 => new Code(code, "TPM_E_DELEGATE_FAMILY", "Attempt to manage a family other then the delegated family."), + 77 => new Code(code, "TPM_E_DELEGATE_ADMIN", "Delegation table management not enabled."), + 78 => new Code(code, "TPM_E_TRANSPORT_NOTEXCLUSIVE", "There was a command executed outside an exclusive transport session."), + 79 => new Code(code, "TPM_E_OWNER_CONTROL", "Attempt to context save an owner evict controlled key."), + 80 => new Code(code, "TPM_E_DAA_RESOURCES", "The DAA command has no resources available to execute the command."), + 81 => new Code(code, "TPM_E_DAA_INPUT_DATA0", "The consistency check on DAA parameter inputData0 has failed."), + 82 => new Code(code, "TPM_E_DAA_INPUT_DATA1", "The consistency check on DAA parameter inputData1 has failed."), + 83 => new Code(code, "TPM_E_DAA_ISSUER_SETTINGS", "The consistency check on DAA_issuerSettings has failed."), + 84 => new Code(code, "TPM_E_DAA_TPM_SETTINGS", "The consistency check on DAA_tpmSpecific has failed."), + 85 => new Code(code, "TPM_E_DAA_STAGE", "The atomic process indicated by the submitted DAA command is not the expected process."), + 86 => new Code(code, "TPM_E_DAA_ISSUER_VALIDITY", "The issuer's validity check has detected an inconsistency."), + 87 => new Code(code, "TPM_E_DAA_WRONG_W", "The consistency check on w has failed."), + 88 => new Code(code, "TPM_E_BAD_HANDLE", "The handle is incorrect."), + 89 => new Code(code, "TPM_E_BAD_DELEGATE", "Delegation is not correct."), + 90 => new Code(code, "TPM_E_BADCONTEXT", "The context blob is invalid."), + 91 => new Code(code, "TPM_E_TOOMANYCONTEXTS", "Too many contexts held by the TPM."), + 92 => new Code(code, "TPM_E_MA_TICKET_SIGNATURE", "Migration authority signature validation failure."), + 93 => new Code(code, "TPM_E_MA_DESTINATION", "Migration destination not authenticated."), + 94 => new Code(code, "TPM_E_MA_SOURCE", "Migration source incorrect."), + 95 => new Code(code, "TPM_E_MA_AUTHORITY", "Incorrect migration authority."), + 97 => new Code(code, "TPM_E_PERMANENTEK", "Attempt to revoke the EK and the EK is not revocable."), + 98 => new Code(code, "TPM_E_BAD_SIGNATURE", "Bad signature of CMK ticket."), + 99 => new Code(code, "TPM_E_NOCONTEXTSPACE", "There is no room in the context list for additional contexts."), + 1024 => new Code(code, "TPM_E_COMMAND_BLOCKED", "The command was blocked."), + 1025 => new Code(code, "TPM_E_INVALID_HANDLE", "The specified handle was not found."), + 1026 => new Code(code, "TPM_E_DUPLICATE_VHANDLE", "The TPM returned a duplicate handle and the command needs to be resubmitted."), + 1027 => new Code(code, "TPM_E_EMBEDDED_COMMAND_BLOCKED", "The command within the transport was blocked."), + 1028 => new Code(code, "TPM_E_EMBEDDED_COMMAND_UNSUPPORTED", "The command within the transport is not supported."), + 2048 => new Code(code, "TPM_E_RETRY", "The TPM is too busy to respond to the command immediately, but the command could be resubmitted at a later time."), + 2049 => new Code(code, "TPM_E_NEEDS_SELFTEST", "SelfTestFull has not been run."), + 2050 => new Code(code, "TPM_E_DOING_SELFTEST", "The TPM is currently executing a full self-test."), + 2051 => new Code(code, "TPM_E_DEFEND_LOCK_RUNNING", "The TPM is defending against dictionary attacks and is in a time-out period."), + 16385 => new Code(code, "TBS_E_INTERNAL_ERROR", "An internal software error has been detected."), + 16386 => new Code(code, "TBS_E_BAD_PARAMETER", "One or more input parameters are bad."), + 16387 => new Code(code, "TBS_E_INVALID_OUTPUT_POINTER", "A specified output pointer is bad."), + 16388 => new Code(code, "TBS_E_INVALID_CONTEXT", "The specified context handle does not refer to a valid context."), + 16389 => new Code(code, "TBS_E_INSUFFICIENT_BUFFER", "A specified output buffer is too small."), + 16390 => new Code(code, "TBS_E_IOERROR", "An error occurred while communicating with the TPM."), + 16391 => new Code(code, "TBS_E_INVALID_CONTEXT_PARAM", "One or more context parameters are invalid."), + 16392 => new Code(code, "TBS_E_SERVICE_NOT_RUNNING", "The TPM Base Services (TBS) is not running and could not be started."), + 16393 => new Code(code, "TBS_E_TOO_MANY_TBS_CONTEXTS", "A new context could not be created because there are too many open contexts."), + 16394 => new Code(code, "TBS_E_TOO_MANY_RESOURCES", "A new virtual resource could not be created because there are too many open virtual resources."), + 16395 => new Code(code, "TBS_E_SERVICE_START_PENDING", "The TBS service has been started but is not yet running."), + 16396 => new Code(code, "TBS_E_PPI_NOT_SUPPORTED", "The physical presence interface is not supported."), + 16397 => new Code(code, "TBS_E_COMMAND_CANCELED", "The command was canceled."), + 16398 => new Code(code, "TBS_E_BUFFER_TOO_LARGE", "The input or output buffer is too large."), + _ => Unknown(code), + }; + } + } +} diff --git a/src/Elmah.Io.HResults/Facilities/FacilityTpmSoftwareResolver.cs b/src/Elmah.Io.HResults/Facilities/FacilityTpmSoftwareResolver.cs new file mode 100644 index 0000000..2bd31df --- /dev/null +++ b/src/Elmah.Io.HResults/Facilities/FacilityTpmSoftwareResolver.cs @@ -0,0 +1,73 @@ +namespace Elmah.Io.HResults.Facilities +{ + internal class FacilityTpmSoftwareResolver : FacilityResolverBase + { + public FacilityTpmSoftwareResolver() : base(41, "FACILITY_TPM_SOFTWARE") + { + } + + internal override Code Resolve(bool failure, int code) + { + return code switch + { + 256 => new Code(code, "TPMAPI_E_INVALID_STATE", "The command buffer is not in the correct state."), + 257 => new Code(code, "TPMAPI_E_NOT_ENOUGH_DATA", "The command buffer does not contain enough data to satisfy the request."), + 258 => new Code(code, "TPMAPI_E_TOO_MUCH_DATA", "The command buffer cannot contain any more data."), + 259 => new Code(code, "TPMAPI_E_INVALID_OUTPUT_POINTER", "One or more output parameters was null or invalid."), + 260 => new Code(code, "TPMAPI_E_INVALID_PARAMETER", "One or more input parameters are invalid."), + 261 => new Code(code, "TPMAPI_E_OUT_OF_MEMORY", "Not enough memory was available to satisfy the request."), + 262 => new Code(code, "TPMAPI_E_BUFFER_TOO_SMALL", "The specified buffer was too small."), + 263 => new Code(code, "TPMAPI_E_INTERNAL_ERROR", "An internal error was detected."), + 264 => new Code(code, "TPMAPI_E_ACCESS_DENIED", "The caller does not have the appropriate rights to perform the requested operation."), + 265 => new Code(code, "TPMAPI_E_AUTHORIZATION_FAILED", "The specified authorization information was invalid."), + 266 => new Code(code, "TPMAPI_E_INVALID_CONTEXT_HANDLE", "The specified context handle was not valid."), + 267 => new Code(code, "TPMAPI_E_TBS_COMMUNICATION_ERROR", "An error occurred while communicating with the TBS."), + 268 => new Code(code, "TPMAPI_E_TPM_COMMAND_ERROR", "The TPM returned an unexpected result."), + 269 => new Code(code, "TPMAPI_E_MESSAGE_TOO_LARGE", "The message was too large for the encoding scheme."), + 270 => new Code(code, "TPMAPI_E_INVALID_ENCODING", "The encoding in the binary large object (BLOB) was not recognized."), + 271 => new Code(code, "TPMAPI_E_INVALID_KEY_SIZE", "The key size is not valid."), + 272 => new Code(code, "TPMAPI_E_ENCRYPTION_FAILED", "The encryption operation failed."), + 273 => new Code(code, "TPMAPI_E_INVALID_KEY_PARAMS", "The key parameters structure was not valid."), + 274 => new Code(code, "TPMAPI_E_INVALID_MIGRATION_AUTHORIZATION_BLOB", "The requested supplied data does not appear to be a valid migration authorization BLOB."), + 275 => new Code(code, "TPMAPI_E_INVALID_PCR_INDEX", "The specified PCR index was invalid."), + 276 => new Code(code, "TPMAPI_E_INVALID_DELEGATE_BLOB", "The data given does not appear to be a valid delegate BLOB."), + 277 => new Code(code, "TPMAPI_E_INVALID_CONTEXT_PARAMS", "One or more of the specified context parameters was not valid."), + 278 => new Code(code, "TPMAPI_E_INVALID_KEY_BLOB", "The data given does not appear to be a valid key BLOB."), + 279 => new Code(code, "TPMAPI_E_INVALID_PCR_DATA", "The specified PCR data was invalid."), + 280 => new Code(code, "TPMAPI_E_INVALID_OWNER_AUTH", "The format of the owner authorization data was invalid."), + 512 => new Code(code, "TBSIMP_E_BUFFER_TOO_SMALL", "The specified buffer was too small."), + 513 => new Code(code, "TBSIMP_E_CLEANUP_FAILED", "The context could not be cleaned up."), + 514 => new Code(code, "TBSIMP_E_INVALID_CONTEXT_HANDLE", "The specified context handle is invalid."), + 515 => new Code(code, "TBSIMP_E_INVALID_CONTEXT_PARAM", "An invalid context parameter was specified."), + 516 => new Code(code, "TBSIMP_E_TPM_ERROR", "An error occurred while communicating with the TPM."), + 517 => new Code(code, "TBSIMP_E_HASH_BAD_KEY", "No entry with the specified key was found."), + 518 => new Code(code, "TBSIMP_E_DUPLICATE_VHANDLE", "The specified virtual handle matches a virtual handle already in use."), + 519 => new Code(code, "TBSIMP_E_INVALID_OUTPUT_POINTER", "The pointer to the returned handle location was null or invalid."), + 520 => new Code(code, "TBSIMP_E_INVALID_PARAMETER", "One or more parameters are invalid."), + 521 => new Code(code, "TBSIMP_E_RPC_INIT_FAILED", "The RPC subsystem could not be initialized."), + 522 => new Code(code, "TBSIMP_E_SCHEDULER_NOT_RUNNING", "The TBS scheduler is not running."), + 523 => new Code(code, "TBSIMP_E_COMMAND_CANCELED", "The command was canceled."), + 524 => new Code(code, "TBSIMP_E_OUT_OF_MEMORY", "There was not enough memory to fulfill the request."), + 525 => new Code(code, "TBSIMP_E_LIST_NO_MORE_ITEMS", "The specified list is empty, or the iteration has reached the end of the list."), + 526 => new Code(code, "TBSIMP_E_LIST_NOT_FOUND", "The specified item was not found in the list."), + 527 => new Code(code, "TBSIMP_E_NOT_ENOUGH_SPACE", "The TPM does not have enough space to load the requested resource."), + 528 => new Code(code, "TBSIMP_E_NOT_ENOUGH_TPM_CONTEXTS", "There are too many TPM contexts in use."), + 529 => new Code(code, "TBSIMP_E_COMMAND_FAILED", "The TPM command failed."), + 530 => new Code(code, "TBSIMP_E_UNKNOWN_ORDINAL", "The TBS does not recognize the specified ordinal."), + 531 => new Code(code, "TBSIMP_E_RESOURCE_EXPIRED", "The requested resource is no longer available."), + 532 => new Code(code, "TBSIMP_E_INVALID_RESOURCE", "The resource type did not match."), + 533 => new Code(code, "TBSIMP_E_NOTHING_TO_UNLOAD", "No resources can be unloaded."), + 534 => new Code(code, "TBSIMP_E_HASH_TABLE_FULL", "No new entries can be added to the hash table."), + 535 => new Code(code, "TBSIMP_E_TOO_MANY_TBS_CONTEXTS", "A new TBS context could not be created because there are too many open contexts."), + 536 => new Code(code, "TBSIMP_E_TOO_MANY_RESOURCES", "A new virtual resource could not be created because there are too many open virtual resources."), + 537 => new Code(code, "TBSIMP_E_PPI_NOT_SUPPORTED", "The physical presence interface is not supported."), + 538 => new Code(code, "TBSIMP_E_TPM_INCOMPATIBLE", "TBS is not compatible with the version of TPM found on the system."), + 768 => new Code(code, "TPM_E_PPI_ACPI_FAILURE", "A general error was detected when attempting to acquire the BIOS response to a physical presence command."), + 769 => new Code(code, "TPM_E_PPI_USER_ABORT", "The user failed to confirm the TPM operation request."), + 770 => new Code(code, "TPM_E_PPI_BIOS_FAILURE", "The BIOS failure prevented the successful execution of the requested TPM operation (for example, invalid TPM operation request, BIOS communication error with the TPM)."), + 771 => new Code(code, "TPM_E_PPI_NOT_SUPPORTED", "The BIOS does not support the physical presence interface."), + _ => Unknown(code), + }; + } + } +} diff --git a/src/Elmah.Io.HResults/Facilities/FacilityUrtResolver.cs b/src/Elmah.Io.HResults/Facilities/FacilityUrtResolver.cs new file mode 100644 index 0000000..4f11f1a --- /dev/null +++ b/src/Elmah.Io.HResults/Facilities/FacilityUrtResolver.cs @@ -0,0 +1,18 @@ +namespace Elmah.Io.HResults.Facilities +{ + internal class FacilityUrtResolver : FacilityResolverBase + { + public FacilityUrtResolver() : base(19, "FACILITY_URT") + { + } + + internal override Code Resolve(bool failure, int code) + { + return code switch + { + 5632 => new Code(code, "COR_E_APPLICATION"), + _ => Unknown(code), + }; + } + } +} diff --git a/src/Elmah.Io.HResults/Facilities/FacilityUsermodeFilterManagerResolver.cs b/src/Elmah.Io.HResults/Facilities/FacilityUsermodeFilterManagerResolver.cs new file mode 100644 index 0000000..b346956 --- /dev/null +++ b/src/Elmah.Io.HResults/Facilities/FacilityUsermodeFilterManagerResolver.cs @@ -0,0 +1,57 @@ +namespace Elmah.Io.HResults.Facilities +{ + internal class FacilityUsermodeFilterManagerResolver : FacilityResolverBase + { + public FacilityUsermodeFilterManagerResolver() : base(31, "FACILITY_USERMODE_FILTER_MANAGER") + { + } + + internal override Code Resolve(bool failure, int code) + { + if (failure) + { + switch (code) + { + case 1: return new Code(code, "ERROR_FLT_NO_HANDLER_DEFINED", "A handler was not defined by the filter for this operation."); + case 2: return new Code(code, "ERROR_FLT_CONTEXT_ALREADY_DEFINED", "A context is already defined for this object."); + case 3: return new Code(code, "ERROR_FLT_INVALID_ASYNCHRONOUS_REQUEST", "Asynchronous requests are not valid for this operation."); + case 4: return new Code(code, "ERROR_FLT_DISALLOW_FAST_IO", "Disallow the Fast IO path for this operation."); + case 5: return new Code(code, "ERROR_FLT_INVALID_NAME_REQUEST", "An invalid name request was made. The name requested cannot be retrieved at this time."); + case 6: return new Code(code, "ERROR_FLT_NOT_SAFE_TO_POST_OPERATION", "Posting this operation to a worker thread for further processing is not safe at this time because it could lead to a system deadlock."); + case 7: return new Code(code, "ERROR_FLT_NOT_INITIALIZED", "The Filter Manager was not initialized when a filter tried to register. Be sure that the Filter Manager is being loaded as a driver."); + case 8: return new Code(code, "ERROR_FLT_FILTER_NOT_READY", "The filter is not ready for attachment to volumes because it has not finished initializing (FltStartFiltering has not been called)."); + case 9: return new Code(code, "ERROR_FLT_POST_OPERATION_CLEANUP", "The filter must clean up any operation-specific context at this time because it is being removed from the system before the operation is completed by the lower drivers."); + case 10: return new Code(code, "ERROR_FLT_INTERNAL_ERROR", "The Filter Manager had an internal error from which it cannot recover; therefore, the operation has been failed. This is usually the result of a filter returning an invalid value from a preoperation callback."); + case 11: return new Code(code, "ERROR_FLT_DELETING_OBJECT", "The object specified for this action is in the process of being deleted; therefore, the action requested cannot be completed at this time."); + case 12: return new Code(code, "ERROR_FLT_MUST_BE_NONPAGED_POOL", "Nonpaged pool must be used for this type of context."); + case 13: return new Code(code, "ERROR_FLT_DUPLICATE_ENTRY", "A duplicate handler definition has been provided for an operation."); + case 14: return new Code(code, "ERROR_FLT_CBDQ_DISABLED", "The callback data queue has been disabled."); + case 15: return new Code(code, "ERROR_FLT_DO_NOT_ATTACH", "Do not attach the filter to the volume at this time."); + case 16: return new Code(code, "ERROR_FLT_DO_NOT_DETACH", "Do not detach the filter from the volume at this time."); + case 17: return new Code(code, "ERROR_FLT_INSTANCE_ALTITUDE_COLLISION", "An instance already exists at this altitude on the volume specified."); + case 18: return new Code(code, "ERROR_FLT_INSTANCE_NAME_COLLISION", "An instance already exists with this name on the volume specified."); + case 19: return new Code(code, "ERROR_FLT_FILTER_NOT_FOUND", "The system could not find the filter specified."); + case 20: return new Code(code, "ERROR_FLT_VOLUME_NOT_FOUND", "The system could not find the volume specified."); + case 21: return new Code(code, "ERROR_FLT_INSTANCE_NOT_FOUND", "The system could not find the instance specified."); + case 22: return new Code(code, "ERROR_FLT_CONTEXT_ALLOCATION_NOT_FOUND", "No registered context allocation definition was found for the given request."); + case 23: return new Code(code, "ERROR_FLT_INVALID_CONTEXT_REGISTRATION", "An invalid parameter was specified during context registration."); + case 24: return new Code(code, "ERROR_FLT_NAME_CACHE_MISS", "The name requested was not found in the Filter Manager name cache and could not be retrieved from the file system."); + case 25: return new Code(code, "ERROR_FLT_NO_DEVICE_OBJECT", "The requested device object does not exist for the given volume."); + case 26: return new Code(code, "ERROR_FLT_VOLUME_ALREADY_MOUNTED", "The specified volume is already mounted."); + case 27: return new Code(code, "ERROR_FLT_ALREADY_ENLISTED", "The specified Transaction Context is already enlisted in a transaction."); + case 28: return new Code(code, "ERROR_FLT_CONTEXT_ALREADY_LINKED", "The specified context is already attached to another object."); + case 32: return new Code(code, "ERROR_FLT_NO_WAITER_FOR_REPLY", "No waiter is present for the filter's reply to this message."); + } + } + else + { + switch (code) + { + case 1: return new Code(code, "ERROR_FLT_IO_COMPLETE", "The IO was completed by a filter."); + } + } + + return Unknown(code); + } + } +} diff --git a/src/Elmah.Io.HResults/Facilities/FacilityWin32Resolver.cs b/src/Elmah.Io.HResults/Facilities/FacilityWin32Resolver.cs new file mode 100644 index 0000000..129a5d6 --- /dev/null +++ b/src/Elmah.Io.HResults/Facilities/FacilityWin32Resolver.cs @@ -0,0 +1,23 @@ +namespace Elmah.Io.HResults.Facilities +{ + internal class FacilityWin32Resolver : FacilityResolverBase + { + public FacilityWin32Resolver() : base(7, "FACILITY_WIN32") + { + } + + internal override Code Resolve(bool failure, int code) + { + return code switch + { + 2 => new Code(code, "ERROR_FILE_NOT_FOUND"), + 5 => new Code(code, "E_ACCESSDENIED", "General access denied error."), + 14 => new Code(code, "E_OUTOFMEMORY", "The server does not have enough memory for the new channel."), + 50 => new Code(code, "ERROR_NOT_SUPPORTED", "The server cannot support a client request for a dynamic virtual channel."), + 87 => new Code(code, "E_INVALIDARG", "One or more arguments are invalid."), + 112 => new Code(code, "ERROR_DISK_FULL", "There is not enough space on the disk."), + _ => Unknown(code), + }; + } + } +} diff --git a/src/Elmah.Io.HResults/Facilities/FacilityWindowsResolver.cs b/src/Elmah.Io.HResults/Facilities/FacilityWindowsResolver.cs new file mode 100644 index 0000000..c17bdf3 --- /dev/null +++ b/src/Elmah.Io.HResults/Facilities/FacilityWindowsResolver.cs @@ -0,0 +1,43 @@ +namespace Elmah.Io.HResults.Facilities +{ + internal class FacilityWindowsResolver : FacilityResolverBase + { + public FacilityWindowsResolver() : base(8, "FACILITY_WINDOWS") + { + } + + internal override Code Resolve(bool failure, int code) + { + if (failure) + { + switch (code) + { + case 1: return new Code(code, "CO_E_CLASS_CREATE_FAILED", "Attempt to create a class object failed."); + case 2: return new Code(code, "CO_E_SCM_ERROR", "OLE service could not bind object."); + case 3: return new Code(code, "CO_E_SCM_RPC_FAILURE", "RPC communication failed with OLE service."); + case 4: return new Code(code, "CO_E_BAD_PATH", "Bad path to object."); + case 5: return new Code(code, "CO_E_SERVER_EXEC_FAILURE", "Server execution failed."); + case 6: return new Code(code, "CO_E_OBJSRV_RPC_FAILURE", "OLE service could not communicate with the object server."); + case 7: return new Code(code, "MK_E_NO_NORMALIZED", "Moniker path could not be normalized."); + case 8: return new Code(code, "CO_E_SERVER_STOPPING", "Object server is stopping when OLE service contacts it."); + case 9: return new Code(code, "MEM_E_INVALID_ROOT", "An invalid root block pointer was specified."); + case 16: return new Code(code, "MEM_E_INVALID_LINK", "An allocation chain contained an invalid link pointer."); + case 17: return new Code(code, "MEM_E_INVALID_SIZE", "The requested allocation size was too large."); + case 21: return new Code(code, "CO_E_MISSING_DISPLAYNAME", "The activation requires a display name to be present under the class identifier (CLSID) key."); + case 22: return new Code(code, "CO_E_RUNAS_VALUE_MUST_BE_AAA", "The activation requires that the RunAs value for the application is Activate As Activator."); + case 23: return new Code(code, "CO_E_ELEVATION_DISABLED", "The class is not configured to support elevated activation."); + } + } + else + { + switch (code) + { + case 18: return new Code(code, "CO_S_NOTALLINTERFACES", "Not all the requested interfaces were available."); + case 19: return new Code(code, "CO_S_MACHINENAMENOTFOUND", "The specified machine name was not found in the cache."); + } + } + + return Unknown(code); + } + } +} diff --git a/src/Elmah.Io.HResults/Facility.cs b/src/Elmah.Io.HResults/Facility.cs new file mode 100644 index 0000000..294ff24 --- /dev/null +++ b/src/Elmah.Io.HResults/Facility.cs @@ -0,0 +1,24 @@ +namespace Elmah.Io.HResults +{ + /// + /// Represents a parsed facility. + /// + public class Facility + { + internal Facility(int identifier, string name) + { + Identifier = identifier; + Name = name; + } + + /// + /// The ID of the facility. Example: 7 + /// + public int Identifier { get; set; } + + /// + /// The name of the facility: Example: FACILITY_WIN32 + /// + public string? Name { get; set; } + } +} diff --git a/src/Elmah.Io.HResults/Facility/Facilities.cs b/src/Elmah.Io.HResults/Facility/Facilities.cs deleted file mode 100644 index d7d4043..0000000 --- a/src/Elmah.Io.HResults/Facility/Facilities.cs +++ /dev/null @@ -1,79 +0,0 @@ -using System.Collections.Generic; - -namespace Elmah.Io.HResults.Facility -{ - internal class Facilities - { - private static readonly Dictionary facilities = new Dictionary - { - { 19, new FacilityUrt() }, { 7, new FacilityWin32() } - }; - - internal static string? ErrorCodeToString(int facility, int errorCode) - { - if (!facilities.ContainsKey(facility)) return $"{errorCode}"; - - return facilities[facility].ErrorCodeToString(errorCode); - } - - internal static string? FacilityToString(int facility) - { - if (facilities.ContainsKey(facility)) return facilities[facility].Name; - - switch (facility) - { - case 0: return "FACILITY_NULL"; - case 1: return "FACILITY_RPC"; - case 2: return "FACILITY_DISPATCH"; - case 3: return "FACILITY_STORAGE"; - case 4: return "FACILITY_ITF"; - case 8: return "FACILITY_WINDOWS"; - case 9: return "FACILITY_SECURITY"; - case 10: return "FACILITY_CONTROL"; - case 11: return "FACILITY_CERT"; - case 12: return "FACILITY_INTERNET"; - case 13: return "FACILITY_MEDIASERVER"; - case 14: return "FACILITY_MSMQ"; - case 15: return "FACILITY_SETUPAPI"; - case 16: return "FACILITY_SCARD"; - case 17: return "FACILITY_COMPLUS"; - case 18: return "FACILITY_AAF"; - case 20: return "FACILITY_ACS"; - case 21: return "FACILITY_DPLAY"; - case 22: return "FACILITY_UMI"; - case 23: return "FACILITY_SXS"; - case 24: return "FACILITY_WINDOWS_CE"; - case 25: return "FACILITY_HTTP"; - case 26: return "FACILITY_USERMODE_COMMONLOG"; - case 31: return "FACILITY_USERMODE_FILTER_MANAGER"; - case 32: return "FACILITY_BACKGROUNDCOPY"; - case 33: return "FACILITY_CONFIGURATION"; - case 34: return "FACILITY_STATE_MANAGEMENT"; - case 35: return "FACILITY_METADIRECTORY"; - case 36: return "FACILITY_WINDOWSUPDATE"; - case 37: return "FACILITY_DIRECTORYSERVICE"; - case 38: return "FACILITY_GRAPHICS"; - case 39: return "FACILITY_SHELL"; - case 40: return "FACILITY_TPM_SERVICES"; - case 41: return "FACILITY_TPM_SOFTWARE"; - case 48: return "FACILITY_PLA"; - case 49: return "FACILITY_FVE"; - case 50: return "FACILITY_FWP"; - case 51: return "FACILITY_WINRM"; - case 52: return "FACILITY_NDIS"; - case 53: return "FACILITY_USERMODE_HYPERVISOR"; - case 54: return "FACILITY_CMI"; - case 55: return "FACILITY_USERMODE_VIRTUALIZATION"; - case 56: return "FACILITY_USERMODE_VOLMGR"; - case 57: return "FACILITY_BCD"; - case 58: return "FACILITY_USERMODE_VHD"; - case 60: return "FACILITY_SDIAG"; - case 61: return "FACILITY_WEBSERVICES"; - case 80: return "FACILITY_WINDOWS_DEFENDER"; - case 81: return "FACILITY_OPC"; - } - - return "FACILITY_NULL"; - } - } -} diff --git a/src/Elmah.Io.HResults/Facility/FacilityUrt.cs b/src/Elmah.Io.HResults/Facility/FacilityUrt.cs deleted file mode 100644 index 5da705c..0000000 --- a/src/Elmah.Io.HResults/Facility/FacilityUrt.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Elmah.Io.HResults.Facility -{ - internal class FacilityUrt : FacilityBase - { - public FacilityUrt() : base("FACILITY_URT") - { - } - - internal override string? ErrorCodeToString(int errorCode) - { - switch (errorCode) - { - case 5632: return "COR_E_APPLICATION"; - } - - return $"{errorCode}"; - } - } -} diff --git a/src/Elmah.Io.HResults/Facility/FacilityWin32.cs b/src/Elmah.Io.HResults/Facility/FacilityWin32.cs deleted file mode 100644 index 47d5e55..0000000 --- a/src/Elmah.Io.HResults/Facility/FacilityWin32.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Elmah.Io.HResults.Facility -{ - internal class FacilityWin32 : FacilityBase - { - public FacilityWin32() : base("FACILITY_WIN32") - { - } - - internal override string? ErrorCodeToString(int errorCode) - { - switch (errorCode) - { - case 2: return "ERROR_FILE_NOT_FOUND"; - } - - return $"{errorCode}"; - } - } -} \ No newline at end of file diff --git a/src/Elmah.Io.HResults/FacilityBase.cs b/src/Elmah.Io.HResults/FacilityBase.cs deleted file mode 100644 index f76a66a..0000000 --- a/src/Elmah.Io.HResults/FacilityBase.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Elmah.Io.HResults -{ - internal abstract class FacilityBase - { - public string Name { get; set; } - - protected FacilityBase(string name) - { - Name = name; - } - - internal abstract string? ErrorCodeToString(int errorCode); - } -} diff --git a/src/Elmah.Io.HResults/HResult.cs b/src/Elmah.Io.HResults/HResult.cs index 48bda0c..3202d52 100644 --- a/src/Elmah.Io.HResults/HResult.cs +++ b/src/Elmah.Io.HResults/HResult.cs @@ -1,6 +1,4 @@ -using Elmah.Io.HResults.Facility; - -namespace Elmah.Io.HResults +namespace Elmah.Io.HResults { /// /// Represents a parsed HResult. @@ -13,12 +11,13 @@ public class HResult public static HResult Parse(int i) { var hresult = new HResult(); - hresult.IsFailure = (i & 0x80000000) != 0; + var isFailure = (i & 0x80000000) != 0; + hresult.IsFailure = isFailure; var facility = (i & 0x7FFF0000) >> 16; - hresult.Facility = Facilities.FacilityToString(facility); + hresult.Facility = facility.ToFacility(); hresult.Hex = $"0x{i.ToString("X8")}"; - var errorCode = (i & 0xFFFF); - hresult.ErrorCode = Facilities.ErrorCodeToString(facility, errorCode); + var code = (i & 0xFFFF); + hresult.Code = code.ToCode(isFailure, facility); return hresult; } @@ -30,7 +29,7 @@ public static HResult Parse(int i) /// /// Identifies the part of the system for which the HResult applies. /// - public string? Facility { get; set; } + public Facility Facility { get; set; } /// /// The parsed Hex code from the HResult. @@ -40,6 +39,7 @@ public static HResult Parse(int i) /// /// Identifies a particular condition in the context of the facility. /// - public string? ErrorCode { get; set; } + public Code Code { get; set; } + } } diff --git a/src/Elmah.Io.HResults/IntExtensions.cs b/src/Elmah.Io.HResults/IntExtensions.cs new file mode 100644 index 0000000..95d58f9 --- /dev/null +++ b/src/Elmah.Io.HResults/IntExtensions.cs @@ -0,0 +1,70 @@ +using Elmah.Io.HResults.Facilities; +using System.Collections.Generic; +using System.Linq; + +namespace Elmah.Io.HResults +{ + internal static class IntExtensions + { + private static readonly List facilityResolvers = new List + { + new FacilityCertResolver(), new FacilityComplusResolver(), new FacilityDispatchResolver(), + new FacilityFveResolver(), new FacilityFwpResolver(), new FacilityGraphicsResolver(), + new FacilityItfResolver(), new FacilityMediaserverResolver(), new FacilityNdisResolver(), + new FacilityNullResolver(), new FacilityPlaResolver(), new FacilityRpcResolver(), + new FacilityScardResolver(), new FacilitySecurityResolver(), new FacilitySetupapiResolver(), + new FacilityStorageResolver(), new FacilityTpmServicesResolver(), new FacilityTpmSoftwareResolver(), + new FacilityUrtResolver(), new FacilityUsermodeFilterManagerResolver(), new FacilityWin32Resolver(), + new FacilityWindowsResolver(), + }; + + internal static Code ToCode(this int code, bool failure, int facility) + { + var resolver = facilityResolvers.FirstOrDefault(fr => fr.Identifier == facility); + if (resolver != null) return resolver.Resolve(failure, code); + + return new Code(code, $"{code}"); + } + + internal static Facility ToFacility(this int facility) + { + var resolver = facilityResolvers.FirstOrDefault(fr => fr.Identifier == facility); + if (resolver != null) return resolver.Facility(); + + switch (facility) + { + case 10: return new Facility(facility, "FACILITY_CONTROL"); + case 12: return new Facility(facility, "FACILITY_INTERNET"); + case 14: return new Facility(facility, "FACILITY_MSMQ"); + case 18: return new Facility(facility, "FACILITY_AAF"); + case 20: return new Facility(facility, "FACILITY_ACS"); + case 21: return new Facility(facility, "FACILITY_DPLAY"); + case 22: return new Facility(facility, "FACILITY_UMI"); + case 23: return new Facility(facility, "FACILITY_SXS"); + case 24: return new Facility(facility, "FACILITY_WINDOWS_CE"); + case 25: return new Facility(facility, "FACILITY_HTTP"); + case 26: return new Facility(facility, "FACILITY_USERMODE_COMMONLOG"); + case 32: return new Facility(facility, "FACILITY_BACKGROUNDCOPY"); + case 33: return new Facility(facility, "FACILITY_CONFIGURATION"); + case 34: return new Facility(facility, "FACILITY_STATE_MANAGEMENT"); + case 35: return new Facility(facility, "FACILITY_METADIRECTORY"); + case 36: return new Facility(facility, "FACILITY_WINDOWSUPDATE"); + case 37: return new Facility(facility, "FACILITY_DIRECTORYSERVICE"); + case 39: return new Facility(facility, "FACILITY_SHELL"); + case 51: return new Facility(facility, "FACILITY_WINRM"); + case 53: return new Facility(facility, "FACILITY_USERMODE_HYPERVISOR"); + case 54: return new Facility(facility, "FACILITY_CMI"); + case 55: return new Facility(facility, "FACILITY_USERMODE_VIRTUALIZATION"); + case 56: return new Facility(facility, "FACILITY_USERMODE_VOLMGR"); + case 57: return new Facility(facility, "FACILITY_BCD"); + case 58: return new Facility(facility, "FACILITY_USERMODE_VHD"); + case 60: return new Facility(facility, "FACILITY_SDIAG"); + case 61: return new Facility(facility, "FACILITY_WEBSERVICES"); + case 80: return new Facility(facility, "FACILITY_WINDOWS_DEFENDER"); + case 81: return new Facility(facility, "FACILITY_OPC"); + } + + return facilityResolvers.First(fr => fr.Identifier == 0).Facility(); + } + } +} diff --git a/test/Elmah.Io.HResults.Test/HResultTest.cs b/test/Elmah.Io.HResults.Test/HResultTest.cs index d68077c..07fcc2f 100644 --- a/test/Elmah.Io.HResults.Test/HResultTest.cs +++ b/test/Elmah.Io.HResults.Test/HResultTest.cs @@ -1,5 +1,11 @@ -using NUnit.Framework; +using Microsoft.Win32; +using NUnit.Framework; using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Text; namespace Elmah.Io.HResults.Test { @@ -13,8 +19,12 @@ public void CanParseKnownUrt() Assert.IsNotNull(res); Assert.That(res.Hex, Is.EqualTo("0x80131600")); Assert.That(res.IsFailure, Is.True); - Assert.That(res.Facility, Is.EqualTo("FACILITY_URT")); - Assert.That(res.ErrorCode, Is.EqualTo("COR_E_APPLICATION")); + Assert.That(res.Facility, Is.Not.Null); + Assert.That(res.Facility.Identifier, Is.EqualTo(19)); + Assert.That(res.Facility.Name, Is.EqualTo("FACILITY_URT")); + Assert.That(res.Code, Is.Not.Null); + Assert.That(res.Code.Identifier, Is.EqualTo(5632)); + Assert.That(res.Code.Name, Is.EqualTo("COR_E_APPLICATION")); } [Test] @@ -24,8 +34,12 @@ public void CanParseKnownWin32() Assert.IsNotNull(res); Assert.That(res.Hex, Is.EqualTo("0x80070002")); Assert.That(res.IsFailure, Is.True); - Assert.That(res.Facility, Is.EqualTo("FACILITY_WIN32")); - Assert.That(res.ErrorCode, Is.EqualTo("ERROR_FILE_NOT_FOUND")); + Assert.That(res.Facility, Is.Not.Null); + Assert.That(res.Facility.Identifier, Is.EqualTo(7)); + Assert.That(res.Facility.Name, Is.EqualTo("FACILITY_WIN32")); + Assert.That(res.Code, Is.Not.Null); + Assert.That(res.Code.Identifier, Is.EqualTo(2)); + Assert.That(res.Code.Name, Is.EqualTo("ERROR_FILE_NOT_FOUND")); } [Test] @@ -35,8 +49,20 @@ public void CanParseUnknown() Assert.IsNotNull(res); Assert.That(res.Hex, Is.EqualTo("0x80004005")); Assert.That(res.IsFailure, Is.True); - Assert.That(res.Facility, Is.EqualTo("FACILITY_NULL")); - Assert.That(res.ErrorCode, Is.EqualTo("16389")); + Assert.That(res.Facility, Is.Not.Null); + Assert.That(res.Facility.Identifier, Is.EqualTo(0)); + Assert.That(res.Facility.Name, Is.EqualTo("FACILITY_NULL")); + Assert.That(res.Code, Is.Not.Null); + Assert.That(res.Code.Identifier, Is.EqualTo(16389)); + Assert.That(res.Code.Name, Is.EqualTo("16389")); + } + + [Test] + public void CanParseSuccess() + { + var p = int.Parse("00040000", NumberStyles.HexNumber); + var res = HResult.Parse(p); + Assert.That(res.IsFailure, Is.False); } } } \ No newline at end of file