private static void LoadZLibDLL() { new FileIOPermission(PermissionState.Unrestricted).Assert(); string str = Path.Combine(Environment.CurrentDirectory, ZLibNativeDllName); if (!File.Exists(str)) { throw new DllNotFoundException(ZLibNativeDllName); } ZLibNative.SafeLibraryHandle safeLibraryHandle = ZLibNative.NativeMethods.LoadLibrary(str); if (safeLibraryHandle.IsInvalid) { Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error(), new IntPtr(-1)); throw new InvalidOperationException(); } ZLibNative.ZLibStreamHandle.zlibLibraryHandle = safeLibraryHandle; }
internal static extern IntPtr GetProcAddress(ZLibNative.SafeLibraryHandle moduleHandle, string procName);