コード例 #1
0
ファイル: ZlibNative.cs プロジェクト: neoscrib/secureshell
                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;
                }
コード例 #2
0
ファイル: ZlibNative.cs プロジェクト: neoscrib/secureshell
 internal static extern IntPtr GetProcAddress(ZLibNative.SafeLibraryHandle moduleHandle, string procName);