CPackage::SetFileDirectory

The CPackage::SetFileDirectory function sets the installation directory for the specified file.

BOOL SetFileDirectory(
DWORD dwFilePlatform, // file platform
DWORD dwFileChecksum, // file checksum
LPCTSTR lpszFileName, // file name in package
LPTSTR lpszInstallPath // file installation path
);

Parameters

dwFilePlatform
[in] Specifies the target platform for the file.
 
This may be one of the following values:
Value Description
PACKAGE_FILE_PLATFORM_DEFAULT The file may be applied on all Windows platforms. This is the same as specifying a value of PACKAGE_FILE_PLATFORM_WINDOWS.
PACKAGE_FILE_PLATFORM_WIN95 The file may be applied to a system running Windows 95.
PACKAGE_FILE_PLATFORM_WIN98 The file may be applied to a system running Windows 98 or Windows 98 SE.
PACKAGE_FILE_PLATFORM_WINME The file may be applied to a system running Windows ME.
PACKAGE_FILE_PLATFORM_WINNT40 The file may be applied to a system running Windows NT 4.0.
PACKAGE_FILE_PLATFORM_WIN2000 The file may be applied to a system running Windows 2000.
PACKAGE_FILE_PLATFORM_WINXP The file may be applied to a system running Windows XP.
PACKAGE_FILE_PLATFORM_WIN2003 The files may be applied to a system running Windows Server 2003.
In addition to the above platform-specific values, there are predefined values which specify platform groups:
 
Value Description
PACKAGE_FILE_PLATFORM_WIN32 The file may be applied to any 32-bit version of the Windows operating system.
PACKAGE_FILE_PLATFORM_WIN9X The file may be applied to any system running Windows 95, Windows 98 or Windows ME. The file will not be applied on a system running Windows NT, Windows 2000 or Windows XP.
PACKAGE_FILE_PLATFORM_WINNT The file may be applied to any system running Windows NT, Windows 2000 or Windows XP. The file will not be applied on a system running Windows 95, Windows 98 or Windows ME.
PACKAGE_FILE_PLATFORM_WINDOWS The files may be applied to any system running any version of Microsoft Windows.
dwFileChecksum
[in] Specifies the 32-bit checksum for the file. If the package contains multiple file versions, this value is used to uniquely identify the file. This parameter is ignored if the PACKAGE_OPTION_MULTIPLE_VERSIONS package option has not been enabled or if the parameter value is zero.
 
lpszFileName
[in] A pointer to a null-terminated string which specifies the name of the file.
 
lpszInstallPath
[in] A pointer to a null-terminated string which specifies the installation directory for the specified file. This may specify an absolute path or a folder macro which is expanded when the patch package is applied. This parameter may also be NULL, which specifies that the file should be updated in the default installation directory for the package.

Return Values

If the CPackage::SetFileDirectory function succeeds, it will return a non-zero value.

If the function fails, it will return a value of zero. To get extended error information, call GetLastError.

Remarks

The installation directory may include special strings which are expanded when the package is applied. Any value enclosed in percent (%) symbols is considered to be an environment variable and is replaced with the value of that variable. For example, if the installation directory is the string "%TEMP%", this would be replaced with the value of the TEMP environment variable, such as "C:\TEMP".

Any value enclosed in brackets (either [] or <>) is considered to be a folder macro, a value which represents a special folder on the local system. The following values are defined:

COMMONFILES
The default directory in which shared program files are installed (i.e.: "C:\Program Files\Common Files").

FOLDER_DESKTOP
The directory where files are stored that are located on the shell desktop.

FOLDER_STARTMENU
The directory where files are stored that are located in the current user's Start folder.

FOLDER_STARTUP
The directory where files are stored which are executed when the current user logs in to the system.

INSTALLDIR
The default installation directory for this package as specified when the package is applied.

INSTALLDISK
The disk on which the default installation directory is located. Note that this specifies only the drive letter (i.e.: "C:") and does not include the directory.

PERSONALFILES
The default directory in which documents for the current user are created.

PROGRAMFILES
The default directory in which programs are installed (i.e.: "C:\Program Files").

TEMPDIR
The directory in which temporary files are created. This directory is typically defined by the TEMP or TMP environment variables.

TEMPDISK
The disk on which temporary files are created. Note that this specifies only the drive letter (i.e.: "C:") and does not include the directory.

WINDIR
The directory in which the Windows operating system was installed (i.e.: "C:\WINDOWS").

WINDISK
The disk on which the Windows operating system was installed. Note that this specifies only the drive letter (i.e.: "C:") and does not include the directory.

WINSYSDIR
The directory in which the Windows libraries, drivers and other system files were installed (i.e.: "C:\WINDOWS\SYSTEM" or "C:\WINNT\SYSTEM32").

WINSYSDIR16
The directory in which 16-bit Windows system files are
installed (i.e.: "C:\WINDOWS\SYSTEM" or "C:\WINNT\SYSTEM").

WINSYSDISK
The disk on which the Windows operating system system files were installed. Note that this specifies only the drive letter (i.e.: "C:") and does not include the directory.

In addition to these predefined macros, the installation directory may also use macros which reference a registry entry or a value in an initialization file. As with folder macros, they are enclosed in brackets and have the following formats:

[root:key] or [root:key,value]

This is used for registry values, where root may be one of the following root key names: HKCR, HKCU, HKLM or HKCC. The key specifies the key under the specified root, and the optional value specifies a value for that key. If no value is provided then the default key value is used. An example would be [HKLM:Software\Microsoft\Windows\CurrentVersion,MediaPath]

[filename:section,key]

This is used for initialization files, where filename is the name of the file (if no path is provided, it will search for the file using the standard Windows pathing rules; if no extension is specified, a default extension of ".ini" is used). The section and key values refer to the section and key name in the file. An example would be [win.ini:msapps,msinfo]

Requirements

Windows NT/2000/XP: Requires Windows NT 4.0 SP3 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Include apatch.h.
Library: Use apatch32.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000/XP.

See Also

CPackage::GetFileDirectory