Exemplo n.º 1
0
 /// <summary>
 /// Call FreeLibrary on the unmanaged dll. All function pointers
 /// handed out from this class become invalid after this.
 /// </summary>
 /// <remarks>This is very dangerous because it suddenly invalidate
 /// everything retrieved from this dll. This includes any functions
 /// handed out via GetProcAddress, and potentially any objects returned
 /// from those functions (which may have an implemention in the
 /// dll).
 /// </remarks>
 public void Dispose()
 {
     if (!m_hLibrary.IsClosed)
     {
         m_hLibrary.Close();
     }
 }
Exemplo n.º 2
0
 public void Dispose()
 {
     if (_handle != null && !_handle.IsClosed)
     {
         _handle.Close();
     }
 }
Exemplo n.º 3
0
 protected void Dispose(bool disposing)
 {
     if ((LibHandle != null) && !LibHandle.IsClosed)
     {
         LibHandle.Close();
     }
     LibHandle = null;
 }
Exemplo n.º 4
0
 void Dispose(bool disposing)
 {
     if (!disposedValue)
     {
         disposedValue = true;
         _sym_cleanup?.Invoke(_process);
         _dbghelp_lib?.Close();
     }
 }
Exemplo n.º 5
0
        public SevenZipFormat(string sevenZipLibPath)
        {
            LibHandle = LoadLibrary(sevenZipLibPath);
            if (LibHandle.IsInvalid)
            {
                throw new Win32Exception();
            }

            IntPtr FunctionPtr = GetProcAddress(LibHandle, "GetHandlerProperty");

            // Not valid dll
            if (FunctionPtr == IntPtr.Zero)
            {
                LibHandle.Close();
                throw new ArgumentException();
            }
        }
Exemplo n.º 6
0
        public SevenZipFormat(string sevenZipLibPath)
        {
            //string pp = "D:\\Projects\\CB\\Alternative\\Alternative\\CreateListArh\\bin\\Debug\\7z.dll";
            LibHandle = LoadLibrary(sevenZipLibPath);
            //LibHandle = LoadLibrary(pp);
            if (LibHandle.IsInvalid)
            {
                throw new Win32Exception();
            }

            IntPtr FunctionPtr = GetProcAddress(LibHandle, "GetHandlerProperty");

            // Not valid dll
            if (FunctionPtr == IntPtr.Zero)
            {
                LibHandle.Close();
                throw new ArgumentException();
            }
        }
Exemplo n.º 7
0
        internal SevenZipLibrary(string sevenZipLibPath)
        {
            if (!File.Exists(sevenZipLibPath))
            {
                throw new FileNotFoundException("Required file not found.", sevenZipLibPath);
            }

            _libHandle = NativeMethods.LoadLibrary(sevenZipLibPath);

            if (_libHandle.IsInvalid)
            {
                throw new Win32Exception("LoadLibrary call for 7z.dll failed: invalid handle!");
            }

            IntPtr functionPtr = NativeMethods.GetProcAddress(_libHandle, "GetHandlerProperty");

            if (functionPtr == IntPtr.Zero)
            {
                _libHandle.Close();
                throw new ArgumentException("7z library: invalid DLL!");
            }
        }
Exemplo n.º 8
0
 protected void Dispose(bool disposing)
 {
     _libHandle.Close();
     _libHandle = null;
 }