🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.delphi.opentoolsapi
2 messages
2 total messages Started by akalb Thu, 20 Mar 2008 09:54
tape backup
#28
Author: akalb
Date: Thu, 20 Mar 2008 09:54
54 lines
3119 bytes
how can I write a file over a tape backup
I use the procedure below to get the handle of the tape device, but I
don't know how can I write a file over the tape media. Is there anyone
can help me, please ???
I have found the "write" procedure below but I don' know how can I use
it.
Best regards,
                    Kalbert


//------------------------------------------------------------------------------
// open the tape drive e get the Handle
//------------------------------------------------------------------------------
function TForm1.OpenDrive:THandle;
var
  TapeHandle : THandle;
  Security : TSecurityAttributes;
begin
  Security.nLength := SizeOf(TSecurityAttributes);
  Security.bInheritHandle := FALSE;
  Security.lpSecurityDescriptor := nil;

  TapeHandle := CreateFile(PChar('\\.\TAPE0'),
                           GENERIC_READ OR GENERIC_WRITE,
                           FILE_SHARE_READ OR FILE_SHARE_WRITE,
                           @SECURITY,
                           OPEN_EXISTING,
                           0,
                           0);

  if TapeHandle=INVALID_HANDLE_VALUE then
    result := 0
  else
    result := TapeHandle;
end;




procedure TForm1.Write(iBuffer:Pointer; iBufLen:DWORD);
var
  TapeHandle  : THandle;
  lBytesWritten : DWord;
begin
  TapeHandle := OpenDrive;

  if not WriteFile(TapeHandle,iBuffer^,iBufLen,lBytesWritten,nil) then
    if lBytesWritten <> iBufLen then
      ShowMessage('WriteFile only wrote '+IntToStr(lBytesWritten)+'
bytes when'+IntToStr(iBufLen)+' bytes were requested')
    else
      raise Exception.Create('WriteFile returned an error, code
was'+IntToStr(GetLastError()));
end;
Re: tape backup
#27
Author: Alberto Salvati
Date: Fri, 21 Mar 2008 10:27
4 lines
1573 bytes
THIS IS AN *ITALIAN* NG.
IF YOU ARE SEARCHING SOME HELP HERE, YOU *MUST* WRITE IN ITALIAN.

A.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads