UINT GetSystemDirectory(lpszSysPath, cchSysPath) | |||||
LPTSTR lpszSysPath; | /* address of buffer for system directory | */ | |||
UINT cchSysPath; | /* size of directory buffer | */ |
The GetSystemDirectory function retrieves the path of the Windows system directory. The system directory contains such files as Windows libraries, drivers, and font files.
lpszSysPath
Points to the buffer for the null-terminated string containing the path of the system directory.
cchSysPath
Specifies the maximum size of the buffer (in characters). This value should be set to at least MAX_PATH to allow sufficient room in the buffer for the path.
If the function is successful, the return value is the length (in characters) of the string copied to the lpszSysPath parameter, not including the terminating null character.
If the buffer is not large enough, the return value is the size of the buffer required to hold the path.
If the function fails, the return value is zero.
Applications should not create files in the system directory. If the user is running a shared version of Windows, the application will not have write access to the system directory. Applications should create files only in the directory returned by the GetWindowsDirectory function.
The path this function retrieves does not end with a backslash unless the system directory is the root directory. For example, if the system directory is named WINDOWS\SYSTEM on drive C:, the path of the system directory retrieved by this function is C:\WINDOWS\SYSTEM.
The GetSystemDirectory function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set installed).
GetWindowsDirectory, GetCurrentDirectory, SetCurrentDirectory