Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

GetSystemWow64Directory (kernel32)
 
.
Summary
Retrieves the path of the system directory used by WOW64. This directory is not present on 32-bit Windows.

C# Signature:

[DllImport("kernel32.dll", SetLastError=true)]
public static extern int GetSystemWow64Directory([In, Out] char[] lpBuffer, [MarshalAs(UnmanagedType.U4)] uint size);

// Or

[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
public static extern int GetSystemWow64Directory([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder lpBuffer, [MarshalAs(UnmanagedType.U4)] uint size);

VB Signature:

Private Declare Function GetSystemWow64Directory Lib "Kernel32.dll" Alias _
      "GetSystemWow64DirectoryA" (ByVal lpBuffer As String, ByVal uSize As Long) As Integer
Declare Function GetSystemWow64Directory Lib "kernel32.dll" (TODO) As TODO

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

None.

Tips & Tricks:

Please add some!

C# Sample Code:

Sample Code:

    [DllImport("Kernel32.dll")]
    public static extern int GetSystemWow64Directory([In, Out] char[] lpBuffer, [MarshalAs(UnmanagedType.U4)] uint size);

    char[] path = new char[256];

    int result = GetSystemWow64Directory(path, (uint)path.Length);
    if (result != 0)
        MessageBox.Show(new String(path, 0, result));

    // Or

    [DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
    private static extern int GetSystemWow64Directory([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder lpBuffer, [MarshalAs(UnmanagedType.U4)] uint size);

    var path = string.Empty;
    var buffer = new StringBuilder(260); // MAX_PATH
    if (GetSystemWow64Directory(buffer, (uint)buffer.Capacity) != 0)
    {
        path = buffer.ToString();
    }

VB.NET Sample Code:

    Private Declare Function GetSystemWow64Directory Lib "Kernel32.dll" Alias _
      "GetSystemWow64DirectoryA" (ByVal lpBuffer As String, ByVal uSize As Integer) As Integer

    Dim DirPath As String = Space(255)
    Dim Result As Integer = GetSystemWow64Directory(DirPath, DirPath.Length)

    If Result <> 0 Then
        MsgBox(DirPath.ToString)
    End If

Documentation

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions