Have you made sure that your struct is suitable for interop using appropriate attributes from the System.Runtime.InteropServices namespace?
Here is one example:
[StructLayout( LayoutKind.Sequential, CharSet = CharSet.Unicode )]
public struct OSVERSIONINFO
{
internal int dwOSVersionInfoSize;
/// <summary>
/// Major
/// </summary>
public int dwMajorVersion;
/// <summary>
/// Minor
/// </summary>
public int dwMinorVersion;
/// <summary>
/// Build
/// </summary>
public int dwBuildNumber;
/// <summary>
/// Platform type
/// </summary>
public PlatformType dwPlatformId;
/// <summary>
/// Null-terminated string that provides arbitrary
/// additional information about the OS.
/// </summary>
[MarshalAs( UnmanagedType.ByValTStr, SizeConst = 256 )]
public string szCSDVersion;
}
regards
Espen Harlinn