-
C and VB Gurus...
I want to use a function inside the wnaspi32.dll 'SendASPI32Command" which is defined as
DWORD SendASPI32Command ( LPSRB psrb ) ;
but the struct that is passed through can be variable in size so i dont want to use aliases for the function and then declare them as follows:-
Private Declare Function Send1 Lib "wnaspi32" Alias "SendASPI32Command" (ByRef UDT as UDT1) as Long
Private Declare Function Send2 Lib "wnaspi32" Alias "SendASPI32Command" (ByRef UDT as UDT2) as Long
So what I tried is:-
Private Declare Function Send1 Lib "wnaspi32" (ByRef UDT as Any) as Long
but i get a Bad DLL calling convention, if i put an On Error Resume Next before the DLL Call the function does seem to have executed though because there are values in UDT, but function doesn't return a value.
Does anybody know how i can get around the problem?
-
Code:
Private Declare Function SendASPI32Command Lib "wnaspi32.dll" _(ByRef SRB_Stuff As SRB_Header) As Long
Private Type SRB_Header
SRB_Cmd As Byte 'ASPI command code
SRB_Status As Byte 'ASPI command status byte
SRB_HaId As Byte 'ASPI host adapter number
SRB_Flags As Byte 'ASPI request flags
SRB_Hdr_Rsvd As Long 'Reserved, MUST = 0
End Type
-
Cant...
That wont work because the SRB is just the header, below that there will be variable lenth UDT, depending on what SCSI command your are sending through the ASPI layer.