Still registering the protocol handler

by Matt 7. November 2006 07:39

I've got my vpc image set up with XP, VC++, WDS2.6.5 and the various SDKs. I've got the code from last time, and I can register a COM object via a ProgId to handle the "msfeed:" protocol. But that's only half the story. I need to tell WDS what urls to index - at least where to start.

This is easier said than done. To quote the original MSN Desktop Search documentation:

After the protocol handler is registered, use the AddDefaultUrl method in the ISearchCrawlScopeManager interface to set default crawling rules to include and exclude particular URLs and child URLs

It doesn't mention where ISearchCrawlScopeManager comes from or what object implements it - do I implement it, or does WDS? Can I get to it from another object, or do I have to CoCreateInstance it?

Questions to keep you awake at night. I can put you out of your misery - ISearchCrawlScopeManager gets passed into ISearchProtocolOptions->GetDefaultCrawlScope. Clear as mud, eh?

Given this brick wall, there's only one thing to do - implement something. I'm going to create a COM object that implements ISearchProtocol, as this is the main interface that WDS is expecting. This will be the Sticklebackplastic.MsFeedProtocolHandler.1 object we said would handle "msfeed:" so make sure to ignore these instructions and keep the ProgId! I've given this object a threading model of "Both" for the moment. Easy option. I've also created my own trace category, and used the ATLTRACENOTIMPL macro in each method. That, coupled with ATL_DEBUG_QI should report any activity on that object, including unimplemented interfaces. (I could paste the code here, but it's long and not currently very interesting and this post is going to be long enough without it, so just download it all at the end...)

You're going to need DebugView now - atl will write debug info when one of my unimplemented methods is called, or when an unimplemented interface is requested.

But to get that info, I need the code running, and the only way I can get the code running right now is to register the dll.

What I really want WDS to do is get my request to register the protocol handler, fire up the object via it's ProgId, and ask for an interface, or call an unimplemented method so that I can see what to implement next.

The only problem is a bug in 2.6.5. WDS just sits there, oblivious.

You have to give it a bit of a kick, either by exiting WDS and restarting, or by selecting "Index Now" (which you might have to do a couple of times before it actually does the trick). Now, the protocol handler will get created by WDS, and it will ask for ISearchProtocol. It also asks for ISearchProtocolOptions, which hasn't yet been implemented. (I also get asked for ISearchProtocolThreadContext, which is defined in the Vista Windows SDK. I'm going to ignore that for now.)

Now I can implement my GetDefaultCrawlScope, and call AddDefaultUrl with a default url of "msfeed://localhost/". Going to the search options dialog shows this url with a checkbox as one of the things being searched. Looks like we're off to a good start.

You can add more than one url at a time. I could add "msfeed://localhost/" and "msfeed://localhost/matt/". Only the first would show up in the options dialog (perhaps because matt is a directory under localhost?) Add them in the opposite order, and both show up. Go figure.

Another somewhat annoying thing is that if I unregister the protocol handler (using ISearchManager->RemoveProtocol) it doesn't remove it from the options dialog.

There's more to ISearchProtocolOptions than just GetDefaultCrawlScope, but nothing else is being asked for yet, so I'm going to leave it at that.

Next on the agenda is implementing ISearchProtocol.

You can download the current code here.

Tags:

Windows Desktop Search

Comments (10) -

suv review
suv review
7/20/2011 10:24:16 PM #

Una pagina sarà dedicata agli accessori, una alle giacche e ai giubbotti. Troverai le indicazioni per lo spaccio o negozio Moncler più vicino a casa tua e tutte le offerte più vantaggiose di questo prestigioso marchio.

Reply

i phone 4g
i phone 4g
7/23/2011 8:46:24 PM #

I've recently began a weblog, the data you provide on this site has helped me tremendously. Thanks for all your time & work.

Reply

ipad apps
ipad apps
7/24/2011 5:12:51 AM #

hi!,I like your writing so so much! proportion we communicate extra about your post on AOL? I require a specialist in this area to unravel my problem. May be that's you! Taking a look forward to see you.

Reply

led strips for clothing
led strips for clothing
10/12/2011 6:19:37 PM #

Love it, but I wish this was easier to find. Took me like 20 mins to find on the schools website directory - otherwise, top notch!

Reply

Taren Esh
Taren Esh United States
1/6/2016 2:13:47 PM #

Congrats! So glad to see this site getting the recognition it deserves, the world can always use a little more awesome.

Reply

Hank Orefice
Hank Orefice United States
1/15/2016 4:56:57 AM #

Congratulations on your success! You deserve it for brightening all of my work days with something to be excited about.

Reply

Arlie Toth
Arlie Toth United States
1/15/2016 8:31:28 AM #

Congratulations, Neil! I love this site and I know I'll love the book. Christmas, birthdays, Father's Day 2010  check!

Reply

Virgilio Schoel
Virgilio Schoel United States
1/15/2016 8:32:28 AM #

AWESOME!Can't wait for that, will be something to want to accomplish day by day, to do something AWESOME!

Reply

Ivonne Kiyuna
Ivonne Kiyuna United States
12/4/2016 7:36:04 AM #

These things happen, so remember to keep your cool and make the best of things. Share your records with your pals, and have a good laugh together. In fact, there are a lot of paid applications out there that are worth their asking prices. I can assure you, Dragon Go, that my wife's number is in fact available, even though you couldn't find it.

Reply

macintosh tools
macintosh tools United States
4/4/2018 10:31:28 AM #

I dugg some of you post as I thought   they were  very beneficial   invaluable

Reply

Add comment

biuquote
  • Comment
  • Preview
Loading

Rel=Me

Month List

RecentComments

Comment RSS