PRB: Block Size Must Be Set Before Doing Tape I/O

ID: Q165274


The information in this article applies to:
  • Microsoft Win32 Application Programming Interface (API), used with:
    • Microsoft Windows NT versions 3.51, 4.0
    • Microsoft Windows 2000


SYMPTOMS

After you boot the system, Tape I/O functions fail and GetLastError returns 87L (ERROR_INVALID_PARAMETER). The same code begins to work after you run NTBackup or another tape backup program.


CAUSE

This behavior is by design. When you start the system, the tape drivers are not initialized with a value for the tape media block size. Until the system is properly initialized with this information, all tape I/O fails as described above.


RESOLUTION

Once the tape block size is either retrieved or set, then the system allows tape I/O operations to proceed normally. Please note that other conditions may still cause I/O operations to fail.

To avoid this problem, call the SetTapeParameters function to set the MEDIA information or call the GetTapeParameters function to get the MEDIA information. These operations cause the block size to be communicated to the parts of the system that require it.

A well-written program should always set or get the tape block size before issuing tape I/O operations. Programs doing this during initialization will never see the error described above. Getting or setting the tape block size is recommended because this allows a program to allocate I/O buffers with sizes that are multiples of the block size. I/O operations with a buffer size not a multiple of the tape block size will fail as described above.

In Windows NT 3.51, if GetTapeParameters is used to get DRIVE information, the tape block size is propagated to the other parts of the system. Other Windows NT versions require that the MEDIA information be set or retrieved in order to propagate the block size to the other parts of the system.


MORE INFORMATION

This setting is system-wide. Programs may operate successfully without explicitly getting or setting the tape block size if some other program (for example, NTBackup) retrieves or sets the block size first.

Additional query words: KbBse Backup

Keywords : kbAPI kbKernBase kbWinOS2000 kbTapeBackup kbDSupport kbGrpKernBase
Version : winnt:3.51,4.0
Platform : winnt
Issue type : kbprb


Last Reviewed: January 10, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.