You need to initialize dwTypeData and cch data members...
List<string> ls = new List<string>();
IntPtr hMenu = Win32.GetMenu(hWnd);
if (hMenu.ToInt32() != 0)
{
char[] szString = new char[256];
for (int i = Win32.GetMenuItemCount(hMenu); i >= 0; i--)
{
uint MIIM_STRING = 0x00000040;
uint MFT_STRING = 0x00000000;
Win32.MENUITEMINFO mif = new Win32.MENUITEMINFO();
mif.cbSize = (uint)Marshal.SizeOf(typeof(Win32.MENUITEMINFO));
mif.fMask = MIIM_STRING;
mif.fType = MFT_STRING;
mif.cch = 256;
mif.dwTypeData = szString;
bool a = Win32.GetMenuItemInfo(hMenu, 0, true, ref mif);
ls.Add(mif.dwTypeData);
}
}
return ls;