DonAithnen (donaithnen) wrote,

  • Mood:


I hate WMI. I hate Microsoft. I hate stupid underdocumented APIs and code examples which conflict with each other.

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

  • Batman vs Superman - Non Spoilery

    We went to see Batman vs Superman over the weekend. It's not good, it's not bad, it's just meh. There are some individually good bits, there are…

  • Batman vs Superman - Spoiler Post

    This is the spoiler post! The non-spoiler post should be right above this! So they not only start with Batman's origin story, they have to make it a…

  • Favorite AMVs From 2016 VCAs

    I've finished watching all 196 AMVs in the VCAs. Or rather, all that are available, there were one or two that weren't…

  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.