Click to Rate and Give Feedback
MSDN
MSDN Library
Windows Development
System Services
System Information
 GetSystemWindowsDirectory function
GetSystemWindowsDirectory function

Applies to: desktop apps only

Retrieves the path of the shared Windows directory on a multi-user system.

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.

Syntax

UINT WINAPI GetSystemWindowsDirectory(
  __out  LPTSTR lpBuffer,
  __in   UINT uSize
);

Parameters

lpBuffer [out]

A pointer to the buffer to receive the path. This path 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 the system was installed in the root directory of drive C, the path retrieved is C:\.

uSize [in]

The maximum size of the buffer specified by the lpBuffer parameter, in TCHARs.

Return value

If the function succeeds, the return value is the length of the string copied to the buffer, in TCHARs, 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.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

On a system that is running Terminal Services, each user has a unique Windows directory. The system Windows directory is shared by all users, so it is the directory where an application should store initialization and help files that apply to all users.

With Terminal Services, the GetSystemWindowsDirectory function retrieves the path of the system Windows directory, while the GetWindowsDirectory function retrieves the path of a Windows directory that is private for each user. On a single-user system, GetSystemWindowsDirectory is the same as GetWindowsDirectory.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Winbase.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

Unicode and ANSI names

GetSystemWindowsDirectoryW (Unicode) and GetSystemWindowsDirectoryA (ANSI)

See also

GetWindowsDirectory
SHGetFolderLocation
System Information Functions

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker