WdfDeviceAssignInterfaceProperty, fonction (wdfdevice.h)

Important

S’applique uniquement à UMDF

La méthode WdfDeviceAssignInterfaceProperty modifie la valeur actuelle d’une propriété d’interface d’appareil.

Notes

Pour récupérer ou modifier une propriété d’interface d’appareil, un pilote KMDF doit appeler Directement IoGetDeviceInterfacePropertyData ou IoSetDeviceInterfacePropertyData .

Syntaxe

NTSTATUS WdfDeviceAssignInterfaceProperty(
  [in]           WDFDEVICE                           Device,
  [in]           PWDF_DEVICE_INTERFACE_PROPERTY_DATA PropertyData,
  [in]           DEVPROPTYPE                         Type,
  [in]           ULONG                               BufferLength,
  [in, optional] PVOID                               PropertyBuffer
);

Paramètres

[in] Device

Handle d’un objet d’appareil framework.

[in] PropertyData

Pointeur vers WDF_DEVICE_INTERFACE_PROPERTY_DATA structure.

[in] Type

Valeur de type DEVPROPTYPE qui spécifie le type des données fournies dans PropertyBuffer.

[in] BufferLength

Spécifie la longueur, en octets, de la mémoire tampon vers laquelle PropertyBuffer pointe.

[in, optional] PropertyBuffer

Pointeur vers les données de propriété de l’interface de l’appareil. Définissez ce paramètre sur NULL pour supprimer la propriété spécifiée.

Valeur retournée

Si la méthode WdfDeviceAssignInterfaceProperty ne rencontre aucune erreur, elle retourne STATUS_SUCCESS. Les valeurs de retour supplémentaires sont les suivantes :

Code de retour Description
STATUS_INVALID_PARAMETER L’un des paramètres est incorrect.

La méthode peut retourner d’autres valeurs NTSTATUS.

Remarques

Pour plus d’informations sur les méthodes associées, consultez Accès au modèle de propriété d’appareil unifié.

Exemples

L’exemple de code suivant initialise une structure WDF_DEVICE_INTERFACE_PROPERTY_DATA , puis appelle WdfDeviceAssignInterfaceProperty.

DEFINE_DEVPROPKEY(DEVPKEY_ToasterCrispLevelDword, 0x5d0ba64a, 0x2396, 0x4bc9, 0xbf, 0x49, 0x52, 0x1d, 0xa6, 0x2b, 0x1b, 0xed, 3);  // DEVPROP_TYPE_UINT32

ULONG crispLevel = 0;
WDF_DEVICE_INTERFACE_PROPERTY_DATA propertyData;

WDF_DEVICE_INTERFACE_PROPERTY_DATA_INIT(
                          &propertyData, 
                          &GUID_DEVINTERFACE_TOASTER_DRIVER
                          &DEVPKEY_ToasterCrispLevelDword
                          );

status = WdfDeviceAssignInterfaceProperty(device, 
                                          &propertData,
                                          DEVPROP_TYPE_UINT32,
                                          sizeof(crispLevel),
                                          &crispLevel);
if (!NT_SUCCESS(status)) {
    return status;
}

Configuration requise

Condition requise Valeur
Client minimal pris en charge Windows 8.1
Plateforme cible Universal
Version UMDF minimale 2.0
En-tête wdfdevice.h (include Wdf.h)
Bibliothèque WUDFx02000.lib
DLL WUDFx02000.dll
IRQL PASSIVE_LEVEL

Voir aussi

WDF_DEVICE_INTERFACE_PROPERTY_DATA

WDF_DEVICE_INTERFACE_PROPERTY_DATA_INIT

WdfDeviceAllocAndQueryInterfaceProperty

WdfDeviceQueryInterfaceProperty