How to block loading of BHO and band objects into explorer.exe process

P

Polanski24

Hello!

I have developed a managed BHO and band objects which work almost OK.
One of two problems I currently face is that they are always loaded
into
explorer.exe processs when folder browser window is open (they are not
loaded at initial explorer.exe startup at the user session start).

IObjectWithSite.SetSite implementation is used for checking if process
the controls are in is explorer.exe and if yes the COMException with
HRESULT E_FAIL is thrown. This prevents controls from being activated
but as assemblies are once loaded into process they stay in there until
process ends. .NET band object is not a lightweight component and it
should be prevented from being loaded as useless memory garbage.

My understanding is that explorer loads data into deafult AppDoamin
which
just stays there until process terminates. I have tried to call
AppDomain.Unload(AppDomain.CurrentDomain) but with no success - as
expected. This is obviously a bad solution as any other managed BHOs or
band objects would be unloaded in case of success as well.

Long reasearch pointed me into the direction of unmanaged solution
which uses DllMain return value to prevent loading - false is returned
when module is loaded into explorer.exe process.

Any ideas how can I accomplish selective loading from managed code
only?

Cheers
 
P

Polanski24

Hello!

Just by accident I have found old thread on identical problem with some
unmanaged solutions - it's not what I looked for - and a registration
method which prevents whole assembly containing BHO from being loaded
(including even band objects).

Just create the following registry entry

HKLM {
SOFTWARE {
Microsoft {
Windows {
CurrentVersion {
Explorer {
'Browser Helper Objects' {
ForceRemove {00000000-MYGUID-0000-0000-000000000000} {
val NoExplorer = s ""

}}}}}}}}

This is a RGS script which sets under BHO Guid value NoExplorer to
empty string "".

This works only on Windows XP / Server 2003. On earlier versions only
unmanaged solutions could be used.

For details look here:

http://groups.google.pl/group/micro...ublic.dotnet.*&rnum=22&hl=pl#4ee13cb69625c48d

Cheers

http://sourceforge.net/projects/ngmp
 
Top