Пример #1
0
        /// <summary>
        /// Get the GetStagedPackageOrigin method as a delegate. It's supposed to be exposed by kernel32,
        /// but actually doesn't seem to be.
        /// </summary>
        /// <returns></returns>
        private static GetStagedPackageOrigin FindDelegate()
        {
            GetStagedPackageOrigin result      = null;
            SafeLoadLibraryHandle  kernel_base = SafeLoadLibraryHandle.GetModuleHandleNoThrow("kernelbase");

            if (!kernel_base.IsInvalid)
            {
                result = kernel_base.GetFunctionPointer <GetStagedPackageOrigin>(false);
            }
            if (result != null)
            {
                return(result);
            }
            SafeLoadLibraryHandle kernel32 = SafeLoadLibraryHandle.GetModuleHandle("kernel32");

            return(kernel32.GetFunctionPointer <GetStagedPackageOrigin>());
        }
 private void GetFunc <T>(ref T f) where T : class
 {
     f = _dbghelp_lib.GetFunctionPointer <T>();
 }