WinFormsComInterop
WinFormsComInterop copied to clipboard
Check for return value after call in out parameters
HRESULT Shell32.IFileOpenDialog.GetSelectedItems(out Shell32.IShellItemArray ppsai)
{
var comDispatch = (System.IntPtr*)thisPtr;
var vtbl = (System.IntPtr*)comDispatch[0];
System.IntPtr local_0;
int retVal;
retVal = ((delegate* unmanaged<System.IntPtr, System.IntPtr*, int>)vtbl[28])(thisPtr, &local_0);
ppsai = local_0 == System.IntPtr.Zero ? null : (Shell32.IShellItemArray)Marshal.GetObjectForIUnknown(local_0);
return (HRESULT)retVal;
}
retVal should be checked before calling Marshal.GetObjectForIUnknown