UINT GetWindowsDirectory(lpszWinPath, cchWinPath) | |||||
LPTSTR lpszWinPath; | /* address of buffer for Windows directory | */ | |||
UINT cchWinPath; | /* size of directory buffer in characters | */ |
The GetWindowsDirectory function retrieves the path of the Windows directory. The Windows directory contains such files as Windows applications, initialization files, and help files.
lpszWinPath
Points to the buffer that will receive the null-terminated string containing the path.
cchWinPath
Specifies the maximum size, in characters, of the buffer. 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 lpszWinPath parameter. The return value does not include the terminating null character. If the return value is greater than the value specified in cchWinPath, the return value is the size of the buffer required to hold the path.
The return value is zero if the function fails. Use the GetLastError function to obtain extended error information.
The Windows directory is the only directory where an application should create files. If the user is running a shared version of Windows, the Windows directory is the only directory guaranteed private to the user.
The path this function retrieves does not end with a backslash unless the Windows directory is the root directory. For example, if the Windows directory is named WINDOWS on drive C:, the path of the Windows directory retrieved by this function is C:\WINDOWS. If Windows was installed in the root directory of drive C:, the path retrieved is C:\.
The GetWindowsDirectory 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).
GetSystemDirectory, GetCurrentDirectory