The error is " AccessViolationException: Attempted to read or write protected memory "
vc++ DLL
#ifndef IZZIXFELAPI32_H
#define IZZIXFELAPI32_H
#ifdef IZZIXFELAPI32_EXPORTS
#define IZZIXFELAPI32_API __declspec(dllexport)
#else
#define IZZIXFELAPI32_API __declspec(dllimport)
#endif
#define MAX_FEATUREVECT_LEN 480
#define HIGH_LEVEL 2
#define MEDIUM_LEVEL 1
#define LOW_LEVEL 0
// Error code of FingerAPI
#define FPAPIERR_NO 0
#define FPAPIERR_OK 1
#define FPAPIERR_GENERAL_ERROR -1
#define FPAPIERR_CAN_NOT_OPEN_DEVICE -2
#define FPAPIERR_MATCH_FAILED -101
#define FPAPIERR_CAN_NOT_ALLOC_MEMORY -201
#define FPAPIERR_VECT_FAILED -301
#define FPAPIERR_INVALID_IMAGESIZE -401
#define FPAPIERR_FAKER_FINGERPRINT -501
#define FPAPIERR_LEFT_FINGERPRINT -601
#define FPAPIERR_RIGHT_FINGERPRINT -602
#define FPAPIERR_UP_FINGERPRINT -603
#define FPAPIERR_DOWN_FINGERPRINT -604
#define FPAPIERR_SMALL_FINGERPRINT -605
#define FPAPIERR_TOO_WET -701
#define FPAPIERR_TOO_DRY -702
typedef struct
{
BYTE Data[MAX_FEATUREVECT_LEN];
} MINUTIAVECT, *LPMINUTIAVECT;
#ifdef __cplusplus
#define EXTWRN_C extern "C"
#else
#define EXTWRN_C
#endif
#ifdef __cplusplus
extern "C" {
#endif
namespace IzzixFELAPI32
{
void __stdcall DESEncode0(UCHAR *src,UCHAR *dec,UCHAR *key,int num);
void __stdcall DESEncode1(UCHAR *src,UCHAR *dec,UCHAR *key);
int __stdcall DESDecode(UCHAR *src,UCHAR *dec,UCHAR *key);
int __stdcall GetFinger(INT DeviceNumber,BYTE* pRawImage,LPMINUTIAVECT pFeature);
int __stdcall MatchFingerOneToOne(LPMINUTIAVECT pFeatureVect1,
LPMINUTIAVECT pFeatureVect2,
int securitylevel
);
int __stdcall MatchFingerOneToN(
LPMINUTIAVECT pFeatureVect,
LPMINUTIAVECT pDataBaseVects,
int nDataBaseSize,
int securitylevel,
int* pDataBaseIDs,
int* pAlwaysNULL
);
int __stdcall CollectFeature(LPMINUTIAVECT pFeatureVect1,
LPMINUTIAVECT pFeatureVect2,
LPMINUTIAVECT pFeatureVect3,
LPMINUTIAVECT pCollectVect
);
int __stdcall DisplayImage(HWND hWnd,int x1,int y1,int x2,int y2,
BYTE* pImage,int nWidth,int nHeight);
int __stdcall IsAvailableDevice(INT DeviceNumber);
int __stdcall GetSortedIndex(LPMINUTIAVECT pFeatureVect,
LPMINUTIAVECT pDataBaseVects,
int nDataBaseSize,
int* pIndex
);
int __stdcall GetFingerAPIVersion(UCHAR *Version);
int __stdcall GetSerial(INT DeviceNumber,UCHAR *Serial);
int __stdcall ConvertToISO(LPMINUTIAVECT pFeature,int fPos,unsigned char* Template);
int __stdcall ConvertFromISO(unsigned char* Template,LPMINUTIAVECT pFeature);
int __stdcall GetTouchStatus(INT DeviceNumber, BOOL &bTouch);
int __stdcall GetDevInfos(INT DeviceNumber, int *nProductType, int *nSensorType);
}
#ifdef __cplusplus
}
#endif
#endif
vb.net code is
<DllImport("IzzixFELAPI32.dll")> _
Private Shared Function GetSerial(ByVal DeviceNumber As Long, ByVal serial As StringBuilder) As Int32
End Function
...
Dim sb As New StringBuilder(550)
Call GetSerial(0, sb)
Dim st As String = sb.ToString