IE BHO in EPM (Enhanced Protected Mode)
Asked Answered
M

1

10

I'm trying to make my IE BHO work on Win8 (IE10 and IE11 preview) with EPM turned on. I've found a few articles about the subject from MS (http://blogs.msdn.com/b/ieinternals/archive/2012/03/23/understanding-ie10-enhanced-protected-mode-network-security-addons-cookies-metro-desktop.aspx) but they still don't provide actual examples on how to make this work. I have compiled my BHO in both 32 and 64 bit, added the category (CATID_AppContainerCompatible) as stated in the article but still I don't get any web browser events from IE. Can anybody point to a more detailed example on how to make this work ?

Here is how my rgs file looks like:


HKCR
{
    TestBHO.TestScript.1 = s 'TestScript Class'
    {
        CLSID = s '{051FB9EC-79EA-4F8E-9EC2-F1FF4462FB09}'
    }
    TestBHO.TestScript = s 'TestScript Class'
    {
        CLSID = s '{051FB9EC-79EA-4F8E-9EC2-F1FF4462FB09}'
        CurVer = s 'TestBHO.TestScript.1'
    }
    NoRemove CLSID
    {
        ForceRemove {051FB9EC-79EA-4F8E-9EC2-F1FF4462FB09} = s 'TestScript Class'
        {
            ProgID = s 'TestBHO.TestScript.1'
            VersionIndependentProgID = s 'TestBHO.TestScript'
            ForceRemove 'Programmable'
            InprocServer32 = s '%MODULE%'
            {
                val ThreadingModel = s 'Apartment'
            }
            'TypeLib' = s '{2D9CE0FA-2040-4A24-807E-0C0BF4E9ECE7}'
            'Implemented Categories' = s ''
            {
                {59fb2056-d625-48d0-a944-1a85b5ab2640} = s ''   
                    {
                    }
            }
        }
    }
}

Note that in IE's Manage Add-ons Page I see my BHO as Enabled and supports both 32bit and 64bit, but the DLL is not even loaded.

Messene answered 10/7, 2013 at 12:36 Comment(2)
First off, have you tried disabling EPM to confirm that you're getting the content you expect when EPM isn't on? Second, does IE's Add-on Manager show that your add-on is loading? Third, how specifically are you watching to see if your add-on is getting events?Monocle
1. Yes, the BHO is behaving as expected when disabling EPM. 2. According to the Add-on Manager the status is "Enabled" and the BHO is of "32 AND 64 bit". 3. I've added two messages boxes to let me know I get the events I'm expecting. One when SetSite is called and the other when the DISPID_DOCUMENTCOMPLETE is called. Again, both events are called as expected when EPM is NOT enabled.Messene
M
6

The DEFINE_GUID call simply defines the GUID value constant in your code, it's not actually doing anything to register your object with the COM component category (which is stored in the registry).

See http://msdn.microsoft.com/en-us/library/windows/desktop/ms692551(v=vs.85).aspx and http://msdn.microsoft.com/en-us/library/windows/desktop/ms694322(v=vs.85).aspx

You can see which objects are registered into the various categories using the OLEView tool.

Also, be sure to place your BHO's DLL with an AppContainer-readable folder (e.g. a subfolder of the \Program Files\ folder). If you fail to do so, your DLL will not be loaded by the IE instance in Enhanced Protected Mode.

Monocle answered 12/7, 2013 at 3:19 Comment(7)
Yes I understand that I have to register my object to that category. See my original question on how my rgs file looks like. Maybe I understood this wrong ? (I never worked with COM component categories). Also I've made sure my BHO is located under the "LocalLow" folder. Was that your intention ? And another question, is there a reason why ATL will not work with this ?Messene
As I said in email, your DLL works fine when it's put in the Program Files folder.Monocle
@Messene Did you fix your issue ? Adding the "Implemented Categories" as you did, and putting my DLLs in a subfolder of "Program Files" worked for me.Judicious
@Judicious Yep, seems to work. Not exactly sure where the constraint of putting the DLL in "Program Files" comes from but never mind that... Thanks.Messene
The constraint is simple: AppContainers can only read from filesystem paths that are ACL'd to allow AppContainers to access them. IE's Content Process can't load your DLL if it's not in a path that it has permission to access.Monocle
@EricLaw, so I any other dependencies linked to my BHO also need to be in Program Files (eg. Qt DLLs, or boost) ? But the standard librairies likes OLE32.dll or KERNEL32.dll can remain in the System32 folder ? (Also, thanks for being such (the only) help on EPM issues thoughout the web...)Judicious
Scratch my previous comment... Putting your DLLs in System32/SysWOW64 works too.Judicious

© 2022 - 2024 — McMap. All rights reserved.