ISSUE: Chrome is blocking code injection.

ISSUE: Chrome is blocking code injection.

Summary:

Chrome will sometimes cause the following errors in Sbie:

SBIE2303 Could not hook CoGetObject (33, 1655)
SBIE2303 Could not hook RegisterDragDrop (33, 1655)
SBIE2318 DLL initialization failed for 'ole32.dll'

Error 1655 is ERROR_DYNAMIC_CODE_BLOCKED

Repro steps:

This can be reproduced just by going to youtube.com.

Description of analysis so far:

This is seen in the Sandboxie 5.40 Open Source release.

This error is reported inside CbieDll_Hook(), file dllhook.c, line 293 when called by functions CoGetObject & RegisterDragDrop

VirtualProtect sets GetLastError to error 1655 (ERROR_DYNAMIC_CODE_BLOCKED)

VirtualProtect(&func[-8] , 20, PAGE_EXECUTE_READWRITE, &prot)) 

When Sbie detects these errors, we should be able to call SetProcessMitigationPolicy to reset this policy.

https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setprocessmitigationpolicy