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

Last reviewed: September 30, 1997
Article ID: Q165274
The information in this article applies to:
  • Microsoft Win32 Application Programming Interface (API) included with: - Microsoft Windows NT versions 3.51, 4.0

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 : BseFileio BseTape
Version : WINDOWS NT:3.51,4.0;
Platform : NT WINDOWS
Issue type : kbprb


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.