Inheritance: Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NativeLibrary"/> class.
 /// </summary>
 /// <param name="fileName">full path name of dll to load</param>
 /// <exception cref="System.IO.FileNotFoundException">
 /// If fileName can't be found
 /// </exception>
 /// <remarks>
 /// This constructor loads a DLL and makes this class responible for 
 /// freeing it. Throws exceptions on failure. Most common failure would be 
 /// file-not-found, or that the file is not a loadable image.
 /// </remarks>
 public NativeLibrary(string fileName)
 {
     this.libraryHandle = NativeMethods.LoadLibrary(fileName);
     if (this.libraryHandle.IsInvalid)
     {
         int hr = Marshal.GetHRForLastWin32Error();
         Marshal.ThrowExceptionForHR(hr);
     }
 }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NativeLibrary"/> class.
 /// </summary>
 /// <param name="fileName">full path name of dll to load</param>
 /// <exception cref="System.IO.FileNotFoundException">
 /// If fileName can't be found
 /// </exception>
 /// <remarks>
 /// This constructor loads a DLL and makes this class responible for
 /// freeing it. Throws exceptions on failure. Most common failure would be
 /// file-not-found, or that the file is not a loadable image.
 /// </remarks>
 public NativeLibrary(string fileName)
 {
     this.libraryHandle = NativeMethods.LoadLibrary(fileName);
     if (this.libraryHandle.IsInvalid)
     {
         int hr = Marshal.GetHRForLastWin32Error();
         Marshal.ThrowExceptionForHR(hr);
     }
 }
示例#3
0
 internal static extern IntPtr GetProcAddress(NativeLibrarySafeHandle hModule, [MarshalAs(UnmanagedType.LPStr)]string procName);
示例#4
0
 internal static extern IntPtr GetProcAddress(NativeLibrarySafeHandle hModule, [MarshalAs(UnmanagedType.LPStr)] string procName);