Closed Adrianotiger closed 2 years ago
I really like the idea of supporting different roots! Also I like all the small changes/improvements you made!
What I dont really like is that this would be a breaking change for every user. Also I am not a big fan that all the wmi classes need to extend WmiBase and have virtual functions...
What do you think about extending the functions retrieveWmi
and retrieveAllWmi
with a root parameter defaulting to root/cimv2
? That way we wont have breaking changes, no base class, no virtual functions and still the possibility to choose the wmi root.
Best Regards Thomas
It is just an example how to add a functionality :) You can reject the pull request and change your code (I changed just some lines). It was more to show another solution.
What do you think about extending the functions
retrieveWmi
andretrieveAllWmi
with a root parameter defaulting toroot/cimv2
? That way we wont have breaking changes, no base class, no virtual functions and still the possibility to choose the wmi root.
It is exactly what I made at beginning :D But each class has only 1 root. And with this change, the developer need to know the root and the class to use. It is easier for the end user, if he need to just add the class (without need where this class is located in the wmi).
My second solution was to just add getWmiPath
(or getWmiRoot
), like getWmiClassName
. It is a nice solution since the compiler does give an error message if this method is not implemented.
I don't know what is better... Just an interface for all classes? Or a base class with predefined root? Or nothing?
My c++ knowledge can't give you a good solution. Sorry.
OK I understand! And I think you are right!
I will try to make an implementation with SFINAE... I will let you know.
OK so I just commited your code but made some changes to use SFINAE to optionally choose the wmi root.
Please check and let me know what you think
Oh wait - there is a bug... let me fix that quickly...
OK - now it's fixed, you can test :-)
It works, thanks! I was able to update the code to calls also WMI methods. Since many wmi classes have also methods to call.
I will not make any push request, as my c++ knowledge are really low compared to your one and I don't want humiliate myself further ;)
The project has a fixed path to the WMI classes:
root/cimv2
There are many paths to use on the WMI class. See or download https://www.nirsoft.net/utils/simple_wmi_view.html to see them on your local computer.
With this update, the class can define also the path to search on.
So I extended the
wmiclasses.hpp
with AntivirusProduct and UWF_Filter (for Windows Embedded) as example. UWF_Filter works only if your computer has this feature enabled.I added also the make file settings for Visual Studio.
As the project is not 100% compatible with the current one (class need to implement a base class to allow the call to
getWmiPath()
), it is up to you if you want merge it or discard it :)PS: Thank you for the project! It is a fantastic project, also because WMIC will be removed from Windows: https://www.bleepingcomputer.com/news/microsoft/microsoft-starts-killing-off-wmic-in-windows-will-thwart-attacks/