/// <summary> /// Creates an instance of a COM server and call CoSetProxyBlanket. /// </summary> public static object CreateInstanceWithBlanket(Guid clsid, string host, NetworkCredential credential, ComProxyBlanket comProxyBlanket = null) { object obj = CreateInstance(clsid, host, credential); SetProxyBlanket(obj, comProxyBlanket); return(obj); }
public static void SetProxyBlanket(object comObject, ComProxyBlanket comProxyBlanket = null) { if (comProxyBlanket != null) { var result = new HRESULT(CoSetProxyBlanket(comObject, (uint)comProxyBlanket.RpcAuthService, (uint)comProxyBlanket.RpcAuthType, null, (uint)comProxyBlanket.RpcAuthnLevel, (uint)comProxyBlanket.RpcImpLevel, IntPtr.Zero, (uint)comProxyBlanket.DwCapabilities)); if (result.Failed) { throw HRESULT.GetExceptionForHR(result); } } }