DWORD VerFindFile(dwFlags, szFileName, szWinDir, szAppDir, szCurDir, lpdwCurDirLen, szDestDir, lpdwDestDirLen) | |||
DWORD dwFlags; | |||
LPSTR szFileName; | |||
LPSTR szWinDir; | |||
LPSTR szAppDir; | |||
LPSTR szCurDir; | |||
LPDWORD lpdwCurDirLen; | |||
LPSTR szDestDir; | |||
LPDWORD lpdwDestDirLen; |
The VerFindFile function determines where to install a file based on whether it locates another version of the file in the system. The values VerFindFile returns in the szCurDir and szDestDir parameters are used in a subsequent call to VerInstallFile.
dwFlags
Contains a bitmask of flags. dwFlags may be the following:
Value | Meaning |
VFFF_ISSHAREDFILE | ||
Indicates that the source file may be shared by multiple applications. An application can use this information to determine where the file should be copied. |
All other values are reserved for future use by Microsoft.
szFileName
Points to the name of the file to be installed. This should include only the filename and extension, not a path.
szWinDir
Points to the directory from which Windows is running or will be run. This string is returned by the GetWindowsDirectory function.
szAppDir
Points to the directory where the installation program is installing a set of related files. If the installation program is installing an application, this is the directory where the application will reside. szAppDir will also be the application's working directory unless specified otherwise.
szCurDir
Points to a buffer that receives the path to a current version of the file being installed. The path is a zero-terminated string. If a current version is not installed, the buffer will contain a zero-length string. The buffer must be at least _MAX_PATH bytes long.
lpdwCurDirLen
Points to the length of the szCurDir buffer. On return, lpdwCurDirLen contains the size, in bytes, of the data returned in szCurDir, including the terminating zero byte. If the buffer is too small to contain all the data, lpdwCurDirLen will be greater than the actual size of the buffer.
szDestDir
Points to a buffer that receives the path to the installation location recommended by VerFindFile. The path is a zero-terminated string. The buffer must be at least _MAX_PATH bytes long.
lpdwDestDirLen
Points to the length of the szDestDir buffer. On return, lpdwDestDirLen contains the size, in bytes, of the data returned in szDestDir, including the terminating zero byte. If the buffer is too small to contain all the data, lpdwDestDirLen will be greater than the actual size of the buffer.
The return value is a bitmask that indicates the status of the file. It may be one or more of the following:
Value | Meaning |
VFF_CURNEDEST | Indicates that the currently installed version of the file is not in the recommended destination. |
VFF_FILEINUSE | Indicates that Windows is using the currently installed version of the file; therefore, the file cannot be overwritten or deleted. |
VFF_BUFFTOOSMALL | Indicates that at least one of the buffers was too small to contain the corresponding string. An application should check lpszCurDir and lpszDestDir to determine which buffer was too small. |
All other values are reserved for future use by Microsoft.
VerFindFile searches for a copy of the specified file by using OpenFile. However, it determines the system directory from the specified Windows directory, or searches the path.
If the dwFlags parameter indicates that the file is private to this application (not VFFF_ISSHAREDFILE), VerFindFile recommends installing the file in the application's directory. Otherwise, if the system is running a shared copy of Windows, the function recommends installing the file in the Windows directory. If the system is running a private copy of Windows, the function recommends installing the file in the system directory.
VerInstallFile