INFO: Possible Cause for ERROR_INVALID_FUNCTION

Last reviewed: November 26, 1997
Article ID: Q111838
The information in this article applies to:
  • Microsoft Win32 Application Programming Interface (API) included with: - Microsoft Windows NT versions 3.1, 3.5, 3.51, 4.0

SUMMARY

The Win32 Tape API (application programming interface) functions may return an error code of ERROR_INVALID_FUNCTION if the operation being attempted is not supported by the tape device.

MORE INFORMATION

You can determine what operations are valid for a tape device by calling GetTapeParameters() to get the tape drive parameters. See the code fragment in the Sample Code section of this article for an example of how to call GetTapeParameters() for this information.

Once you have the TAPE_GET_DRIVE_PARAMETERS structure, you can check for a specific operation in the FeaturesLow and FeaturesHigh members of the TAPE_GET_DRIVE_PARAMETERS structure. This is also demonstrated in the Sample Code section.

Sample Code

   /*
   ** This is a code fragment only and will not compile and run as is.
   */

   DWORD dwRes, dwSize;
   TAPE_GET_DRIVE_PARAMETERS parmDrive;

   ...

   dwSize = sizeof(parmDrive);
   dwRes = GetTapeParameters(hTape, GET_TAPE_DRIVE_INFORMATION,
                   &dwSize, &parmDrive);
   if (dwRes != NO_ERROR) {
       /* place error handling code here */
       exit(-1);
   }

   if (parmDrive.FeaturesLow & TAPE_DRIVE_ERASE_LONG)
       printf(“Device supports the long erase technique.\n”);

   ...
Keywords          : BseFileio kbcode kberrmsg
Version           : winnt:3.1,3.5,3.51,4.0;
Platform          : winnt
Issue type        : kbinfo


================================================================================


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: November 26, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.