Having problems writing wrapper for GetTapeParameter API in VB6. Here's the
code:

Option Explicit
Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal
lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As
Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, ByVal dwCreationDisposition
As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long)
As Long
Private Declare Function GetTapeParameters Lib "kernel32" (ByVal hDevice
As Long, ByVal dwOperation As Long, lpdwSize As Long, lpTapeInformation As
Any) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long)
As Long

Private Type SECURITY_ATTRIBUTES
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Long
End Type

Private Type TAPE_GET_DRIVE_PARAMETERS
ECC As Boolean
Compression As Boolean
DataPadding As Boolean
ReportSetmarks As Boolean
DefaultBlockSize As Long
MaximumBlockSize As Long
MinimumBlockSize As Long
MaximumPartitionCount As Long
FeaturesLow As Long
FeaturesHigh As Long
EOTWarningZoneSize As Long
End Type

Private Const GENERIC_READ = &H80000000
Private Const INVALID_HANDLE_VALUE = -1
Private Const OPEN_EXISTING = 3
Private Const GET_TAPE_DRIVE_INFORMATION = 1

Private Sub Form_Load()

Dim hKey As Long, lResult&, lpSize&, sa As SECURITY_ATTRIBUTES, DriveInfo
As TAPE_GET_DRIVE_PARAMETERS, Info&
sa.nLength = Len(sa)

hKey = CreateFile("\\.\Tape0", GENERIC_READ, 0, sa, OPEN_EXISTING, 0, 0)

'At this point I have a valid handle to the SCSI tape drive installed in
Windows NT Server

lResult = GetTapeParameters(hKey, GET_TAPE_DRIVE_INFORMATION, lpSize, DriveInfo)

'lResult is 234 which indicates ERROR_MORE_DATA meaning that DriveInfo is
not large enough
'however, lpSize is returned the value 32 and DriveInfo is of the type TAPE_GET_DRIVE_PARAMETERS

lResult = CloseHandle(hKey)

End Sub

Does anyone have any suggestions?

Thanks (;

W. Tom Anderson
Hendersonville, NC