#include <ver.h> |
UINT VerFindFile(flags, lpszFilename, lpszWinDir, lpszAppDir, lpszCurDir, lpuCurDirLen, lpszDestDir, lpuDestDirLen) | |||||
UINT flags; | /* source-file flags, */ | ||||
LPCSTR lpszFilename; | /* address of buffer for file | */ | |||
LPCSTR lpszWinDir; | /* address of Windows directory | */ | |||
LPCSTR lpszAppDir; | /* address of application directory | */ | |||
LPSTR lpszCurDir; | /* address of buffer for current directory | */ | |||
UINT FAR* lpuCurDirLen; | /* address of buffer size for directory | */ | |||
LPSTR lpszDestDir; | /* address of buffer for dest. directory | */ | |||
UINT FAR* lpuDestDirLen; | /* address of size for dest. directory | */ |
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 are used in a subsequent call to the VerInstallFile function.
flags
Contains a bitmask of flags. This parameter can be VFFF_ISSHAREDFILE, which indicates that the source file may be shared by multiple applications. VerFindFile uses this information to determine where the file should be copied. All other values are reserved for future use.
lpszFilename
Points to a null-terminated string specifying the name of the file to be installed. This name should include only the filename and extension, not a path.
lpszWinDir
Points to a null-terminated string specifying the Windows directory. This string is returned by the GetWindowsDir function. The dynamic-link library (DLL) version of VerFindFile ignores this parameter.
lpszAppDir
Points to a null-terminated string specifying the drive letter and 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. This directory will also be the application's working directory unless you specify otherwise.
lpszCurDir
Points to a buffer that receives the path to a current version of the file being installed. The path is a null-terminated string. If a current version is not installed, the buffer will contain the source directory of the file being installed. The buffer must be at least _MAX_PATH bytes long.
lpuCurDirLen
Points to a null-terminated string specifying the length, in bytes, of the buffer pointed to by lpszCurDir. On return, lpuCurDirLen contains the size, in bytes, of the data returned in lpszCurDir, including the terminating null character. If the buffer is too small to contain all the data, lpuCurDirLen will be greater than the actual size of the buffer.
lpszDestDir
Points to a buffer that receives the path to the installation directory recommended by VerFindFile. The path is a null-terminated string. The buffer must be at least _MAX_PATH bytes long.
lpuDestDirLen
Points to the length, in bytes, of the buffer pointed to by lpszDestDir. On return, lpuDestDirLen contains the size, in bytes, of the data returned in lpszDestDir, including the terminating null character. If the buffer is too small to contain all the data, lpuDestDirLen will be greater than the actual size of the buffer.
The return value is a bitmask that indicates the status of the file, if the function is successful. This value may be one or more of the following:
Error | 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 the lpuCurDirLen and lpuDestDirLen parameters to determine which buffer was too small. |
All other values are reserved for future use.
The dynamic-link library (DLL) version of VerFindFile searches for a copy of the specified file by using the OpenFile function. In the LIB version, the function searches for the file in the Windows directory, the system directory, and then the directories specified by the PATH environment variable.
VerFindFile determines the system directory from the specified Windows directory, or it searches the path.
If the flags 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.