protected Delegate GetDelegate(string functionName, Type delegateType)
        {
            IntPtr procAddress = LibraryHandle.GetProcAddress(this, functionName);

            if (procAddress == IntPtr.Zero)
            {
                throw new Win32Exception((int)LibraryHandle.GetLastError());
            }
            return(Marshal.GetDelegateForFunctionPointer(procAddress, delegateType));
        }
 private static extern IntPtr GetProcAddress([In] LibraryHandle hModule, [MarshalAs(UnmanagedType.LPStr)][In] string lpProcName);
 protected void ThrowOnError()
 {
     throw new Win32Exception((int)LibraryHandle.GetLastError());
 }
 protected override bool ReleaseHandle()
 {
     return(LibraryHandle.FreeLibrary(this.handle) != 0);
 }