Results 1 to 3 of 3

Thread: C and VB Gurus...

  1. #1

    Thread Starter
    Lively Member Ceri's Avatar
    Join Date
    Sep 2000
    Posts
    72

    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?

  2. #2
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    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
    Crispin
    VB6 ENT SP5
    VB.NET
    W2K ADV SVR SP3
    WWW.BLOCKSOFT.CO.UK

    [Microsoft Basic: 1976-2001, RIP]

  3. #3

    Thread Starter
    Lively Member Ceri's Avatar
    Join Date
    Sep 2000
    Posts
    72

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width