0

I have written a BHO in c# .NET target framework : 4.6.1 BHO is working fine with Visual Studio 2015 Community DEBUG Mode. But its not working while building in release mode (Platform target : Any CPU). Although I could see the add-on into manage add-on tab. IE version : 11.175.18362.0 Update version : 11.0.130 (KB4503259)

I have COM register/unregister functions as below

        public static string RegBHO = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Browser Helper Objects";
        public static string RegCmd = "Software\\Microsoft\\Internet Explorer\\Extensions";

        [ComRegisterFunction]
        public static void RegisterBHO(Type type)
        {
            string guid = type.GUID.ToString("B");
            {
                RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(RegBHO, true);
                if (registryKey == null)
                    registryKey = Registry.LocalMachine.CreateSubKey(RegBHO);
                RegistryKey key = registryKey.OpenSubKey(guid);
                if (key == null)
                    key = registryKey.CreateSubKey(guid);
                key.SetValue("NoExplorer", 1);
                registryKey.Close();
                key.Close();
            }
        }

        [ComUnregisterFunction]
        public static void UnregisterBHO(Type type)
        {
            string guid = type.GUID.ToString("B");
            // BHO
            {
                RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(RegBHO, true);
                if (registryKey != null)
                    registryKey.DeleteSubKey(guid, false);
            }
            // Command
            {
                RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(RegCmd, true);
                if (registryKey != null)
                    registryKey.DeleteSubKey(guid, false);
            }
        }

Current System : Windows 10. I could see there are two instances of IE.One in Program Files(x86) and another in Program Files .

Post Build Event Commands that I have used as below (VS2015 opened in Admin Mode)

"%windir%\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe" /unregister "$(TargetDir)$(TargetFileName)"
"%windir%\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe" "$(TargetDir)$(TargetFileName)"

"%windir%\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe" /unregister "$(TargetDir)$(TargetFileName)"
"%windir%\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe" "$(TargetDir)$(TargetFileName)"

What I could find till now . I may need to register this dll with regsvr32.exe which I am not sure. But When I am going to do that its giving me an error.

The module is loaded but could not find any entry point

Can anyone please help me to release this BHO for both IE 64 & x86?

TIA :)

Debashish Saha
  • 318
  • 1
  • 12
  • You said you can see the BHO in manage addon list. Can you please inform us, how your addon get launched? like it will add an option in the context menu or it will display somewhere else? It can be possible that your addon not creating the registry properly caused this issue. Try to check manually that registry entry is created properly. If possible post the link of the documentation you are referring for creating this sample. We will try to check it and see if there is something needs to modify or change. – Deepak-MSFT Apr 27 '20 at 07:52
  • I have followed https://stackoverflow.com/questions/5643819/how-to-get-started-with-developing-internet-explorer-extensions. After building the solution in release mode , I could see all registry entries are there . and on add-on added to IE. I enabled it. but its not working . The same thing works if I build in debug mode . – Debashish Saha Apr 27 '20 at 08:26
  • Did you run this line of command? "%ProgramFiles(x86)%\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\gacutil.exe" /f /i "$(TargetDir)$(TargetFileName)" I suggest first only try to register for 32 bit and check whether it works or not. Also try to configure the Internet options mentioned in the other answer of that thread may help if issue caused by those options. – Deepak-MSFT Apr 29 '20 at 07:55
  • Sorry for late in reply . I found the issue . IE by default runs in protected mode . if I disable it , it works perfectly . Now , I am not sure how to bypass this protected mode. – Debashish Saha May 06 '20 at 07:51
  • If you had registered it for 64 bit then try to go to Internet options-> Advanced tab and checked the option 'Enable 64-bit processes for enhanced protected mode'. 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. Ref: https://stackoverflow.com/questions/17570827/ie-bho-in-epm-enhanced-protected-mode and https://stackoverflow.com/questions/46003656/cannot-get-bho-working-in-64-bit – Deepak-MSFT May 06 '20 at 08:42
  • I tried doing that too . but did not work .aren't Enhanced protected mode and Protected Mode different ?EPM is already disabled by default. But Protected Mode is enabled by default. (Internet options -> Security) – Debashish Saha May 06 '20 at 08:45
  • I want to confirm with you that your BHO DLL is also in the AppContainer readable folder. Right? – Deepak-MSFT May 11 '20 at 09:01
  • yes . But did not work – Debashish Saha May 11 '20 at 12:15

0 Answers0