Ejemplo n.º 1
0
        /// <summary>
        /// Opens a library. If 'filename' is not a fully-qualified path, the default search path is used.
        /// </summary>
        public static SafeLibraryHandle Open(string filename)
        {
            const uint LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800U; // from libloaderapi.h

            SafeLibraryHandle handle = UnsafeNativeMethods.LoadLibraryEx(filename, IntPtr.Zero, LOAD_LIBRARY_SEARCH_SYSTEM32);

            if (handle == null || handle.IsInvalid)
            {
                UnsafeNativeMethods.ThrowExceptionForLastWin32Error();
            }
            return(handle);
        }
Ejemplo n.º 2
0
 internal static extern IntPtr GetProcAddress(
     [In] SafeLibraryHandle hModule,
     [In, MarshalAs(UnmanagedType.LPStr)] string lpProcName);
Ejemplo n.º 3
0
 internal static extern bool GetModuleHandleEx(
     [In] uint dwFlags,
     [In] SafeLibraryHandle lpModuleName, // can point to a location within the module if GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS is set
     [Out] out IntPtr phModule);