Muokkaa

Jaa


Creating Custom Device Properties

In Windows Vista and later versions of Windows, the unified device property model supports creation of custom device property categories for device instances, device setup classes, device interface classes, and device interfaces. A custom property can be accessed by calling the appropriate property function. A custom device property can also be modified from a driver package by using an INF AddProperty directive or an INF DelProperty directive.

For more information about custom device properties, see the following sections:

Creating Custom Device Property Categories

Using Property Functions to Access Custom Device Properties

Using the INF AddProperty Directive or the INF DelProperty Directive to Modify a Custom Device Property

Creating Custom Device Property Categories

A custom device property category is a logically-related collection of custom device properties. To programmatically create a custom device property category, use the DEFINE_DEVPROPKEY macro to create the property keys that represent the properties in the property category, as follows:

  • Create a unique GUID value that represents the property category and set the GUID value of each property key to this unique GUID value. For information about how to create a new GUID value, see Defining and Exporting New GUIDs.

    Note

    The system-defined property categories are reserved for operating system use only.

  • Set the property identifier of each property key to an integer value that is unique within the property category and that is greater than or equal to two.

You can also create a custom device property category for a device instance by using an INF AddProperty directive.

Using Property Functions to Access Custom Device Properties

Access custom device properties in the same manner as described in Accessing Properties).

Using the INF AddProperty Directive or the INF DelProperty Directive to Modify a Custom Device Property

To modify a custom device property by using an INF AddProperty directive, include an AddProperty directive in the section that installs the component and supply the following entries for the property:

  • The property-category-guid entry that represents the custom device property category

  • A property identifier entry that identifies the property within the custom device property category

  • The value entry of a new device property or the value entry that modifies an existing device property value

Use the INF DelProperty directive to delete a custom device property.

For more information about how to use these directives, see the Using the INF AddProperty Directive and the INF DelProperty Directive.