Tao.Platform.Windows SDK Documentation

Kernel.GetSystemWindowsDirectory Method 

The GetSystemWindowsDirectory function retrieves the path of the shared Windows directory on a multi-user system.

[Visual Basic]
Public Shared Function GetSystemWindowsDirectory( _
   ByVal buffer As StringBuilder, _
   ByVal size As Integer _
) As Integer
[C#]
public static int GetSystemWindowsDirectory(
   StringBuilder buffer,
   int size
);

Parameters

buffer
Pointer to the buffer to receive a null-terminated string containing 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:\.
size
Maximum size of the buffer specified by the buffer parameter, in TCHARs. This value should be set to at least MAX_PATH+1 to allow sufficient space for the path and the null-terminating character.

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 GetLastWin32Error.

Remarks

On a system that is running Terminal Server, 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.

Windows NT 4.0 Terminal Server Edition: To retrieve the shared Windows directory, call GetSystemDirectory and trim the "System32" element from the end of the returned path.

See Also

Kernel Class | Tao.Platform.Windows Namespace | GetWindowsDirectory