如何通过C#应用程序调用WFSStartUp

时间:2017-02-18 13:12:13

标签: c# cen-xfs

我通过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,...)

如何解决这个问题?

0 个答案:

没有答案