public SevenZipHandle(string sevenZipLibPath) { this.sevenZipSafeHandle = Kernel32Dll.LoadLibrary(sevenZipLibPath); if (this.sevenZipSafeHandle.IsInvalid) { throw new Win32Exception(); } IntPtr functionPtr = Kernel32Dll.GetProcAddress(this.sevenZipSafeHandle, "GetHandlerProperty"); // Not valid dll if (functionPtr == IntPtr.Zero) { this.sevenZipSafeHandle.Close(); throw new ArgumentException(); } }
internal static extern IntPtr GetProcAddress(SafeLibraryHandle hModule, [MarshalAs(UnmanagedType.LPStr)] string procName);