My boss has decided that i should implement a WMI ("Windows Management Instrumentation") provider for our product. He spent about a day working on it himself before deciding it would take forever and handing it off to me, which was probably a bad sign. I don't mind working on a long term project (though the last one didn't turn out so well) but i can't even get the damn thing _started_ in a working manner.
My boss gave me a book called "Developing WMI Solutions" and said i should look at MSDN as well. Unfortunatly the examples given in the book and MSDN are very different. Furthermore my boss specified that it should be a "decoupled provider," and while MSDN gives examples of both coupled and decoupled providers the book doesn't even mention the difference. MSDn gives sample code on how to hook a decoupled provider into an application but as far as i can tell doesn't say what if any changes should be made to the provider itself. And their example code doesn't work. Particularly the bit:
"// CMyProv is the class added for WMI instance / event provider
HRESULT hr = CMyProv::CreateInstance(NULL,&pIUnknown);"
I don't know what "CMyProv" is supposed to be exactly. I tried hooking it up to the simple provider i had going and got the error:
"error C2664: 'HRESULT _com_ptr_t<_iiid>::CreateInstance(const CLSID &,IUnknown *,DWORD) throw()' : cannot convert parameter 2 from 'IUnknown **__w64 ' to 'const CLSID &'"
Which seems to mean, "we failed to convert the second parameter into the type of the first parameter," which is certainly one of the more nonsensical errors i've ever heard.
And if i manage to get the decoupled/coupled issues worked out my boss also wants me to right it as a dll rather than an exe, which MSDN mentions several times is one of the possible ways to write a provider but doesn't go into detail as to what particular pitfalls that method may entail.
And just as a little icing on the cake, while googling about to try and find some help i found a MSDN blog complaining that they couldn't get WMI working until they went and talked to some people from the WMI team, which is also a bad sign =P