DriverPackageGetPath function

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

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 within the DIFx driver store. The INF file cannot be in the system INF file directory. For more information about how to specify an INF file path for a driver package, see Specifying a Driver Package INF File Path.

pDestInfPath [out, optional]

A pointer to a buffer that receives a NULL-terminated string that contains the fully qualified path of the INF file within the DIFx driver store. 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 within the DIFx driver store, 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 codeDescription
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. For more information about these .dll files, see How DIFxApp Works.

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. For more information about path length, see Specifying a Driver Package INF File Path.

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 within the DIFx driver store, and returns ERROR_ACCESS_DENIED.

DriverPackageGetPath should be primarily used with the DriverPackageUninstall function to uninstall driver packages. For more information about how to use this function with DriverPackageUninstall, see Retrieving and Using a Driver Store INF File Path.

The following considerations apply to the location of the INF file that is specified by DriverPackageInfPath and whether the driver package is signed:

  • 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.

  • If DriverPackageInfPath specifies an INF file for an unsigned driver package and a corresponding DIFx driver store INF file exists, DriverPackageGetPath retrieves the path of the corresponding INF file in the DIFx driver store and returns ERROR_SUCCESS. If a corresponding DIFx driver store INF file does not exist, the function returns ERROR_DRIVER_PACKAGE_NOT_IN_STORE.

A retrieved DIFx driver store INF file path is valid if the corresponding driver package remains preinstalled in the DIFx driver store. For information about preinstalling a driver package, see Preinstalling a PnP Function Driver Package.

Requirements

Version

Available for Microsoft Windows 2000 and later versions of Windows.

Header

Difxapi.h (include Difxapi.h)

Library

Difxapi.lib

See also

DriverPackageUninstall

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft