Avinash Agarwal
Avinash Agarwal

Reputation: 157

Browser Helper Object Issue: setsite/getsite not called on one machine

I have developed a Managed Browser Helper Object (BHO). This works on all machines except one.

I have ensured that protected mode is off and UAC is also turned off on this machine.

This particular machine is Win Vista with IE 8.

I added some debug logs and message box in GetSite and Setsite. I do not see these logs or message box. I am assuming that these are not being called for some reason.

Is there some better way to debug my problem?

Thanks

Upvotes: 2

Views: 1250

Answers (1)

Alex F
Alex F

Reputation: 3539

Once it happens to me when I entered wrong COM object GUID. In 'must-have' interface 'IObjectWithSite' the definition must-be as follows:

/// <summary>
/// Interface to hook into IE
/// </summary>
[
    ComImport(), 
    ComVisible(true),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
    Guid("FC4801A3-2BA9-11CF-A229-00AA003D7352") // Defined here: http://msdn.microsoft.com/en-us/library/aa768186(v=vs.85).aspx
]
interface IObjectWithSite
{
    /// <summary>
    /// Function will register our program with actual browser
    /// </summary>
    /// <param name="pUnkSite"></param>
    /// <returns></returns>
    //[PreserveSig]
    void SetSite([In, MarshalAs(UnmanagedType.IUnknown)] object pUnkSite);

    /// <summary>
    /// Callers invoke this to retrieve the container site previously sent to SetSite().
    /// This implementation handles the return of appropriate HRESULT per the
    /// documented interface requirements for IObjectWithSite.
    /// </summary>
    /// <param name="riid">GUID for the interface requested of the site object</param>
    /// <param name="ppvSite">Fill this with the site object if we find the interface through QI call</param>
    void GetSite(ref Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object ppvSite);

}//interface close

But since you sad that only one machine doesn't support it...

Upvotes: 5

Related Questions