locked
IInternetSession::RegisterNameSpace doesnt work!!! RRS feed

  • Question

  • Hello

    i've got the following problem. in my application I want to add 2 custom protocol handlers for custom protocols. But for some unknown reasons only one of the is working - i.e. urlmon creates its instance and calls methods. For another one (which is almost exactly the same!) even factory' CreateInstance method doesnt called. Here is a paert of code where I register my namespaces:

    			IInternetSession *pIS = NULL;
    			REQUIRE_SUCCESS(::CoInternetGetSession(0,&pIS,0));
    
    			LPCWSTR pattern = L"data";
    			LPCWSTR *patterns = &pattern;
    
    			REQUIRE_SUCCESS(pIS->RegisterNameSpace(&CustomProtocol::classFactory,IID_IInternetProtocol,L"data",1,patterns,NULL));
    
    			
    			pattern = L"dll";
    			patterns = &pattern;
    
    			REQUIRE_SUCCESS(pIS->RegisterNameSpace(&DllProtocol::classFactory,IID_IInternetProtocol,L"dll",1,patterns,NULL));
    
    

    For some unknown reasons CustomProtocol handler ("data" namespace) doesn't work. On other hand "dll" handler (DllProtocol) works perfectly. Can somebody help me with this issue? Maybe there are any limitations or something?

    P.S. If any additional info or code is required - please fill free to ask - I'll post it ASAP.

    Tuesday, September 14, 2010 10:28 AM

Answers

  • Globus000 wrote:

    Thank you for your response but it looks like CLSIDs don't help - I've  created 2 ones and specified in RegisterNameSpace() calls,
    also passed o and NULL for patterns - still no luck :( Any thoughts?  Maybe something else?

    What happens if you change "data" to, say, "data1"? I seems "data" is  treated specially somehow. It's apparently supported in some limited  contexts - see

    http://msdn.microsoft.com/en-us/library/cc848897.aspx

    but there's no entry for it under HKCR\PROTOCOLS. I suspect data: URLs  are handled directly by MSHTML, without going through UrlMon.


    Igor Tandetnik

    • Marked as answer by Globus000 Wednesday, September 22, 2010 8:29 AM
    Tuesday, September 14, 2010 6:37 PM

All replies

  • Globus000 wrote:

    i've got the following problem. in my application I want to add 2  custom protocol handlers for custom protocols. But for some
    unknown reasons only one of the is working - i.e. urlmon creates its  instance and calls methods. For another one (which is almost
    exactly the same!) even factory' CreateInstance method doesnt called.  Here is a paert of code where I register my namespaces:
    [code]   REQUIRE_SUCCESS(pIS->RegisterNameSpace(&CustomProtocol::classFactory,IID_ IInternetProtocol,L"data",1,patterns,NULL));

    The second parameter is a CLSID, not an IID. Use two different ones in  the two calls (just generate two new GUIDs, it doesn't matter what the  actual values are). I think, but not 100% sure, it would also work if  you just use CLSID_NULL in both places.

    Patterns are not supported, to my knowledge. Just pass 0 and NULL for  the 4th and 5th parameters.


    Igor Tandetnik

    Tuesday, September 14, 2010 12:22 PM
  • Hi Igor!

    Thank you for your response but it looks like CLSIDs don't help - I've created 2 ones and specified in RegisterNameSpace() calls, also passed o and NULL for patterns - still no luck :( Any thoughts? Maybe something else?

    P.S. I've already spent almost a day trying to solve this but looks like I'm stuck - so any ideas are appriciated!!!

    Tuesday, September 14, 2010 1:01 PM
  • Globus000 wrote:

    Thank you for your response but it looks like CLSIDs don't help - I've  created 2 ones and specified in RegisterNameSpace() calls,
    also passed o and NULL for patterns - still no luck :( Any thoughts?  Maybe something else?

    What happens if you change "data" to, say, "data1"? I seems "data" is  treated specially somehow. It's apparently supported in some limited  contexts - see

    http://msdn.microsoft.com/en-us/library/cc848897.aspx

    but there's no entry for it under HKCR\PROTOCOLS. I suspect data: URLs  are handled directly by MSHTML, without going through UrlMon.


    Igor Tandetnik

    • Marked as answer by Globus000 Wednesday, September 22, 2010 8:29 AM
    Tuesday, September 14, 2010 6:37 PM
  • Thanks for this link and response! Changing data to something else helped!

    Wednesday, September 22, 2010 8:32 AM