我使用此代码WFSStartUp
通过C#
程序调用
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
public unsafe struct WFSVERSION
{
public ushort wVersion;
public ushort wLowVersion;
public ushort wHighVersion;
public fixed char szDescription[256 + 1];
public fixed char szSystemStatus[256 + 1];
}
[DllImport("msxfs.dll", CharSet = CharSet.Ansi, CallingConvention = XFSConstants.CALLINGCONVENTION)]
public static extern int WFSStartUp(int dwVersionsRequired, ref WFSVERSION lpWFSVersion);
WFSVERSION m_Version = new WFSVERSION();
int requestVersion = 0x00010202;
int hResult = WFSStartUp(requestVersion, ref m_Version);
返回值正常hResult
但m_Version.szDescription
不正确(m_Version.szDescription[0] = 'W'
, m_Version.szDescription[1] = 0
, ...)
如何解决这个问题呢?