"WMI-1" WMI for c++/com Basics __c++

Source: Internet
Author: User
Tags win32
Knowledge background
Wbem--web Based Enterprise Management is an industry specification that establishes standards for accessing and sharing management information in a corporate network.
Wmi--windows Management Instrumentation is a WBEM implementation of Windows. With WMI, we can get data about hardware/software, or provide data on hardware or software services to WMI.
Cim--common Information Model (Public information models). In the WMI architecture, the CIM Object widget is the central part of the structure, controlling the flow of information. CIM divides the management area into physical and logical areas, which correspond to the physical and logical elements of the management environment respectively. The logical domain can be further divided into system domain, device domain, application domain and network domain.


WMI Overall Architecture
WMI's architecture diagram can be found on MSDN, although the architecture diagram provided by MSDN is very detailed, but it is also very complex, and beginners may be dizzy and can be simplified as follows:

A management application is a program written in any language, such as a scripting language, C + +, C #, and so on.
The WMI core is a CIM based object manager that handles static or dynamic resources for managing data and managing applications.
The WMI library is the CIM central repository used to manage data statically. Classes, instances, and properties are saved in this library, which is the object-defined database.
A provider is a COM object that interacts directly with a managed part (such as a Win32 system, registry, directory service, and so on). Their information is dynamically generated. This information includes a response from the management application request or a change notification in the managed environment. is the intermediary of WMI and the operating system and its components.
The managed object is the logical and physical object in the managed environment. such as hard disk, optical drive, process, etc.

Get Data Flow
Provider-generated data can be delivered dynamically when the CIM repository (static) or the request from the CIM Object manager is made appropriate. The mechanism adopted in practice is based on the frequency of data changes. The update of the CIM repository affects the performance of this system. Therefore, if the state of the managed parts that the provider monitors is constantly changing, data management tends to be dynamic (such as monitor switching for notebooks), and if the data is relatively static (such as the BIOS version), the repository will terminate. This determines the information flow between the management application, the CIM Object Manager, the CIM repository, and the provider.
Data acquisition generally includes the following steps:
1 Management application sends requests to the CIM Object manager.
2 The CIM Object Manager determines whether the request data is static or dynamic.
3 If the data is static, the CIM Object manager obtains data directly from the repository, and if the object is dynamic, CIM directs the request to the appropriate provider based on the registry information of the provider.
4 The provider extracts the data and sends it back to the CIM Object Manager, and the CIM Object Manager sends the data to the application requesting the data.

WMI namespaces
CIM is based on object-oriented principles, and its classes are abstract because they want to represent generic models of managed objects in any environment. The CIM rules provide such a model--CIM Schema. Schema is an organizational structure with a variety of characteristics, in the context of CIM, this structure is the hierarchy of classes and their methods, attributes and so on.
WMI, as WBEM's Windows implementation, also reflects the CIM schema, many of his classes are derived from CIM, and WMI schemas contain their own special classes, and these classes can be extended by users.
For ease of operation, WMI introduces the concept of namespaces to group classes that exist in the same environment. In addition, namespaces are also used for related security restrictions (regarding security restrictions to be investigated). Like classes, namespaces also form a hierarchy, similar to the hierarchy in the file system.
root--as the top-level space for all other namespaces, he only contains WMI's system classes, which are related to WMI.
root/default--the host class associated with Windows registry manipulation.
root/security--for Windows security-related classes.
root/cimv2--contains classes derived from the CIM schema, and they represent the WIN32 environment in which we work most often.
root/wmi--contains a class of Windows hardware-driven information that contains some of the classes we might use for information about power supplies, monitors, and so on.

WMI Standard Provider
Microsoft includes a number of providers in the WMI core components and Microsoft WMI software development tools.
Our most common use is the WIN32 provider (core WMI), which is used to process WIN32 system features. The CIM repository stores this information in a class prefixed with "Win32_", which is contained in the Root/cimv2 namespace. For example, Win32_BIOS, Win32_Service, Win32_Processor, and so on.
        Another possible use is the registry provider, which allows him to obtain or modify registry data. When a change occurs in the registry, he can set up event notifications. The registry provider interacts with the StdRegProv class of the Root/default namespace, which contains many methods to find and modify the registry.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.