【发布时间】:2011-06-30 13:41:14
【问题描述】:
我有一个 gtop11dotnet.dll。它是来自 Gemalto 网站的适用于 Windows v2.2.0.9 的 .NET PKCS#11 库。 DLL 包含 C_GetCardProperty 方法,可用于检索智能卡的序列号或 GUID。根据 PKCS#11 User's Guide 和 .NET Integration Guide,它是“byte[] GetCardProperty(byte property, byte flags)”。它接收两个字节作为参数并检索例如字节数组形式的序列号或 GUID。 我的问题是如何获取序列号并将其存储到托管字节数组中?
这是我的尝试:
[DllImport("gtop11dotnet.dll")]
public static extern byte[] C_GetCardProperty(byte property, byte flags);
public static void Main()
{
byte[] bytes = new byte[12];
bytes = C_GetCardProperty(0x06, 0x00) //Error at this line -> Cannot marshal 'return value': Invalid managed/unmanaged type combination.
}
感谢您的帮助。
【问题讨论】: