Using the INF AddProperty Directive and the INF DelProperty Directive
In Windows Vista and later versions of Windows, you can use INF AddProperty directives and INF DelProperty directives to set and delete properties for device instances, device setup classes, device interface classes, and device interfaces. This includes system-defined device properties and custom device properties. However, you should use the following guidelines when you use AddProperty and DelProperty directives instead of INF AddReg directives and INF DelReg directives to set and delete device properties:
For device properties that were introduced on Windows Vista and later versions of Windows, you should use AddProperty and DelProperty directives to set and delete device properties.
For device properties that were introduced on Windows Server 2003, Windows XP, or Windows 2000, and that can be set by the AddReg directive and deleted by the DelReg directive, you should continue to use AddReg and DelReg directives to set and delete these device properties. You should not use AddProperty and DelProperty directives.
You can include the INF AddProperty directive and the INF DelProperty directive in the following INF file sections to set and delete properties for device instances, device setup classes, device interface classes, and device interfaces:
An install-interface-section that is referenced by an INF InterfaceInstall32 section
An add-interface-section that is referenced by an INF AddInterface Directive
Using the INF AddProperty Directive
To modify a property value, include an INF AddProperty directive in the section that installs a device instance, a device setup class, a device interface class, or a device interface. An AddProperty directive references one or more add-property-sections that include entries that specify the property, how to modify the property, and the value that is used to modify the property. The format of an AddProperty directive is as follows:
AddProperty=add-property-section[,add-property-section] ...
Each line in an add-property-section specifies one property. The following shows the two possible line formats that specify property information. The first line format shown specifies a property by its name. This format can be used only with the DEVPKEY_DrvPkg_Xxx properties. The second line format specifies a property by the property category and property identifier of the corresponding property key. This second format can be used to specify a system-defined property or a custom device property.
[add-property-section] property-name,,,[flags],value {property-category-guid},property-pid,type,[flags],value The entry values supply the following:
property-name
The name that identifies a DEVPKEY_DrvPkg_Xxx property. For example, DeviceModel, which represents the DEVPKEY_DrvPkg_Model property, or DeviceVendorWebSite, which represents the DEVPKEY_DrvPkg_VendorWebSite property.
property-category-guid
The GUID value of the property category to which the property belongs. For example, the system-defined DEVPKEY_Device_FriendlyName property. The GUID value can also specify a custom device category.
property-pid
The property identifier that identifies a property within a property category. For example, the value of the property identifier for the DEVPKEY_Device_FriendlyName property is 14.
Flags
An optional flag that indicates how to modify the property value.
Type
A property-data-type identifier that specifies the data type.
value
The value that is used to modify the property value.
The following example of an AddProperty directive includes two line entries. The first line includes the property-name entry value "DeviceModel" and the value entry value "Sample Device Model Name." This entry sets the DEVPKEY_DrvPkg_Model property. The second line entry sets a custom property in a custom property category. The property-category-guid entry value is "c22189e4-8bf3-4e6d-8467-8dc6d95e2a7e" and the property-identifier entry value is "2." The optional Flags entry value is not present and the type entry value is "18" (DEVPROP_TYPE_STRING). The value entry value is "String value for property 1."
[Root_Install.NT]
AddProperty=Root_AddProperty
[Root_AddProperty]
DeviceModel,,,,"Sample Device Model Name"
{c22189e4-8bf3-4e6d-8467-8dc6d95e2a7e}, 2, 18,, "String value for property 1"
Using the INF DelProperty Directive
To delete a property, include an INF DelProperty directive in the section that installs a device instance, a device setup class, a device interface class, or a device interface.
The main purpose of the INF DelProperty directive is for use in an INF file that updates a device installation. In such a case, the DelProperty directive can be used to delete a property that was set by a previous installation, but is no longer required by the updated installation. Use the DelProperty directive with caution. DelProperty should not be used to delete a property that might be also set by a system component or by another INF file.
The DelProperty directive has the following format:
DelProperty=del-property-section[,del-property-section] ...
Each line in a del-property-section specifies one property. The following shows the two possible line formats that specify property information. The first line format shown specifies a property by its name. This format can be used only with the DEVPKEY_DrvPkg_Xxx properties. The second line format specifies a property by the property category and property identifier of the corresponding property key. The second format can be used to specify a system-defined property or a custom device property.
[del-property-section] property-name [,, Flags [,value]] {property-category-guid}, property-pid [, Flags [,value]] The entry values supply the following:
property-name
The name that identifies a DEVPKEY_DrvPkg_Xxx property. For example, DeviceModel, which represents the DEVPKEY_DrvPkg_Model property, or DeviceVendorWebSite, which represents the DEVPKEY_Device_FriendlyName property.
property-category-guid
The GUID value of the property category to which the property belongs. For example, the system-defined DEVPKEY_Device_FriendlyName property. The GUID value can also specify a custom device category.
property-pid
The property identifier that identifies a property within a property category. For example, the value of the property identifier for the DEVPKEY_Device_FriendlyName property is 14.
Flags
An optional flag that is valid for use only with a property whose data type is DEVPROP_TYPE_STRING_LIST. If the flag is set, the delete operation deletes the string that is specified by value from the property string list.
value
The string to delete from a property string list.
The following example of a del-property-section includes two line entries.
The first line includes the property-name entry value "DeviceModel", which deletes the DEVPKEY_DrvPkg_Model property. The second line entry deletes the string "DeleteThisString" from a custom device property value whose data type is DEVPROP_TYPE_STRING_LIST. In the second line, the property-category-guid entry value is "c22189e4-8bf3-4e6d-8467-8dc6d95e2a7e", the property-identifier entry value is "2", and the Flags entry value is "0x00000001."
[SampleDelPropertySection]
DeviceModel
{c22189e4-8bf3-4e6d-8467-8dc6d95e2a7e}, 2, 0x00000001, "DeleteThisString"