GetSystemWindowsDirectory (kernel32)
Last changed: -31.47.84.113

.
Summary

C# Signature:

[DllImport("kernel32.dll")]
static extern uint GetSystemWindowsDirectory([Out] StringBuilder lpBuffer,
   uint uSize);

VB.NET Signature:

''' <summary>
''' Retrieves the path of the shared Windows directory on a multi-user system.
''' </summary>
''' <param name="lpBuffer">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.</param>
''' <param name="uSize">The maximum size of the buffer specified by the lpBuffer parameter, in TCHARs.</param>
''' <returns>
''' 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.
''' </returns>
''' <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.
''' </remarks>
<DllImport("Kernel32.dll", EntryPoint:="GetSystemWindowsDirectoryW", SetLastError:=True, CharSet:=CharSet.Unicode)> _
Public Function GetSystemWindowsDirectory(<MarshalAs(UnmanagedType.LPTStr)>lpBuffer As System.Text.StringBuilder, _
              uSize As UInteger) As UInteger
End Function

VB Signature:

Public Declare Function GetSystemWindowsDirectory Lib "kernel" Alias "GetSystemWindowsDirectoryA" _
        (ByVal pszBuffer As String, _
         ByVal uSize As Integer) As Integer

User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

Please add some!

Alternative Managed API:

Do you know one? Please contribute it!

www.freewebs.com\omnicoder\apireplacement.dll

Documentation