GetSystemDir

3.1

  #include <ver.h>    

  UINT GetSystemDir(lpszWinDir, lpszBuf, cbBuf)    
  LPCSTR lpszWinDir; /* address of Windows directory */
  LPSTR lpszBuf; /* address of buffer for path */
  int cbBuf; /* size of buffer, */  

The GetSystemDir function retrieves the path of the Windows system directory. This directory contains such files as Windows libraries, drivers, and fonts.

GetSystemDir is used by MS-DOS applications that set up Windows applications; it exists only in the static-link version of the File Installation library. Windows applications should use the GetSystemDirectory function to determine the Windows directory.

Parameters

lpszWinDir

Points to the Windows directory retrieved by a previous call to the GetWindowsDir function.

lpszBuf

Points to the buffer that is to receive the null-terminated string containing the path.

cbBuf

Specifies the size, in bytes, of the buffer pointed to by the lpszBuf parameter.

Return Value

The return value is the length of the string copied to the buffer, in bytes, including the terminating null character, if the function is sucessful. If the return value is greater than the cbBuf parameter, the return value is the size of the buffer required to hold the path. The return value is zero if the function fails.

Comments

An application must call the GetWindowsDir function before calling the GetSystemDir function to obtain the correct lpszWinDir value.

The path that this function retrieves does not end with a backslash unless the Windows 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.

See Also

GetSystemDirectory, GetWindowsDir