42 lines
814 B
C#
42 lines
814 B
C#
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
using System.Runtime.InteropServices;
|
|||
|
|
|
|||
|
|
namespace WPFluent.Interop;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Common Windows API result;
|
|||
|
|
/// </summary>
|
|||
|
|
internal struct HRESULT
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// Operation successful.
|
|||
|
|
/// </summary>
|
|||
|
|
public const int NO_ERROR = unchecked(0x00000000);
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Operation successful.
|
|||
|
|
/// </summary>
|
|||
|
|
public const int NOERROR = unchecked(0x00000000);
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Unspecified failure.
|
|||
|
|
/// </summary>
|
|||
|
|
public const int S_FALSE = unchecked(0x00000001);
|
|||
|
|
/// <summary>
|
|||
|
|
/// Operation successful.
|
|||
|
|
/// </summary>
|
|||
|
|
public const int S_OK = unchecked(0x00000000);
|
|||
|
|
|
|||
|
|
public static void Check(int hr)
|
|||
|
|
{
|
|||
|
|
if(hr >= S_OK)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
Marshal.ThrowExceptionForHR(hr, (IntPtr)(-1));
|
|||
|
|
}
|
|||
|
|
}
|