GetSystemDirectoryW function (sysinfoapi.h)
Retrieves the path of the system directory. The system directory contains system files such as dynamic-link libraries and drivers.
This function is provided primarily for compatibility. Applications should store code in the Program Files folder and persistent data in the Application Data folder in the user's profile. For more information, see ShGetFolderPath.
[out] LPWSTR lpBuffer,
[in] UINT uSize
A pointer to the buffer to receive the path. This path does not end with a backslash unless the system directory is the root directory. For example, if the system directory is named Windows\System32 on drive C, the path of the system directory retrieved by this function is C:\Windows\System32.
The maximum size of the buffer, in TCHARs.
If the function succeeds, the return value is the length, in TCHARs, of the string copied to the buffer, not including the terminating null character. If the length is greater than the size of the buffer, the return value is the size of the buffer required to hold the path, including the terminating null character.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Applications should not create files in the system directory. If the user is running a shared version of the operating system, the application does not have write access to the system directory.
For an example, see Getting System Information.
The sysinfoapi.h header defines GetSystemDirectory as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
|Minimum supported client
|Windows 2000 Professional [desktop apps | UWP apps]
|Minimum supported server
|Windows 2000 Server [desktop apps | UWP apps]
|sysinfoapi.h (include Windows.h)