UpdateDriverForPlugAndPlayDevicesfunction驱动更新函数 update nvidia driver

http://technet.microsoft.com/zh-cn/library/ff553534

Given an INF file and a hardwareID, the UpdateDriverForPlugAndPlayDevicesfunction installs updated drivers for devices that match thehardware ID.

Syntax

C++
BOOL UpdateDriverForPlugAndPlayDevices(  _In_opt_HWND hwndParent,  _In_LPCTSTR HardwareId,  _In_LPCTSTR FullInfPath,  _In_DWORD InstallFlags,  _Out_opt_PBOOL bRebootRequired);

Parameters

hwndParent [in, optional]

A handle to the top-level w indow to use for any UI related toinstalling devices.

HardwareId [in]

A pointer to a NULL-terminated string that supplies the hardwareidentifier to match existing devices on the computer. The maximumlength of a NULL-terminated hardware identifier isMAX_DEVICE_ID_LEN. For more information about hardware identifiers,see DeviceIdentification Strings.

FullInfPath [in]

A pointer to a NULL-terminated string that supplies the fullpath file name of an INF file. The files should be on thedistribution media or in a vendor-created directory, not in asystem location such as %SystemRoot%inf.UpdateDriverForPlugAndPlayDevices copies driverfiles to the appropriate system locations if the installation issuccessful.

InstallFlags [in]

A caller-supplied value created by using OR to combine zero ormore of the following bit flags:

INSTALLFLAG_FORCE

If this flag is set and the function finds a device that matchesthe HardwareId value, the function installs new driversfor the device whether better drivers already exist on thecomputer.

ImportantUsethis flag only with extreme caution. Setting this flag can cause anolder driver to be installed over a newer driver, if a user runsthe vendor's application after newer drivers are available.

INSTALLFLAG_READONLY

If this flag is set, the function will not copy, rename, ordelete any installation files. Use of this flag should be limitedto environments in which file access is restricted or impossible,such as an "embedded" operating system.

INSTALLFLAG_NONINTERACTIVE

If this flag is set, the function will returnFALSE when any attempt to display UI is detected.Set this flag only if the function will be called from a component(such as a service) that cannot display UI.

Note Ifthis flag is set and a UI display is attempted, the device can beleft in an indeterminate state.

The InstallFlags parameter is typically zero.

bRebootRequired [out, optional]

A pointer to a BOOL-typed variable that indicates whether arestart is required and who should prompt for it. This pointer isoptional and can be NULL.

If the pointer is NULL,UpdateDriverForPlugAndPlayDevices prompts for arestart after installing drivers, if necessary. If the pointer issupplied, the function returns a BOOLEAN value that isTRUE if the system should be restarted. It is thenthe caller's responsibility to prompt for a restart.

For more information, see the following Remarkssection.

Return value

The function returns TRUE if a device wasupgraded to the specified driver.

Otherwise, it returns FALSE and the loggederror can be retrieved with a call toGetLastError. Possible error values returned byGetLastError are included in the followingtable.

Return codeDescription
ERROR_FILE_NOT_FOUND

The path that was specified for FullInfPath does notexist.

ERROR_IN_WOW64

The calling application is a 32-bit application attempting toexecute in a 64-bit environment, which is not allowed.

ERROR_INVALID_FLAGS

The value specified for InstallFlags is invalid.

ERROR_NO_SUCH_DEVINST

The value specified for HardwareId does not match anydevice on the system. That is, the device is not plugged in.

ERROR_NO_MORE_ITEMS

The function found a match for the HardwareId value,but the specified driver was not a better match than the currentdriver and the caller did not specify the INSTALLFLAG_FORCEflag.

Remarks

UpdateDriverForPlugAndPlayDevices scans thedevices on the system and attempts to install the drivers specifiedby FullInfPath for any devices that match the specifiedHardwareId value.

The default behavior is to only install the specified drivers ifthey are better match than the currently installed drivers and thespecified drivers are also a better match than any drivers in%SystemRoot%inf. For more information, seeHowWindows Selects Drivers.

UpdateDriverForPlugAndPlayDevices can also beused to determine whether the device with the specifiedHardwareId value is plugged in. For more information, seeWriting aDevice Installation Application.

UpdateDriverForPlugAndPlayDevices sends anIRP_MN_QUERY_REMOVE_DEVICE request to the specifieddevice, all the children of the device, and all other devices thatare recursively part of the removal relations for the device. Ifany of these devices fail a query remove request,UpdateDriverForPlugAndPlayDevices sets theDI_NEEDREBOOT flag in the Flags member of theSP_DEVINSTALL_PARAMS structure for the device. Forinformation about removal relations, see the IRP_MN_QUERY_DEVICE_RELATIONS request.

Generally, device installationapplications should supply NULL forbRebootRequired. So, the system will initiate a restart ifnecessary. An application should specify a pointer valueonly in the following cases:

UpdateDriverForPlugAndPlayDevicesfunction驱动更新函数 update nvidia driver

If the application must callUpdateDriverForPlugAndPlayDevices several times,it should save any TRUE restart status valuereceived and then prompt for a restart after the final call hasreturned.

If the function returns ERROR_IN_WOW64 in a 32-bit application,the application is executing on a 64-bit system, which is notallowed. For more information, see InstallingDevices on 64-Bit Systems.

Requirements

Version

Available in Microsoft Windows 2000 and later versions ofWindows.

Header

Newdev.h (include Newdev.h)

Library

Newdev.lib

  

爱华网本文地址 » http://www.aihuau.com/a/25101014/231214.html

更多阅读

显卡驱动如何更新 精 如何更新显卡驱动程序

显卡驱动如何更新 精——简介这里介绍几个常用的显卡驱动更新的方法。显卡驱动如何更新 精——工具/原料PC 电脑可能互连网连接显卡驱动如何更新 精——方法一、通过显卡官方网站下载最新驱动显卡驱动如何更新 精 1、这里以下载

怎么更新驱动 用驱动精灵更新驱动

怎么更新驱动——简介驱动是一种程序,百科上的定义是一种可以使计算机和设备通信的特殊程序,可以 说相当于硬件的接口,操作系统只有通过这个接口,才能控制硬件设备的工作,假如某设备的驱动程序未能正确安装,便不能正常工作。 因此,驱动程序

更新驱动程序:20 SD卡

更新驱动程序:[20]SD卡——简介平时,很少有人咨询SD卡的驱动程序更新的问题,遇到SD卡有问题时,外接一个读卡器解决问题,事后还以为电脑上的SD卡槽等设备有问题,于是就不了了之。但是,会有很多人咨询:为什么电脑上的SD卡槽不能使用?其实,这两者

声明:《UpdateDriverForPlugAndPlayDevicesfunction驱动更新函数 update nvidia driver》为网友假惺惺分享!如侵犯到您的合法权益请联系我们删除