// Decompiled with JetBrains decompiler // Type: Microsoft.InfoCards.RpcCryptoContext // Assembly: infocard, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 // MVID: ADE0A079-11DB-4A46-8BDE-D2A592CA8DEA // Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00000-msil\Virus.Win32.Expiro.w-67b630ead60119692b9abbdfd8717c96904ef041127c2cae033c86b718eaa61e.exe using Microsoft.InfoCards.Diagnostics; using System; using System.ComponentModel; namespace Microsoft.InfoCards { internal class RpcCryptoContext : IDisposable { private string m_portName; private string m_contextKey; private IntPtr m_idlHandle; private object m_syncRoot; private bool m_open; private bool m_disposed; public RpcCryptoContext(string portName, string contextKey) { this.m_portName = portName; this.m_contextKey = contextKey; this.m_syncRoot = new object(); this.m_disposed = false; } ~RpcCryptoContext() { if (this.m_disposed) return; ((IDisposable) this).Dispose(); } public string ContextKey => this.m_contextKey; public IntPtr InterfaceHandle => this.m_idlHandle; public bool IsOpen => this.m_open; public void Open() { this.ThrowIfDisposed(); if (this.m_open) return; try { this.m_idlHandle = NativeMcppMethods.RpcCryptoOpen(this.m_portName); } catch (Win32Exception ex) { throw InfoCardTrace.ThrowHelperError((Exception) new CommunicationException((string) null, (Exception) ex)); } this.m_open = true; } public void Close() { if (!this.m_open) return; try { NativeMcppMethods.RpcCryptoClose(this.m_idlHandle, this.m_contextKey); } catch (Win32Exception ex) { throw InfoCardTrace.ThrowHelperError((Exception) new CommunicationException((string) null, (Exception) ex)); } this.m_idlHandle = IntPtr.Zero; this.m_open = false; } void IDisposable.Dispose() { if (this.m_disposed) return; lock (this.m_syncRoot) { if (this.m_disposed) return; this.m_disposed = true; try { this.Close(); } catch (CommunicationException ex) { string message = ex.Message; } this.m_portName = (string) null; this.m_contextKey = (string) null; this.m_idlHandle = IntPtr.Zero; GC.SuppressFinalize((object) this); } } private void ThrowIfDisposed() { if (this.m_disposed) throw InfoCardTrace.ThrowHelperError((Exception) new ObjectDisposedException(nameof (RpcCryptoContext))); } } }