Click to See Complete Forum and Search --> : tape help me!!!!!!!!


songzhaosong
June 29th, 2001, 10:01 AM
Now we puzzled with a problem about the development of this type of tape recorder under the Windows NT 4.0p6.As we all know, the microsoft API Function supports tape developing ,so we are using visual C++ "BackupRead,BackupWrite,readFile,WriteFile" etc. to read or write the tape,but now i can't get through the BackupRead() and BackupWrite(),can you tell me how to solve this problem to develop tape and let it work.Can you help me?Thank First!

next is the problem Code:

/////////////////////////////////////////////////////////////////////////////////////////////////
//this part has come through,and get a formated tape.
HANDLE hTape;hTape=CreateFile("\\\\.\\TAPE0",GENERIC_READ|GENERIC_WRITE,0,0,OPEN_EXISTING,0,NULL);
CreateTapePartition(hTape,TAPE_FIXED_PARTITIONS,0,0);
PrepareTape(hTape,TAPE_LOAD,FALSE);
EraseTape(hTape,TAPE_ERASE_SHORT,TRUE);
/////////////////////////////////


/*--------------------in this part i can't get through--------BackupRead()-----------*/
int nLength;
LPBYTE lpBuffer;
BOOL bReadFile;
HANDLE hFile;
hFile=CreateFile("d:\\Capture.txt",GENERIC_READ|GENERIC_WRITE,0,0,OPEN_EXISTING,0,NULL);
nLength=GetFileSize(hFile,NULL);
lpBuffer=(LPBYTE)malloc(nLength+1);
bReadFile=BackupRead(hFile,lpBuffer,nLength,&lpNumberOfBytesRead,TRUE,FALSE,NULL);//this function can't pass

//next part has many problems,
HANDLE hFile2=CreateFile("\\.\TAPE0",GENERIC_WRITE,0,NULL,CREATE_ALWAYS,0,NULL);
BOOL bWriteFile=BackupWrite(hFile2,lpBuffer,nLength,&lpNumberOfBytesWritten,FALSE,FALSE,NULL);

///////////////////////////////////////////////////////////////////////////////////////////////////


thank you!



Emai:zs@song.net.cn