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));
        }
 protected void ThrowOnError()
 {
     throw new Win32Exception((int)LibraryHandle.GetLastError());
 }