GetSystemDirectory

Version 3.0

Syntax

WORD GetSystemDirectory(lpBuffer,nSize)

This function obtains the pathname of the Windows system subdirectory. The system subdirectory contains such files as Windows libraries, drivers, and font files.

Parameter Type/Description  

lpBuffer LPSTR Points to the buffer that is to receive the null-terminated character string containing the pathname.  
nSize int Specifies the maximum size (in bytes) of the buffer. This value should be set to at least 144 to allow sufficient room in the buffer for the pathname.  

Return Value

The return value is the length of the string copied to lpBuffer, not including the terminating null character. If the return value is greater than nSize, the return value is the size of the buffer required to hold the pathname. The return value is zero if the function failed.

Comments

The pathname retrieved by this function 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 pathname of the system subdirectory retrieved by this function is C:\WINDOWS\SYSTEM.