It seems it doesn't work for everyone, so, I'll describe what I did to make it work.
1) download the sample project from here: https://github.com/reinaldo13/ie-bho-extension
2) modify RegisterBHO(...)
method in BHO.cs
from:
RegistryKey ourKey = registryKey.OpenSubKey(guid);
to:
RegistryKey ourKey = registryKey.OpenSubKey(guid, true); //we want to write the registry
3) compile the project for AnyCPU: Project properties, select AnyCPU for the platform target.
4) create a .bat like this, adapt yo your path, and copy that aside your outputs dll:
"c:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe" ieextension.dll /codebase
"c:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe" ieextension.dll /codebase
This will register the dll for x86 and x64. This is mandatory to have both version registered otherwise IE won't like it (it will complain the extension is 'incompatible') because it won't be able to start it depending on your IE settings. Note I suppose you can have two different files for each version but .NET's AnyCPU doesn't need that.
5) run that .bat as admin, here is the output when I do this:
"c:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe" ieextension.dll /codebase
Microsoft .NET Framework Assembly Registration Utility version 4.7.2046.0
for Microsoft .NET Framework version 4.7.2046.0
Copyright (C) Microsoft Corporation. All rights reserved.
RegAsm : warning RA0000 : Registering an unsigned assembly with /codebase can cause your assembly to interfere with other applications that may be installed on the same computer. The /codebase switch is intended to be used only with signed assemblies. Please give your assembly a strong name and re-register it.
Types registered successfully
"c:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe" ieextension.dll /codebase
Microsoft .NET Framework Assembly Registration Utility version 4.7.2046.0
for Microsoft .NET Framework version 4.7.2046.0
Copyright (C) Microsoft Corporation. All rights reserved.
RegAsm : warning RA0000 : Registering an unsigned assembly with /codebase can cause your assembly to interfere with other applications that may be installed on the same computer. The /codebase switch is intended to be used only with signed assemblies. Please give your assembly a strong name and re-register it.
Types registered successfully
6) run iexplore.exe
. It may work depending on your settings (displays a "HOLA!!!" messagebox), but anyway, go to menu Tools / Internet Options / Programs / Manage add-ons, this is what I see:
If the extension is disabled, you should be able to enable it (and restart).
If it doesn't work (by default it shouldn't), make sure you've checked "Enable 64-bit processes for Enhanced Protected Mode*" (needs restart). To me the message is wrong, it should just say "Enable 64-bit processes"...
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe ieextension.dll /codebase
(no need to copy to program files thanks to codebase), 3) make sure main iexplore.exe runs 64-bit, 4) make sure "Enable 64-bit processes for Enhanced Protected Mode" is checked in IE"s Tools/Options/Advanced. FYI I don't have "Enable Enhanced Protected Mode" enable. – RepugnanceregistryKey.OpenSubKey(guid, true);
to be able to write the key, but it's the only change I made. Regasm 64 must be ran as admin (as usual for changes in HKLM) Plus setup IE options as in my previous comments. – Repugnance