Problem configuring a custom protocol handler on Vista RC1  
Author Message
davidjmsdn





PostPosted: Windows Desktop Search Development, Problem configuring a custom protocol handler on Vista RC1 Top

I have developed a hierarchical custom search protocol handler, which I have been trying to integrate with Windows Search on Vista. The steps I've taken to register the handler are:

1. Create a REG_SZ value under HKLM/Software/Microsoft/Windows Search/ProtocolHandlers. The MSN WDS Toolbar documentation mentions an AddProtocol method that can be called on the SearchManager, but this does not exist in the ISearchManager interface in Vista (see searchapi.h in the SDK), so given the lack of documentation for alternatives I've registered the key directly.

2. Use ISearchCrawlScopeManager to add a search root and default scope. The search root is created with IsHierchical = TRUE and FollowDirectories = TRUE.

The registration itself completes successfully and I have confirmed new registry keys/values were added under the ProtocolHandler and CrawlScopeManager keys. After registration I rebuilt the index and have confirmed that the search indexer loads my protocol handler and successfully calls the ISearchProtocol::Init method, which returns S_OK. However, the indexer never calls CreateAccessor. At this point I really don't know what is failing, but I suspect it has something to do with how the search root and/or scope rule were defined, or that some other additional configuration step is needed.

Here is a summary of the settings that are added to the registry:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Search\CrawlScopeManager\Windows\SystemIndex\SearchRoots\3]
"URL"="XYZ://12345/"
"Schedule"=""
"IsHierarchical"=dword:00000001
"ProvidesNotifications"=dword:00000000
"EnumerationDepth"=dword:ffffffff
"HostDepth"=dword:00000000
"FollowDirectories"=dword:00000001
"AuthType"=dword:00000000

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Search\CrawlScopeManager\Windows\SystemIndex\DefaultRules\12]
"Default"=dword:00000001
"Include"=dword:00000001
"IncludeSubDirs"=dword:00000001
"Suppress"=dword:00000000
"URL"="XYZ://12345/"
"Hierarchical"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Search\ProtocolHandlers]
"XYZ"="Search.MyHandler.1"

I would appreciate any feedback on mistakes I may have made, pointers to documentation for managing registration of protocol handlers, search roots, and scope rules on Vista, and info on how to get useful logs or other troubleshooting info out of the indexer.

Thanks,

David




Windows Search Technologies1  
 
 
davidjmsdn





PostPosted: Windows Desktop Search Development, Problem configuring a custom protocol handler on Vista RC1 Top

I stumbled on a fix for this by changing the URL from "XYZ://12345/" to "XYZ:///12345/". After adding the extra slash, the indexer called CreateAccessor. I would still appreciate any pointers to info that explains the arcane syntax rules about search URLs so I can understand why this fixes the problem.

Peeling the onion has revealed another issue, but I'll start a new thread on that.



 
 
Ivaylo





PostPosted: Windows Desktop Search Development, Problem configuring a custom protocol handler on Vista RC1 Top

David,

Sinse you already know about SearchApi.h, here is a C# code that would get you started:

CSearchManager manager = new CSearchManagerClass();

CSearchCatalogManager catalogManager = manager.GetCatalog("SystemIndex");

CSearchCrawlScopeManager crawlScopeManager = catalogManager.GetCrawlScopeManager();

CSearchRoot root = new CSearchRootClass();

root.AuthenticationType = _AUTH_TYPE.eAUTH_TYPE_NTLM;

root.FollowDirectories = 1;

root.RootURL = "xyz://host";

crawlScopeManager.AddRoot(root);

crawlScopeManager.AddDefaultScopeRule("xyz://host", 1, 1);

crawlScopeManager.AddHierarchicalScope("xyz://host", 1, 0, 0);

crawlScopeManager.SaveAll();

P.S.

This was compiled against the SearchApi.tlb interop assembly.

Ivaylo


 
 
davidjmsdn





PostPosted: Windows Desktop Search Development, Problem configuring a custom protocol handler on Vista RC1 Top

Hi Ivaylo,

Thanks for the info, but I already have that code in my DLL, although mine is C++. That is how I got the registry entries I listed above into the registry. The only registry value I explictly added was the one under HKLM/Software/Microsoft/Windows Search/ProtocolHandlers to register the protocol handler. I have not found a programmatic way to do that. The addins SDK mentions an AddProtocol() method on ISearchManager, but that is clearly a different ISearchManager than is in Vista. It even has a different GUID. IMHO it's pretty bad for MS to put out different interfaces using the same name - kind of breaks the spirit of COM, if not the letter of the spec.

Unfortunately after all this registration I still do not have a working protocol handler. I have another thread in this forum on that issue.

Regards,

~ David



 
 
Bayatt





PostPosted: Windows Desktop Search Development, Problem configuring a custom protocol handler on Vista RC1 Top

Ivaylo,

Everytime I tried to instanciate this line:

CSearchManager manager = new CSearchManagerClass();

I get this error. Note: It's working fine on XP box, but always error on Vista. Do you or anyone have any idea what's causing this error on Vista

{"Retrieving the COM class factory for component with CLSID {7D096C5F-AC08-4F1F-BEB7-5C22C517CE39} failed due to the following error: 80070422."}

Any help is greatly appreciated.

Thanks,

Bay


 
 
Ivaylo





PostPosted: Windows Desktop Search Development, Problem configuring a custom protocol handler on Vista RC1 Top

Bayatt,

I haven't seen this error before, but the number translates into this message:

"The service cannot be started, either because it is disabled or because it has no enabled devices associated with it."

That probably is "Windows Search" service. You should see if there is a problem with the service starting up or if it is probably disabled.

Ivaylo


 
 
Bayatt





PostPosted: Windows Desktop Search Development, Problem configuring a custom protocol handler on Vista RC1 Top

Hi Ivaylo,

That was it. The window search service on my Vista box was disabled. Enabling it worked. Thanks for you help Smile.

Bay


 
 
AndreBa





PostPosted: Windows Desktop Search Development, Problem configuring a custom protocol handler on Vista RC1 Top

Hello Ivaylo,

I did see that you probably have some experience with protocol handlers and C#. So, is it possible to develop a PH in C# language

If it is, how can I do it Could you give me some template or example to follow

Thanks a lot,



 
 
Ivaylo





PostPosted: Windows Desktop Search Development, Problem configuring a custom protocol handler on Vista RC1 Top

My PH experience is C++ only. You must have seen this thread:

https://forums.microsoft.com/MSDN/ShowPost.aspx PostID=751205&SiteID=1


regarding managed PH in Vista.

 
 
Eric Wolz - MSFT





PostPosted: Windows Desktop Search Development, Problem configuring a custom protocol handler on Vista RC1 Top

Yes, this is still correct, the protocol host process can not host multiple instances of the CLR.