Search code examples
c++wmi

c++ change hardware-IDs via WMI


Currently I'm working on a program which I would like to fit to a few computers. I query some hardware IDs (disk, mainboard and CPU) with WMI according to this site: https://msdn.microsoft.com/en-us/library/aa390423(v=vs.85).aspx

As SQL is used there, is it possible not only to recieve data via SELECT but to change data via a UPDATE query? If so, this attempt to create a "copy-protected program" would fail, right?


Solution

  • The WMI uses the WQL language which is only a small subset of the ANSI SQL. The WQL language doesn't supports the UPDATE or INSERT statements. Also if you want update some property value this depends if the WMI property/class is writable, finally depending of what you want accomplish you must use the IWbemClassObject.Put or the IWbemServices.PutInstance method.