views:

23

answers:

1

After much research it appears to create and use our own security manager in the web browser control in IE we need to override the GetSecurityId method for both IInternetHostSecurityManager and IInternetSecurityManager as at some point they are compared and if found to return a different result they throw a UnauthorizedAccess exception. Has anyone had success with overriding IInternetHostSecurityManager. MSDN suggests accessing it through SID_SInternetSecurityManager , but I have not found any other references to SID_SInternetSecurityManager. Also I have not found a guid for IInternetHostSecurityManager so I can not access it through IServiceProvider.QueryService. Any one successfully get around this or find a different method of access cross domain iframes in the webbrowser control?

A: 

IID_IInternetHostSecurityManager, SID_SInternetSecurityManager and SID_SInternetHostSecurityManager are defined in urlmon.h and urlmon.idl. If you have link errors in C++, check How to avoid error "LNK2001 unresolved external" by using DEFINE_GUID.

If you are using a script language you can use midl /tlb to generate a type library from urlmon.idl and import the type library instead. You can also declare the guids and interfaces based on the definition in urlmon.idl.

Sheng Jiang 蒋晟