emitojleyes
July 28th, 2008, 04:51 PM
Hi everyone!
i'm new at this forum as well as programming in .net
I have to develop a module that can use and configure a fingerprint detector; its documentation is written in C, as you will see below.
This is the function declaration that appears at the documentation
extern int WINAPI Wis_Diagnose (unsigned char *pwd, SYSTEMDATA
CurSystemData);
This function is for the device test. Ex, PC test if the device is ready.
It returns 0 if the device test is OK; -1 if the device test is NG
Below i write down the two structures that this function uses, as described in the manual:
typedef struct _SYSTEMDATA
{
unsigned char Version; //DSP version
unsigned char IP[4]; //IP address
unsigned char NetMask[4]; //netmask
unsigned char Gateway[4]; //gateway
unsigned char BaudRate; //baudrate for external
unsigned char DeviceID[3]; //device ID
unsigned short UserNo; //user number
unsigned long LogNo; //log number
unsigned char AuthenMode; //1: 1-1 2: 1:1/1:N(<50 user
unsigned char UartMode; //1:232, 2:485
unsigned char VoiceEN; //1:enable
unsigned char ServerIP[3][4]; //server IP sets
unsigned char IDLength; //ID length for display
unsigned char Reserved[20];
DOORDATA DoorData; //door setting
unsigned char DeviceName[16]; //device name
unsigned char HasDevice; //this parameter should be 3
unsigned char ProtocolPswd; //protocol password
unsigned char Reserved1[7];
}SYSTEMDATA; //112 Bytes
//door data structure
typedef struct _DOORDATA
{
unsigned short DoorOpenSec;
unsigned short DoorOverSec;
unsigned short AlarmTime;
unsigned char AlarmEnable; //0: Disable
unsigned char Reserved[9];
}DOORDATA; //16 bytes
Now, i have been trying to define some variables that match the ones originally in the manual; below is this code:
Structure doordata
Dim DoorOpenSec As Short
Dim DoorOverSec As Short
Dim AlarmTime As Short
Dim AlarmEnable As String
Dim Reserved As String
End Structure
Structure SystemData
Dim Version As String
Dim IP As String
Dim NetMask As String
Dim Gateway As String
Dim BaudRate As String
Dim DeviceID As String
Dim UserNo As Short
Dim LogNo As Long
Dim AuthenMode As String
Dim UartMode As String
Dim VoiceEN As String
Dim ServerIP() As String
Dim IDLength As String
Dim Reserved As String
Dim DoorData As doordata
Dim DeviceName As String
Dim HasDevice As String
Dim ProtocolPswd As String
Dim Reserved1 As String
End Structure
And the DLLImport i declared is as follows:
<DllImport("C:\WisClient.dll", EntryPoint:="Wis_Diagnose", SetLastError:=True, _
CharSet:=CharSet.Unicode, ExactSpelling:=True, _
CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function Diagnostico( _
ByVal pwd As String, _
ByRef systemdata As SystemData) _
As Integer
End Function
Now, sometimes, i got the folowing error:
PInvokeStackImbalance was detected
Message: A call to PInvoke function ....' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
And sometimes my Vstudio doesn't respond....
I will really appreciate any comments that can help me solve this problems
Thanks in advance!!
EMilio Leyes
Salta, ARgentina
i'm new at this forum as well as programming in .net
I have to develop a module that can use and configure a fingerprint detector; its documentation is written in C, as you will see below.
This is the function declaration that appears at the documentation
extern int WINAPI Wis_Diagnose (unsigned char *pwd, SYSTEMDATA
CurSystemData);
This function is for the device test. Ex, PC test if the device is ready.
It returns 0 if the device test is OK; -1 if the device test is NG
Below i write down the two structures that this function uses, as described in the manual:
typedef struct _SYSTEMDATA
{
unsigned char Version; //DSP version
unsigned char IP[4]; //IP address
unsigned char NetMask[4]; //netmask
unsigned char Gateway[4]; //gateway
unsigned char BaudRate; //baudrate for external
unsigned char DeviceID[3]; //device ID
unsigned short UserNo; //user number
unsigned long LogNo; //log number
unsigned char AuthenMode; //1: 1-1 2: 1:1/1:N(<50 user
unsigned char UartMode; //1:232, 2:485
unsigned char VoiceEN; //1:enable
unsigned char ServerIP[3][4]; //server IP sets
unsigned char IDLength; //ID length for display
unsigned char Reserved[20];
DOORDATA DoorData; //door setting
unsigned char DeviceName[16]; //device name
unsigned char HasDevice; //this parameter should be 3
unsigned char ProtocolPswd; //protocol password
unsigned char Reserved1[7];
}SYSTEMDATA; //112 Bytes
//door data structure
typedef struct _DOORDATA
{
unsigned short DoorOpenSec;
unsigned short DoorOverSec;
unsigned short AlarmTime;
unsigned char AlarmEnable; //0: Disable
unsigned char Reserved[9];
}DOORDATA; //16 bytes
Now, i have been trying to define some variables that match the ones originally in the manual; below is this code:
Structure doordata
Dim DoorOpenSec As Short
Dim DoorOverSec As Short
Dim AlarmTime As Short
Dim AlarmEnable As String
Dim Reserved As String
End Structure
Structure SystemData
Dim Version As String
Dim IP As String
Dim NetMask As String
Dim Gateway As String
Dim BaudRate As String
Dim DeviceID As String
Dim UserNo As Short
Dim LogNo As Long
Dim AuthenMode As String
Dim UartMode As String
Dim VoiceEN As String
Dim ServerIP() As String
Dim IDLength As String
Dim Reserved As String
Dim DoorData As doordata
Dim DeviceName As String
Dim HasDevice As String
Dim ProtocolPswd As String
Dim Reserved1 As String
End Structure
And the DLLImport i declared is as follows:
<DllImport("C:\WisClient.dll", EntryPoint:="Wis_Diagnose", SetLastError:=True, _
CharSet:=CharSet.Unicode, ExactSpelling:=True, _
CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function Diagnostico( _
ByVal pwd As String, _
ByRef systemdata As SystemData) _
As Integer
End Function
Now, sometimes, i got the folowing error:
PInvokeStackImbalance was detected
Message: A call to PInvoke function ....' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
And sometimes my Vstudio doesn't respond....
I will really appreciate any comments that can help me solve this problems
Thanks in advance!!
EMilio Leyes
Salta, ARgentina