Ejemplo n.º 1
0
                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;
                }
Ejemplo n.º 2
0
 internal static extern IntPtr GetProcAddress(ZLibNative.SafeLibraryHandle moduleHandle, string procName);