How to change the active partition using SetTapePosition function ?

Sher Pal 0 Reputation points
2024-07-10T09:17:19.8366667+00:00

i am using SetTapePosition function to change the active partition of a LTO tape drive but unable to do so it compiled without any error but didn't change the partition as well, On the other hand i and able to set the dwOffsetLow and it is working completely fine but the partition is not changing.

DWORD errorCode = 0;

DWORD PARTITION = 1;

errorCode = SetTapePosition(pApp.m_handleValue,TAPE_LOGICAL_BLOCK,PARTITION,20,0,FALSE);

if (errorCode != NO_ERROR) {

DWORD err = GetLastError();

}

and this function as well

DWORD bytesReturned;

TAPE_SET_POSITION tapePosition{};

tapePosition.Method = TAPE_LOGICAL_POSITION;

tapePosition.Partition = partition;

tapePosition.Offset.LowPart = 0;

tapePosition.Offset.HighPart = 0;

tapePosition.Immediate = FALSE;

if (!DeviceIoControl(hTape, IOCTL_TAPE_SET_POSITION, &tapePosition, sizeof(tapePosition), NULL, 0, &bytesReturned, NULL)) {

return GetLastError();

}

both of them are only able to set the offsetlowPart but unable to change the partition.

kindly let me know how to resolve this issue.

and i have already included the header files

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,657 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.