Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to load VCRT Forwarders if strict Control Flow Guard is enabled #36

Open
sylveon opened this issue Jun 29, 2021 · 1 comment

Comments

@sylveon
Copy link

sylveon commented Jun 29, 2021

int main()
{
#ifdef _CONTROL_FLOW_GUARD
	PROCESS_MITIGATION_CONTROL_FLOW_GUARD_POLICY cfg_policy;
	if (GetProcessMitigationPolicy(GetCurrentProcess(), ProcessControlFlowGuardPolicy, &cfg_policy, sizeof(cfg_policy)))
	{
		cfg_policy.StrictMode = true;
		SetProcessMitigationPolicy(ProcessControlFlowGuardPolicy, &cfg_policy, sizeof(cfg_policy));
	}
#endif

    // do something that requires loading the VCRT forwarders, like initializing WinUI.
}

When building the above code with /cf:guard, the following error occurs when trying to load the forwarder DLLs.

Exception thrown at 0x00007FFC0160467C (KernelBase.dll) in TranslucentTB.exe: WinRT originate error - 0x80070679 : 'The specified image file was blocked from loading because it does not enable a feature required by the process: Control Flow Guard.'.
@sylveon
Copy link
Author

sylveon commented Jun 29, 2021

Note that I use Control Flow Guard in both debug and release builds of my apps, both debug and release forwarders should build with Control Flow Guard enabled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant