Skip to content

Latest commit

 

History

History
91 lines (67 loc) · 5.02 KB

nf-setupapi-setupdisetselecteddrivera.md

File metadata and controls

91 lines (67 loc) · 5.02 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:setupapi.SetupDiSetSelectedDriverA
SetupDiSetSelectedDriverA function (setupapi.h)
The SetupDiSetSelectedDriver function sets, or resets, the selected driver for a device information element or the selected class driver for a device information set. (ANSI)
SetupDiSetSelectedDriverA
di-rtns_823d52e2-7c55-4c52-bccc-809135f28251.xml
devinst\setupdisetselecteddriver.htm
devinst
791df876-9037-405b-b899-eea2b577d923
12/05/2018
SetupDiSetSelectedDriver, SetupDiSetSelectedDriver function [Device and Driver Installation], SetupDiSetSelectedDriverA, SetupDiSetSelectedDriverW, devinst.setupdisetselecteddriver, di-rtns_823d52e2-7c55-4c52-bccc-809135f28251.xml, setupapi/SetupDiSetSelectedDriver
setupapi.h
Setupapi.h
Desktop
Available in Microsoft Windows 2000 and later versions of Windows.
Setupapi.lib
Windows
19H1
SetupDiSetSelectedDriverA
setupapi/SetupDiSetSelectedDriverA
c++
APIRef
kbSyntax
LibDef
Setupapi.lib
Setupapi.dll
SetupDiSetSelectedDriver - SetupDiSetSelectedDriverA

SetupDiSetSelectedDriverA function

-description

The SetupDiSetSelectedDriver function sets, or resets, the selected driver for a device information element or the selected class driver for a device information set.

-parameters

-param DeviceInfoSet [in]

A handle to the device information set that contains the driver list from which to select a driver for a device information element or for the device information set.

-param DeviceInfoData [in, out]

A pointer to an SP_DEVINFO_DATA structure that specifies the device information element in DeviceInfoSet. This parameter is optional and can be NULL. If this parameter is specified, SetupDiSetSelectedDriver sets, or resets, the selected driver for the specified device. If this parameter is NULL, SetupDiSetSelectedDriver sets, or resets, the selected class driver for DeviceInfoSet.

-param DriverInfoData [in, out]

A pointer to an SP_DRVINFO_DATA structure that specifies the driver to be selected. This parameter is optional and can be NULL. If this parameter and DeviceInfoData are supplied, the specified driver must be a member of a driver list that is associated with DeviceInfoData. If this parameter is specified and DeviceInfoData is NULL, the driver must be a member of the global class driver list for DeviceInfoSet. If this parameter is NULL, the selected driver is reset for the device information element, if DeviceInfoData is specified, or the device information set, if DeviceInfoData is NULL.

If the DriverInfoData.Reserved is NULL, the caller is requesting a search for a driver node with the specified parameters (DriverType, Description, and ProviderName). If a match is found, that driver node is selected. The Reserved field is updated on output to reflect the actual driver node where the match was found. If a match is not found, the function fails and a call to GetLastError returns ERROR_INVALID_PARAMETER.

-returns

The function returns TRUE if it is successful. Otherwise, it returns FALSE and the logged error can be retrieved with a call to GetLastError.

-remarks

If the caller of SetupDiSetSelectedDriver is a member of the Administrators group, the class of the device is set to the class of the selected driver, provided that the two classes are different.

If DriverInfoData is NULL, SetupDiSetSelectedDriver resets the selected driver. As a result, there is no selected driver.

Note

The setupapi.h header defines SetupDiSetSelectedDriver as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

-see-also

SetupDiGetSelectedDriver