Partager via


DriverPackageGetPath function

Starting in Windows 10 Version 1607 (Redstone 1), the Driver Install Frameworks (DIFx) tools are no longer included in the WDK.

For more information, see DIFx Guidelines.

The DriverPackageGetPath function retrieves the fully qualified path of the INF file for a preinstalled driver package.

Syntax

DWORD DriverPackageGetPath(
  _In_PCTSTR DriverPackageInfPath,
  _Out_opt_PWSTR pDestInfPath,
  _Inout_DWORD *pNumOfChars
);

Parameters

DriverPackageInfPath [in]

A pointer to a NULL-terminated string that supplies the fully qualified path of a driver package's INF file. DIFx uses this string to retrieve the corresponding INF file. The INF file cannot be in the system INF file directory.

pDestInfPath [out, optional]

A pointer to a buffer that receives a NULL-terminated string that contains the fully qualified path of the INF file. This string corresponds to the driver package's INF file that is supplied by DriverPackageInfPath. This pointer is optional and can be NULL.

pNumOfChars [in, out]

A pointer to a DWORD-typed variable that receives the buffer size, in characters, of the buffer that is pointed to by pDestInfPath. If the pDestInfPath buffer is large enough to hold the requested INF file path, DriverPackageGetPath returns ERROR_SUCCESS and sets *pNumOfChars to the size, in characters, of the INF file path. If the buffer is not large enough to retrieve the requested INF file path, the function returns ERROR_INSUFFICIENT_BUFFER. Also, the function sets *pNumOfChars to the buffer size, in characters, that is required to retrieve the requested INF file path in addition to the NULL terminator.

Return value

DriverPackageGetPath returns ERROR_SUCCESS if the requested path was successfully retrieved. Otherwise, the function did not retrieve the requested path and returns an error code that indicates the cause of the failure. The following table contains the most common return values.

Return code Description
CRYPT_E_FILE_ERROR The catalog file for the specified driver package was not found; or possibly, some other error occurred when DriverPackageGetPath tried to verify the driver package signature.
ERROR_ACCESS_DENIED A caller of DriverPackagePath must be a member of the Administrators group to retrieve an INF file path.
ERROR_BAD_ENVIRONMENT The current Microsoft Windows version does not support this operation. An old or incompatible version of DIFxApp.dll or DIFxAppA.dll might be present in the system.
ERROR_CANT_ACCESS_FILE DriverPackagePath cannot access the INF file that was specified by DriverPackageInfPath because the INF file is in the system INF directory.
ERROR_DRIVER_PACKAGE_NOT_IN_STORE There is no INF file in the DIFx driver store that corresponds to the INF file that was specified by DriverPackageInfPath.
ERROR_FILE_NOT_FOUND The INF file that was specified by DriverPackageInfPath was not found.
ERROR_FILENAME_EXCED_RANGE The INF file path, in characters, that was specified by DriverPackageInfPath is greater than the maximum supported path length.
ERROR_IN_WOW64 The 32-bit version DIFxAPI does not work on Win64 systems. A 64-bit version of DIFxAPI is required.
ERROR_INSUFFICIENT_BUFFER The pDestInfPath buffer is not large enough to retrieve the requested INF file path.
ERROR_INVALID_NAME The specified INF file path is not valid.
ERROR_INVALID_PARAMETER A supplied parameter is not valid.
ERROR_OUTOFMEMORY Available system memory was insufficient to perform the operation.
ERROR_UNSUPPORTED_TYPE The driver package type is not supported.

Remarks

A caller of DriverPackageGetPath must be a member of the Administrators group. Otherwise, the function does not retrieve a path to an INF file path, and returns ERROR_ACCESS_DENIED.

DriverPackageGetPath should be primarily used with the DriverPackageUninstall function to uninstall driver packages.

If DriverPackageInfPath specifies an INF file for a signed driver package, the catalog file for the driver package must be in the same directory as the INF file. If the catalog file is not in the same directory as the INF file, the operation will fail and DriverPackageGetPath will return CRYPT_E_FILE_ERROR.

Requirements

Target platform Desktop
Version Available for Microsoft Windows 2000 and later versions of Windows.
Header Difxapi.h (include Difxapi.h)
Library Difxapi.lib

See also

DriverPackageUninstall