Windows Driver Development-4

Source: Internet
Author: User

In the previous article, "Windows Driver Development-3" We used PNP, which is now bad for WMI.

Wmi:windows Management Interface

WMI provides pre-assembled class schemas that allow scripts or applications written in scripting language (VBS), C #, VB. NET, or C + + to monitor and configure applications, systems, or network components, and hardware in the computer.

WMI Although WDF does a lot of work for you, you also have to trigger events and instantiate callback functions yourself.    It is easy to use Wmilib.sys static registration in WDM, but it is difficult to register dynamically.    But in WDF, these are easy to implement. 1. Irp_mj_system_control

WDF has full control of Irp_mj_system_control.

Irp_mj_system_control: Control information generated inside the system, similar to the kernel call Devicecontrol function

Note: The minimum requirements for using the Devicecontrol system are XP.

BOOL WINAPI DeviceIoControl (  _in_        HANDLE       hdevice,  _in_        DWORD        dwiocontrolcode,  _in_ Opt_    lpvoid       lpinbuffer,  _in_        DWORD        ninbuffersize,  _out_opt_   lpvoid       lpOutBuffer,  _in_        DWORD        noutbuffersize,  _out_opt_   lpdword      lpbytesreturned,  _inout_opt_ lpoverlapped lpoverlapped);

2. Mode

(1) instantiation of used equipment

(2) Triggering an event when needed

(3) Statistical report

(4) Update status

(5) Delete device after logout (normal or accidental deletion)


3. ETW/Tracking

Supports kernel mode ETW/trace

Ii. WDF and WMI

WDF uses Wdfdevicecreatedeviceinterface to provide an interface for WMI.

NTSTATUS Wdfdevicecreatedeviceinterface (  [in]                 wdfdevice        Device,  [in]           const GUID             * Interfaceclassguid,  [in, optional]       pcunicode_string referencestring);

where GUID, see "Using GUIDs in Drivers"

GUID declaration (need to use header file Initguid.h):

Define_guid (GUID_DEVINTERFACE_OSRUSBFX2,//Generated using Guidgen.exe   0x573e8c73, 0XCB4, 0x4471, 0xa1, 0XBF, 0XFA , 0xb2, 0x6c, 0x31, 0xd3, 0x84);//{573e8c73-0cb4-4471-a1bf-fab26c31d384}


Windows Driver Development-4

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.