我有一個具有以下功能的非託管的DLL:從非託管的DLL調用函數
ReadLatch(HANDLE cyHandle,
LPWORD lpLatch);
WriteLatch(HANDLE cyHandle,
WORD mask,
WORD latch);
GetPartNumber(HANDLE cyHandle,
LPBYTE lpbPartNum);
GetDeviceProductString(HANDLE cyHandle,
LPVOID lpProduct,
LPBYTE lpbLength,
BOOL bConvertToASCII = TRUE
);
GetDeviceSerialNumber(HANDLE cyHandle,
LPVOID lpSerialNumber,
LPBYTE lpbLength,
BOOL bConvertToASCII = TRUE
);
GetDeviceInterfaceString(HANDLE cyHandle,
LPVOID lpInterfaceString,
LPBYTE lpbLength,
BOOL bConvertToASCII);
我試圖導入這些功能,但沒有太多的likle找到正確的數據類型:
[DllImportAttribute("runtime.dll", EntryPoint = "ReadLatch", CallingConvention = CallingConvention.Cdecl)]
static extern int ReadLatch(HANDLE cyHandle, [MarshalAs(UnmanagedType. ??????)] ?????? lpLatch);
[DllImportAttribute("runtime.dll", EntryPoint = "WriteLatch", CallingConvention = CallingConvention.Cdecl)]
static extern int WriteLatch(HANDLE cyHandle,
WORD mask,
WORD latch);
[DllImportAttribute("runtime.dll", EntryPoint = "GetPartNumber", CallingConvention = CallingConvention.Cdecl)]
static extern int GetPartNumber(HANDLE cyHandle,
LPBYTE lpbPartNum);
[DllImportAttribute("runtime.dll", EntryPoint = "GetDeviceProductString", CallingConvention = CallingConvention.Cdecl)]
static extern int GetDeviceProductString(HANDLE cyHandle,
LPVOID lpProduct,
LPBYTE lpbLength,
BOOL bConvertToASCII = TRUE
);
[DllImportAttribute("runtime.dll", EntryPoint = "GetDeviceSerialNumber", CallingConvention = CallingConvention.Cdecl)]
static extern int GetDeviceSerialNumber(HANDLE cyHandle,
LPVOID lpSerialNumber,
LPBYTE lpbLength,
BOOL bConvertToASCII = TRUE
);
[DllImportAttribute("runtime.dll", EntryPoint = "GetDeviceInterfaceString", CallingConvention = CallingConvention.Cdecl)]
static extern int GetDeviceInterfaceString(HANDLE cyHandle,
LPVOID lpInterfaceString,
LPBYTE lpbLength,
BOOL bConvertToASCII);
我在哪裏可以找到有關如何表示HANDLE,LPWORD和其他人的信息,以便我可以調用這些函數?
參見[平臺調用數據類型](http://msdn.microsoft.com/en-us/library/ac7ay120(v = vs.110).aspx) –