IWDFUnifiedPropertyStoreFactory::RetrieveUnifiedDevicePropertyStore method

The RetrieveUnifiedDevicePropertyStore method retrieves a unified property store interface.

Syntax


HRESULT RetrieveUnifiedDevicePropertyStore(
  [in]   PWDF_PROPERTY_STORE_ROOT RootSpecifier,
  [out]  IWDFUnifiedPropertyStore **PropertyStore
);

Parameters

RootSpecifier [in]

The address of a driver-allocated WDF_PROPERTY_STORE_ROOT structure. The driver fills in this structure to identify the unified property store that RetrieveUnifiedDevicePropertyStore retrieves.

PropertyStore [out]

The address of a location that receives a pointer to an IWDFUnifiedPropertyStore interface.

Return value

RetrieveUnifiedDevicePropertyStore returns S_OK if the operation succeeds. Otherwise, the method might return one of the following values.

Return codeDescription
E_INVALIDARG

The caller provided an invalid input argument.

E_OUTOFMEMORY

An attempt to allocate memory failed.

 

This method might return one of the other values that Winerror.h contains.

Remarks

Your driver can call RetrieveUnifiedDevicePropertyStore to obtain access to a current device's hardware key or a device interface key that the device supports.

The RootClass member of the WDF_PROPERTY_STORE_ROOT structure pointed to by RootSpecifier must be set to WdfPropertyStoreRootClassHardwareKey or WdfPropertyStoreRootClassDeviceInterfaceKey.

In addition, if RootClass is set to WdfPropertyStoreRootClassHardwareKey, then the Qualifier.HardwareKey.ServiceName member of RootSpecifier must be NULL.

For more information about accessing the registry, see Using the Registry in UMDF-based Drivers.

Examples

The following code example retrieves a unified property store interface.


HRESULT
GetDevicePropertyStore(
    _In_  IWDFDevice *                  FxDevice,
    _Out_ IWDFUnifiedPropertyStore **   ppUnifiedPropertyStore
    )
{
    HRESULT hr;
    IWDFUnifiedPropertyStore *          pUnifiedPropertyStore = NULL;
    WDF_PROPERTY_STORE_ROOT             RootSpecifier;
    IWDFUnifiedPropertyStoreFactory *   pUnifiedPropertyStoreFactory = NULL;

    HRESULT hrQI = FxDevice->QueryInterface(
                        IID_PPV_ARGS(&pUnifiedPropertyStoreFactory)
                        );
    WUDF_TEST_DRIVER_ASSERT(SUCCEEDED(hrQI));

    RootSpecifier.LengthCb = sizeof(RootSpecifier);
    RootSpecifier.RootClass = WdfPropertyStoreRootClassHardwareKey;
    RootSpecifier.Qualifier.HardwareKey.ServiceName = NULL;
    
    hr = pUnifiedPropertyStoreFactory->RetrieveUnifiedDevicePropertyStore(
            &RootSpecifier,
            &pUnifiedPropertyStore
            );

    if (FAILED(hr))
    {
        TraceEvents(
            TRACE_LEVEL_ERROR, 
            TEST_TRACE_DEVICE, 
            "Failed to retrieve unified property store for device: ”
            “hr = %!HRESULT!",
            hr
            );
        goto exit;
    }

    *ppUnifiedPropertyStore = pUnifiedPropertyStore;

exit:
    SAFE_RELEASE(pUnifiedPropertyStoreFactory);
    
    return hr;
}


Requirements

End of support

Unavailable in UMDF 2.0 and later.

Minimum UMDF version

1.11

Header

Wudfddi.h (include Wudfddi.h)

DLL

WUDFx.dll

See also

IWDFUnifiedPropertyStoreFactory
IWDFUnifiedPropertyStore

 

 

Send comments about this topic to Microsoft

Показ:
© 2014 Microsoft