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 specified buffers are used in a subsequent call to the VerInstallFile function.
As with the other file installation functions, VerFindFile works only with Win32 file images. It does not work with 16-bit Windows file images.
DWORD VerFindFile(
DWORD dwFlags, // bit flags that condition function behavior
LPTSTR szFileName, // file to be installed
LPTSTR szWinDir, // Windows directory
LPTSTR szAppDir, // directory where related files are being
// installed
LPTSTR szCurDir, // receives path of directory where file is
// currently installed
PUINT lpuCurDirLen, // size of string in szCurDir
LPTSTR szDestDir, // receives path of recommended destination
// directory
PUINT lpuDestDirLen
// size of string in szDestDir
);
Flag | Description |
---|---|
VFFF_ISSHAREDFILE | The source file can be shared by multiple applications. An application can use this information to determine where the file should be copied. |
All other values are reserved.
When the function returns, lpuCurDirLen contains the size, in characters, of the data returned in szCurDir, including the terminating null character. If the buffer is too small to contain all the data, lpuCurDirLen will be the size of the buffer required to hold the path.
When the function returns, lpuDestDirLen contains the size, in characters, of the data returned in szDestDir, including the terminating null character. If the buffer is too small to contain all the data, lpuDestDirLen will be the size of the buffer needed to hold the path.
The return value is a bitmask that indicates the status of the file. It can be one or more of the following values:
Value | Meaning |
---|---|
VFF_CURNEDEST | The currently installed version of the file is not in the recommended destination. |
VFF_FILEINUSE | The system is using the currently installed version of the file; therefore, the file cannot be overwritten or deleted. |
VFF_BUFFTOOSMALL | At least one of the buffers was too small to contain the corresponding string. An application should check the output buffers to determine which buffer was too small. |
All other values are reserved.
VerFindFile searches for a copy of the specified file by using the OpenFile function. 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 the system, the function recommends installing the file in the Windows directory. If the system is running a private copy of the system, the function recommends installing the file in the system directory.
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in winver.h.
Import Library: Use version.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT.
File Installation Library Overview, File Installation Library Functions, GetWindowsDirectory, OpenFile, VerInstallFile