<PackageReference Include="System.Drawing.Common" Version="10.0.0-preview.1.25080.3" />

HRESULT

using System; using System.CodeDom.Compiler; using System.Diagnostics; using System.Globalization; using System.Runtime.InteropServices; using Windows.Win32.System.Diagnostics.Debug; namespace Windows.Win32.Foundation { [DebuggerDisplay("{Value}")] [GeneratedCode("Microsoft.Windows.CsWin32", "0.3.151+58e949951d.RR")] internal readonly struct HRESULT : IEquatable<HRESULT> { public static readonly HRESULT COR_E_ARGUMENT = (HRESULT)(-2147024809); public static readonly HRESULT TLBX_E_LIBNOTREGISTERED = (HRESULT)(-2146234011); public static readonly HRESULT COR_E_MISSINGFIELD = (HRESULT)(-2146233071); public static readonly HRESULT COR_E_MISSINGMEMBER = (HRESULT)(-2146233070); public static readonly HRESULT COR_E_MISSINGMETHOD = (HRESULT)(-2146233069); public static readonly HRESULT COR_E_NOTSUPPORTED = (HRESULT)(-2146233067); public static readonly HRESULT COR_E_OVERFLOW = (HRESULT)(-2146233066); public static readonly HRESULT COR_E_INVALIDOLEVARIANTTYPE = (HRESULT)(-2146233039); public static readonly HRESULT COR_E_SAFEARRAYTYPEMISMATCH = (HRESULT)(-2146233037); public static readonly HRESULT COR_E_TARGETINVOCATION = (HRESULT)(-2146232828); public static readonly HRESULT COR_E_OBJECTDISPOSED = (HRESULT)(-2146232798); public static readonly HRESULT COR_E_SERIALIZATION = (HRESULT)(-2146233076); public static readonly HRESULT DESTS_E_NO_MATCHING_ASSOC_HANDLER = (HRESULT)(-2147217661); public static readonly HRESULT VB_E_NOTOBJECT = (HRESULT)(-2146827864); internal readonly int Value; internal static readonly HRESULT CLIPBRD_E_BAD_DATA = (HRESULT)(-2147221037); internal static readonly HRESULT DATA_S_SAMEFORMATETC = (HRESULT)262448; internal static readonly HRESULT DISP_E_ARRAYISLOCKED = (HRESULT)(-2147352563); internal static readonly HRESULT DISP_E_BADCALLEE = (HRESULT)(-2147352560); internal static readonly HRESULT DISP_E_BADINDEX = (HRESULT)(-2147352565); internal static readonly HRESULT DISP_E_BADPARAMCOUNT = (HRESULT)(-2147352562); internal static readonly HRESULT DISP_E_BADVARTYPE = (HRESULT)(-2147352568); internal static readonly HRESULT DISP_E_BUFFERTOOSMALL = (HRESULT)(-2147352557); internal static readonly HRESULT DISP_E_DIVBYZERO = (HRESULT)(-2147352558); internal static readonly HRESULT DISP_E_EXCEPTION = (HRESULT)(-2147352567); internal static readonly HRESULT DISP_E_MEMBERNOTFOUND = (HRESULT)(-2147352573); internal static readonly HRESULT DISP_E_NONAMEDARGS = (HRESULT)(-2147352569); internal static readonly HRESULT DISP_E_NOTACOLLECTION = (HRESULT)(-2147352559); internal static readonly HRESULT DISP_E_OVERFLOW = (HRESULT)(-2147352566); internal static readonly HRESULT DISP_E_PARAMNOTFOUND = (HRESULT)(-2147352572); internal static readonly HRESULT DISP_E_PARAMNOTOPTIONAL = (HRESULT)(-2147352561); internal static readonly HRESULT DISP_E_TYPEMISMATCH = (HRESULT)(-2147352571); internal static readonly HRESULT DISP_E_UNKNOWNINTERFACE = (HRESULT)(-2147352575); internal static readonly HRESULT DISP_E_UNKNOWNLCID = (HRESULT)(-2147352564); internal static readonly HRESULT DISP_E_UNKNOWNNAME = (HRESULT)(-2147352570); internal static readonly HRESULT DRAGDROP_E_ALREADYREGISTERED = (HRESULT)(-2147221247); internal static readonly HRESULT DRAGDROP_E_NOTREGISTERED = (HRESULT)(-2147221248); internal static readonly HRESULT DRAGDROP_S_CANCEL = (HRESULT)262401; internal static readonly HRESULT DRAGDROP_S_DROP = (HRESULT)262400; internal static readonly HRESULT DRAGDROP_S_USEDEFAULTCURSORS = (HRESULT)262402; internal static readonly HRESULT DV_E_FORMATETC = (HRESULT)(-2147221404); internal static readonly HRESULT DV_E_DVTARGETDEVICE = (HRESULT)(-2147221403); internal static readonly HRESULT DV_E_STGMEDIUM = (HRESULT)(-2147221402); internal static readonly HRESULT DV_E_STATDATA = (HRESULT)(-2147221401); internal static readonly HRESULT DV_E_LINDEX = (HRESULT)(-2147221400); internal static readonly HRESULT DV_E_TYMED = (HRESULT)(-2147221399); internal static readonly HRESULT DV_E_CLIPFORMAT = (HRESULT)(-2147221398); internal static readonly HRESULT DV_E_DVASPECT = (HRESULT)(-2147221397); internal static readonly HRESULT DV_E_DVTARGETDEVICE_SIZE = (HRESULT)(-2147221396); internal static readonly HRESULT DV_E_NOIVIEWOBJECT = (HRESULT)(-2147221395); internal static readonly HRESULT E_ABORT = (HRESULT)(-2147467260); internal static readonly HRESULT E_ACCESSDENIED = (HRESULT)(-2147024891); internal static readonly HRESULT E_FAIL = (HRESULT)(-2147467259); internal static readonly HRESULT E_HANDLE = (HRESULT)(-2147024890); internal static readonly HRESULT E_INVALIDARG = (HRESULT)(-2147024809); internal static readonly HRESULT E_NOINTERFACE = (HRESULT)(-2147467262); internal static readonly HRESULT E_NOTIMPL = (HRESULT)(-2147467263); internal static readonly HRESULT E_OUTOFMEMORY = (HRESULT)(-2147024882); internal static readonly HRESULT E_PENDING = (HRESULT)(-2147483638); internal static readonly HRESULT E_POINTER = (HRESULT)(-2147467261); internal static readonly HRESULT E_UNEXPECTED = (HRESULT)(-2147418113); internal static readonly HRESULT INPLACE_E_NOTOOLSPACE = (HRESULT)(-2147221087); internal static readonly HRESULT NS_E_WMP_CANNOT_FIND_FILE = (HRESULT)(-1072885353); internal static readonly HRESULT NS_E_WMP_DSHOW_UNSUPPORTED_FORMAT = (HRESULT)(-1072885350); internal static readonly HRESULT NS_E_WMP_INVALID_ASX = (HRESULT)(-1072885347); internal static readonly HRESULT NS_E_WMP_LOGON_FAILURE = (HRESULT)(-1072885354); internal static readonly HRESULT NS_E_WMP_UNSUPPORTED_FORMAT = (HRESULT)(-1072885351); internal static readonly HRESULT NS_E_WMP_URLDOWNLOADFAILED = (HRESULT)(-1072885782); internal static readonly HRESULT OLE_E_ADVISENOTSUPPORTED = (HRESULT)(-2147221501); internal static readonly HRESULT OLE_E_INVALIDRECT = (HRESULT)(-2147221491); internal static readonly HRESULT OLE_E_NOCONNECTION = (HRESULT)(-2147221500); internal static readonly HRESULT OLE_E_PROMPTSAVECANCELLED = (HRESULT)(-2147221492); internal static readonly HRESULT OLECMDERR_E_DISABLED = (HRESULT)(-2147221247); internal static readonly HRESULT OLECMDERR_E_UNKNOWNGROUP = (HRESULT)(-2147221244); internal static readonly HRESULT REGDB_E_CLASSNOTREG = (HRESULT)(-2147221164); internal static readonly HRESULT RPC_E_CHANGED_MODE = (HRESULT)(-2147417850); internal static readonly HRESULT RPC_E_DISCONNECTED = (HRESULT)(-2147417848); internal static readonly HRESULT RPC_E_SERVERFAULT = (HRESULT)(-2147417851); internal static readonly HRESULT RPC_E_SYS_CALL_FAILED = (HRESULT)(-2147417856); internal static readonly HRESULT S_FALSE = (HRESULT)1; internal static readonly HRESULT S_OK = (HRESULT)0; internal static readonly HRESULT STG_E_INVALIDFUNCTION = (HRESULT)(-2147287039); internal static readonly HRESULT STG_E_FILENOTFOUND = (HRESULT)(-2147287038); internal static readonly HRESULT STG_E_PATHNOTFOUND = (HRESULT)(-2147287037); internal static readonly HRESULT STG_E_TOOMANYOPENFILES = (HRESULT)(-2147287036); internal static readonly HRESULT STG_E_ACCESSDENIED = (HRESULT)(-2147287035); internal static readonly HRESULT STG_E_INVALIDHANDLE = (HRESULT)(-2147287034); internal static readonly HRESULT STG_E_INSUFFICIENTMEMORY = (HRESULT)(-2147287032); internal static readonly HRESULT STG_E_INVALIDPOINTER = (HRESULT)(-2147287031); internal static readonly HRESULT STG_E_NOMOREFILES = (HRESULT)(-2147287022); internal static readonly HRESULT STG_E_DISKISWRITEPROTECTED = (HRESULT)(-2147287021); internal static readonly HRESULT STG_E_SEEKERROR = (HRESULT)(-2147287015); internal static readonly HRESULT STG_E_WRITEFAULT = (HRESULT)(-2147287011); internal static readonly HRESULT STG_E_READFAULT = (HRESULT)(-2147287010); internal static readonly HRESULT STG_E_SHAREVIOLATION = (HRESULT)(-2147287008); internal static readonly HRESULT STG_E_LOCKVIOLATION = (HRESULT)(-2147287007); internal static readonly HRESULT STG_E_FILEALREADYEXISTS = (HRESULT)(-2147286960); internal static readonly HRESULT STG_E_INVALIDPARAMETER = (HRESULT)(-2147286953); internal static readonly HRESULT STG_E_MEDIUMFULL = (HRESULT)(-2147286928); internal static readonly HRESULT STG_E_PROPSETMISMATCHED = (HRESULT)(-2147286800); internal static readonly HRESULT STG_E_ABNORMALAPIEXIT = (HRESULT)(-2147286790); internal static readonly HRESULT STG_E_INVALIDHEADER = (HRESULT)(-2147286789); internal static readonly HRESULT STG_E_INVALIDNAME = (HRESULT)(-2147286788); internal static readonly HRESULT STG_E_UNKNOWN = (HRESULT)(-2147286787); internal static readonly HRESULT STG_E_UNIMPLEMENTEDFUNCTION = (HRESULT)(-2147286786); internal static readonly HRESULT STG_E_INVALIDFLAG = (HRESULT)(-2147286785); internal static readonly HRESULT STG_E_INUSE = (HRESULT)(-2147286784); internal static readonly HRESULT STG_E_NOTCURRENT = (HRESULT)(-2147286783); internal static readonly HRESULT STG_E_REVERTED = (HRESULT)(-2147286782); internal static readonly HRESULT STG_E_CANTSAVE = (HRESULT)(-2147286781); internal static readonly HRESULT STG_E_OLDFORMAT = (HRESULT)(-2147286780); internal static readonly HRESULT STG_E_OLDDLL = (HRESULT)(-2147286779); internal static readonly HRESULT STG_E_SHAREREQUIRED = (HRESULT)(-2147286778); internal static readonly HRESULT STG_E_NOTFILEBASEDSTORAGE = (HRESULT)(-2147286777); internal static readonly HRESULT STG_E_EXTANTMARSHALLINGS = (HRESULT)(-2147286776); internal static readonly HRESULT STG_E_DOCFILECORRUPT = (HRESULT)(-2147286775); internal static readonly HRESULT STG_E_BADBASEADDRESS = (HRESULT)(-2147286768); internal static readonly HRESULT STG_E_DOCFILETOOLARGE = (HRESULT)(-2147286767); internal static readonly HRESULT STG_E_NOTSIMPLEFORMAT = (HRESULT)(-2147286766); internal static readonly HRESULT STG_E_INCOMPLETE = (HRESULT)(-2147286527); internal static readonly HRESULT STG_E_TERMINATED = (HRESULT)(-2147286526); internal static readonly HRESULT STG_E_FIRMWARE_SLOT_INVALID = (HRESULT)(-2147286520); internal static readonly HRESULT STG_E_FIRMWARE_IMAGE_INVALID = (HRESULT)(-2147286519); internal static readonly HRESULT STG_E_DEVICE_UNRESPONSIVE = (HRESULT)(-2147286518); internal static readonly HRESULT STG_E_STATUS_COPY_PROTECTION_FAILURE = (HRESULT)(-2147286267); internal static readonly HRESULT STG_E_CSS_AUTHENTICATION_FAILURE = (HRESULT)(-2147286266); internal static readonly HRESULT STG_E_CSS_KEY_NOT_PRESENT = (HRESULT)(-2147286265); internal static readonly HRESULT STG_E_CSS_KEY_NOT_ESTABLISHED = (HRESULT)(-2147286264); internal static readonly HRESULT STG_E_CSS_SCRAMBLED_SECTOR = (HRESULT)(-2147286263); internal static readonly HRESULT STG_E_CSS_REGION_MISMATCH = (HRESULT)(-2147286262); internal static readonly HRESULT STG_E_RESETS_EXHAUSTED = (HRESULT)(-2147286261); internal static readonly HRESULT TYPE_E_BADMODULEKIND = (HRESULT)(-2147317571); internal static readonly HRESULT VIEW_E_DRAW = (HRESULT)(-2147221184); internal static readonly HRESULT WINCODEC_ERR_WRONGSTATE = (HRESULT)(-2003292412); internal static readonly HRESULT WINCODEC_ERR_VALUEOUTOFRANGE = (HRESULT)(-2003292411); internal static readonly HRESULT WINCODEC_ERR_UNKNOWNIMAGEFORMAT = (HRESULT)(-2003292409); internal static readonly HRESULT WINCODEC_ERR_UNSUPPORTEDVERSION = (HRESULT)(-2003292405); internal static readonly HRESULT WINCODEC_ERR_NOTINITIALIZED = (HRESULT)(-2003292404); internal static readonly HRESULT WINCODEC_ERR_ALREADYLOCKED = (HRESULT)(-2003292403); internal static readonly HRESULT WINCODEC_ERR_PROPERTYNOTFOUND = (HRESULT)(-2003292352); internal static readonly HRESULT WINCODEC_ERR_PROPERTYNOTSUPPORTED = (HRESULT)(-2003292351); internal static readonly HRESULT WINCODEC_ERR_PROPERTYSIZE = (HRESULT)(-2003292350); internal static readonly HRESULT WINCODEC_ERR_CODECPRESENT = (HRESULT)(-2003292349); internal static readonly HRESULT WINCODEC_ERR_CODECNOTHUMBNAIL = (HRESULT)(-2003292348); internal static readonly HRESULT WINCODEC_ERR_PALETTEUNAVAILABLE = (HRESULT)(-2003292347); internal static readonly HRESULT WINCODEC_ERR_CODECTOOMANYSCANLINES = (HRESULT)(-2003292346); internal static readonly HRESULT WINCODEC_ERR_INTERNALERROR = (HRESULT)(-2003292344); internal static readonly HRESULT WINCODEC_ERR_SOURCERECTDOESNOTMATCHDIMENSIONS = (HRESULT)(-2003292343); internal static readonly HRESULT WINCODEC_ERR_COMPONENTNOTFOUND = (HRESULT)(-2003292336); internal static readonly HRESULT WINCODEC_ERR_IMAGESIZEOUTOFRANGE = (HRESULT)(-2003292335); internal static readonly HRESULT WINCODEC_ERR_TOOMUCHMETADATA = (HRESULT)(-2003292334); internal static readonly HRESULT WINCODEC_ERR_BADIMAGE = (HRESULT)(-2003292320); internal static readonly HRESULT WINCODEC_ERR_BADHEADER = (HRESULT)(-2003292319); internal static readonly HRESULT WINCODEC_ERR_FRAMEMISSING = (HRESULT)(-2003292318); internal static readonly HRESULT WINCODEC_ERR_BADMETADATAHEADER = (HRESULT)(-2003292317); internal static readonly HRESULT WINCODEC_ERR_BADSTREAMDATA = (HRESULT)(-2003292304); internal static readonly HRESULT WINCODEC_ERR_STREAMWRITE = (HRESULT)(-2003292303); internal static readonly HRESULT WINCODEC_ERR_STREAMREAD = (HRESULT)(-2003292302); internal static readonly HRESULT WINCODEC_ERR_STREAMNOTAVAILABLE = (HRESULT)(-2003292301); internal static readonly HRESULT WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT = (HRESULT)(-2003292288); internal static readonly HRESULT WINCODEC_ERR_UNSUPPORTEDOPERATION = (HRESULT)(-2003292287); internal static readonly HRESULT WINCODEC_ERR_INVALIDREGISTRATION = (HRESULT)(-2003292278); internal static readonly HRESULT WINCODEC_ERR_COMPONENTINITIALIZEFAILURE = (HRESULT)(-2003292277); internal static readonly HRESULT WINCODEC_ERR_INSUFFICIENTBUFFER = (HRESULT)(-2003292276); internal static readonly HRESULT WINCODEC_ERR_DUPLICATEMETADATAPRESENT = (HRESULT)(-2003292275); internal static readonly HRESULT WINCODEC_ERR_PROPERTYUNEXPECTEDTYPE = (HRESULT)(-2003292274); internal static readonly HRESULT WINCODEC_ERR_UNEXPECTEDSIZE = (HRESULT)(-2003292273); internal static readonly HRESULT WINCODEC_ERR_INVALIDQUERYREQUEST = (HRESULT)(-2003292272); internal static readonly HRESULT WINCODEC_ERR_UNEXPECTEDMETADATATYPE = (HRESULT)(-2003292271); internal static readonly HRESULT WINCODEC_ERR_REQUESTONLYVALIDATMETADATAROOT = (HRESULT)(-2003292270); internal static readonly HRESULT WINCODEC_ERR_INVALIDQUERYCHARACTER = (HRESULT)(-2003292269); internal static readonly HRESULT WINCODEC_ERR_WIN32ERROR = (HRESULT)(-2003292268); internal static readonly HRESULT WINCODEC_ERR_INVALIDPROGRESSIVELEVEL = (HRESULT)(-2003292267); internal static readonly HRESULT WINCODEC_ERR_INVALIDJPEGSCANINDEX = (HRESULT)(-2003292266); public FACILITY_CODE Facility => (FACILITY_CODE)((Value >> 16) & 8191); public int Code => Value & 65535; public bool IsNtStatus => (Value & 268435456) == 268435456; [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal bool Succeeded { get { return Value >= 0; } } [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal bool Failed { get { return Value < 0; } } public NTSTATUS ToNtStatus() { return new NTSTATUS(Value & -268435457); } public static HRESULT FromWin32(WIN32_ERROR error) { if (error != 0) return new HRESULT((int)(error & (WIN32_ERROR)65535) | -2147024896); return S_OK; } public static implicit operator HRESULT(Exception ex) { return (HRESULT)ex.HResult; } public void AssertSuccess() { } internal HRESULT(int value) { Value = value; } public static implicit operator int(HRESULT value) { return value.Value; } public static explicit operator HRESULT(int value) { return new HRESULT(value); } public static bool operator ==(HRESULT left, HRESULT right) { return left.Value == right.Value; } public static bool operator !=(HRESULT left, HRESULT right) { return !(left == right); } public bool Equals(HRESULT other) { return Value == other.Value; } public override bool Equals(object obj) { if (obj is HRESULT) { HRESULT other = (HRESULT)obj; return Equals(other); } return false; } public override int GetHashCode() { return Value.GetHashCode(); } public override string ToString() { return string.Format(CultureInfo.InvariantCulture, "0x{0:X8}", Value); } public static implicit operator uint(HRESULT value) { return (uint)value.Value; } public static explicit operator HRESULT(uint value) { return new HRESULT((int)value); } internal HRESULT ThrowOnFailure(IntPtr errorInfo = 0) { Marshal.ThrowExceptionForHR(Value, errorInfo); return this; } internal string ToString(string format, IFormatProvider formatProvider) { return ((uint)Value).ToString(format, formatProvider); } } }