// Decompiled with JetBrains decompiler // Type: Microsoft.InfoCards.RpcCryptoContext // Assembly: infocard, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 // MVID: 516D8B44-4448-4D2C-8B8E-FFBB3FFE472B // Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00000-msil\Virus.Win32.Expiro.w-69bb73081eac86b8cf86f45e33515d0095855636967076e2b593d7a30cd80a07.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))); } } }