private static int QueryInterface(IntPtr @this, ref Guid riid, IntPtr ppvObject)
{
#if MAP_EX_TO_HR
try
{
#endif
if (IID_IUnknown.Equals(riid) || IID_IStream.Equals(riid))
{
Marshal.WriteIntPtr(ppvObject, @this);
AddRef(@this);
return S_OK;
}
else
{
Marshal.WriteIntPtr(ppvObject, IntPtr.Zero);
return E_NOINTERFACE;
}
#if MAP_EX_TO_HR
}
catch (Exception e)
{
return GetHRForException(e);
}
#endif
}