INFO: Possible Cause for ERROR_INVALID_FUNCTION

ID: Q111838

The information in this article applies to:

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          : kbcode kberrmsg kbAPI kbKernBase kbGrpKernBase 
Version           : winnt:3.1,3.5,3.51,4.0;
Platform          : winnt
Issue type        : kbinfo

Last Reviewed: November 28, 1997