I am trying to use the GetSystemWow64Direcory method from my application. The sample from PInvoke.net seems incorrect to me. Don't I have to pin the the array before passing to the unmanaged call?
[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));