private static IntPtr GetCorBindToRuntimeExAddress(uint pid, IntPtr hProc, bool x86) { var mods = NativeHelper.GetModules(pid); var mod = mods.SingleOrDefault(x => x.moduleName.Equals("mscoree.dll", StringComparison.InvariantCultureIgnoreCase)); if (mod == default) { throw new Exception("Couldn't find MSCOREE.DLL, arch mismatch?"); } int fnAddr = CodeInjectionUtils.GetExportAddress(hProc, mod.baseAddress, "CorBindToRuntimeEx", x86); return(mod.baseAddress + fnAddr); }