0

I am using mingw as a compiler, and i'm trying to get the wmi to work somehow, but the code depends on the

wbemidl.h
Wbemuuid.lib

how can i avoid using this librariy? For example

hr = CoCreateInstance(&CLSID_WbemLocator, 0, CLSCTX_INPROC_SERVER, &IID_IWbemLocator, (LPVOID *) &locator);

How can i get CLSID_WbemLocator and IID_IWbemLocator myself? Also i need to somehow define myself the pointers to the COM interface.

  IWbemLocator         *locator  = NULL;
  IWbemServices        *services = NULL;
  IEnumWbemClassObject *results  = NULL;

Anyone can help me?

2
  • Declare a variable of type GUID called CLSID_WbemLocator and initialize it with the correct value. Jun 12, 2014 at 0:28
  • Thanks Captain Obvlious :). But how do i get the correct value? Look it up in wbemidl.h? And also what should i do about com pointers? IWbemLocator,IWbemServices etc
    – Vanya
    Jun 12, 2014 at 0:35

1 Answer 1

2

I got CLSID_WbemLocator from the registry finding it under WBEMComLocator. Since my app is written in C I initialized the GUID structure so:

CLSID CLSID_WbemLocator = {0x4590F811, 0x1D3A, 0x11D0, {0x89, 0x1F, 0, 0xAA, 0, 0x4B, 0x2E, 0x24}};

With this solved I could run the example given under How to obtain data from WMI using a C Application? I think you have to use the libraries you mentioned. Why not? MinGW provides those libraries.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.