0

I've been trying to change the active partition of an LTO8 tape in Windows 10 pro using the following code snippet (which gcc compiles without any warnings) but can able to change offset low

ChangePartition(HANDLE hTape, DWORD partition) {
    DWORD bytesReturned;
    TAPE_SET_POSITION tapePosition{};

    tapePosition.Method = TAPE_LOGICAL_POSITION;
    tapePosition.Partition = partition;
    tapePosition.Offset.LowPart = 100;
    tapePosition.Offset.HighPart = 0;
    tapePosition.Immediate = TRUE;

    if (!DeviceIoControl(hTape, IOCTL_TAPE_SET_POSITION, &tapePosition, sizeof(tapePosition), NULL, 0, &bytesReturned, NULL)) {
        return GetLastError();
    }

    return ERROR_SUCCESS;
}

This is the particular function I am using is DWORD partition I have tried to pass input(1 and 2) but nothing happen.

3
  • What does "but can able to change offset low" mean?
    – Ken White
    Commented Jul 10 at 4:06
  • it means i am able to traverse in the first partition of the tape so the offset low is the starting point of the current active partition which you can set with the help of this function, but the thing is that when it comes to change partition it is not working nor giving any error code
    – Sher
    Commented Jul 10 at 8:09
  • I have just found out if i am trying to check the number of partition it is also showing 0 but the tape is definitely partitioned, then why it is showing 0 DWORD getTapePartitions(HANDLE hTape) { TAPE_GET_MEDIA_PARAMETERS mediaParams = { 0 }; DWORD bytesReturned; if (!DeviceIoControl(hTape, IOCTL_TAPE_GET_MEDIA_PARAMS, NULL, 0, &mediaParams, sizeof(mediaParams), &bytesReturned, NULL)) { DWORD error = GetLastError(); printErrorMessage(error); throw std::runtime_error("Error getting tape media parameters."); }
    – Sher
    Commented Jul 18 at 2:54

0

Browse other questions tagged or ask your own question.