Fix passing non-readonly-struct by read-only reference (#147)

pull/161/head
NN 2020-07-12 16:54:40 +03:00 committed by GitHub
parent 2348a4f3e7
commit ca36a6bc95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -412,10 +412,9 @@ namespace Vanara.Extensions
/// <param name="iid">The interface identifier (IID) of the requested interface.</param>
/// <param name="ppv">When this method returns, contains a reference to the returned interface.</param>
/// <returns>An HRESULT that indicates the success or failure of the call.</returns>
public static int QueryInterface(object iUnk, in Guid iid, out object ppv)
public static int QueryInterface(object iUnk, Guid iid, out object ppv)
{
var tmp = iid;
var hr = Marshal.QueryInterface(Marshal.GetIUnknownForObject(iUnk), ref tmp, out var ippv);
var hr = Marshal.QueryInterface(Marshal.GetIUnknownForObject(iUnk), ref iid, out var ippv);
ppv = hr == 0 ? Marshal.GetObjectForIUnknown(ippv) : null;
return hr;
}
@ -811,4 +810,4 @@ namespace Vanara.Extensions
throw new ArgumentException("Unable to convert object to its binary format.");
}
}
}
}