Exemple #1
0
        public static IntPtr GetProcAddress(IntPtr hModule, string functionName)
        {
            IntPtr procAddress = NativeMethods.GetProcAddress(hModule, functionName);

            if (procAddress == IntPtr.Zero)
            {
                string moduleFileName = LibraryMethods.GetModuleFileName(hModule);
                throw new Exception(moduleFileName);
            }
            return(procAddress);
        }
Exemple #2
0
 public static T GetFunction <T>(IntPtr hModule, string functionName) where T : Delegate
 {
     return((T)Marshal.GetDelegateForFunctionPointer(LibraryMethods.GetProcAddress(hModule, functionName), typeof(T)));
 }