Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

wnaspi32.dll and VFP 1

Status
Not open for further replies.

pepe000p

Programmer
Jul 22, 2003
4
AR
I'm getting confused with the
getaspi32supportinfo()
sendaspi32command(string@)
getaspi32buffer(string@)
of the wnaspi32.dll
I would like to find an example of a string to ask for the SC_HA_INQUIRY , DEVICE 1
And how to transform the data back into usable information.
Thank you all,
Pepe
 
Hi Pepe,

Here is an example of using GetASPI32SupportInfo & SendASPI32Command with SC_HA_INQUIRY


#Define c0 chr(0)
#Define SS_COMP 0x01
#Define SS_NO_ADAPTERS 0xE8

Declare Long GetASPI32SupportInfo in WnASPI32
Declare Long SendASPI32Command in WnASPI32 String @cSRB

Local SRB_HAInquiry
Local lnASPI_Status, lnSRB_Status, lnSupportInfo
Local lnHaId, lnHaCount, lnAlignment, lnMaxASPI_Targets, lnMaxTransfer
Local lcHaUnique, lcManager, lcIdentifier

Clear
lnSupportInfo = GetASPI32SupportInfo()
lnASPI_Status = BitAnd(BitRShift(lnSupportInfo, 8), 0xFF)
lnHaCount = BitAnd(lnSupportInfo, 0xFF)

If ((lnASPI_Status != SS_COMP) and (lnASPI_Status != SS_NO_ADAPTERS)) or ;
(lnHaCount == 0)
If (lnHaCount > 0)
? 'ASPI Status : *** ERROR ***'
else
? 'Host Adapter Not Found !!'
endif
else
? 'GetASPI32SupportInfo'
? ' Status: ' + alltrim(str(lnASPI_Status))
? ' Host Adapter Count: ' + alltrim(str(lnHaCount))
?

SRB_HAInquiry = replicate(c0, 60)
SendASPI32Command(@SRB_HAInquiry)
lnSRB_Status = asc(substr(SRB_HAInquiry, 2))
If (lnSRB_Status == SS_COMP)
lnHaId = asc(substr(SRB_HAInquiry, 3))
lnHaCount = asc(substr(SRB_HAInquiry, 9))
lcHaUnique = substr(SRB_HAInquiry, 43, 16)

lnAlignment = Word2Num(left(lcHaUnique, 2))
lcManager = substr(SRB_HAInquiry, 11, 16)
If (at(c0, lcManager) > 0)
lcManager = left(lcManager, at(c0, lcManager)-1)
endif
lcIdentifier = substr(SRB_HAInquiry, 27, 16)
If (at(c0, lcIdentifier) > 0)
lcIdentifier = left(lcIdentifier, at(c0, lcIdentifier)-1)
endif
lnMaxASPI_Targets = asc(substr(lcHaUnique, 4))
If !inlist(lnMaxASPI_Targets, 0, 8, 16)
lnMaxASPI_Targets = 8
endif
lnMaxTransfer = DWord2Num(substr(lcHaUnique, 5, 4))

?
? 'SRB_HA_INQUIRY Status: COMPLETED'
? '--------------------------------'
? 'Host Adapter ID: ' + alltrim(str(lnHaId))
? 'Host Adapter Count: ' + alltrim(str(lnHaCount))
? 'ManagerID: ' + lcManager
? 'Identifier: ' + lcIdentifier
? 'Host Adapter Unique (mask) Parameters : '
? ' Buffer alignment : ', lnAlignment
If (asc(substr(lcHaUnique, 3)) == 1)
? ' Residual Byte Count : SUPPORTED'
else
? ' Residual Byte Count : NOT SUPPORTED'
endif
? ' Max ASPI Targets Count : ',lnMaxASPI_Targets
? ' Max Transfer Length : ', lnMaxTransfer
else
? 'SRB_HA_INQUIRY Status: ' + alltrim(str(lnStatus))
endif
endif
Clear Dlls
Clear all


Function Word2Num(tcWord)
Return asc(substr(tcWord, 1,1)) + ;
asc(substr(tcWord, 2,1)) * 256
EndFunc

Function DWord2Num(tcDWord)
Return asc(substr(tcDWord, 1,1)) + ;
asc(substr(tcDWord, 2,1)) * 256 + ;
asc(substr(tcDWord, 3,1)) * 65536 + ;
asc(substr(tcDWord, 4,1)) * 16777216
EndFunc


Regards

-- AirCon --
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top