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?

Vanya
  • 395
  • 1
  • 2
  • 20
  • Declare a variable of type `GUID` called `CLSID_WbemLocator` and initialize it with the correct value. – Captain Obvlious Jun 12 '14 at 00: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 '14 at 00:35

1 Answers1

1

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.

Community
  • 1
  • 1