This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Unable to read/write to a tape with tar


On Aug 23 12:56, cyril bonnard wrote:
> Ok, i'll reinstall the driver, the strange thg is that wintar-scsi works 
> fine !?

Since wintar-scsi is a proprietary application, I can't look what it's
doing differently.  AFAIK, wintar-scsi uses low level calls on the SCSI
level.  Cygwin uses just standard Win32 function calls.  If these fail
even though opening the device worked, then I'm stuck.

Could you please build this small testcase and run it while a tape in
in the drive?

======== SNIP =======
#include <stdio.h>
#include <windows.h>

int
main (int argc, char **argv)
{
  HANDLE mt;
  TAPE_GET_MEDIA_PARAMETERS mp;
  DWORD ret, size, part, low, high;

  /* Open tape device */
  mt = CreateFile ("\\\\.\\tape0", GENERIC_READ | GENERIC_WRITE,
                   FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
                   OPEN_EXISTING, 0, NULL);
  if (mt == INVALID_HANDLE_VALUE)
    {
      fprintf (stderr, "CreateFile: Win32 error %lu\n", GetLastError ());
      return 1;
    }

  /* Get tape status */
  while (ret = GetTapeStatus (mt))
    {
      fprintf (stderr, "GetTapeStatus: Win32 error %lu\n", ret);
      sleep (1);
    }

  /* Get media parameters */
  size = sizeof mp;
  ret = GetTapeParameters (mt, GET_TAPE_MEDIA_INFORMATION, &size, &mp);
  if (ret)
    {
      fprintf (stderr, "GetMediaParameters: Win32 error %lu\n", ret);
      goto fini;
    }

  printf ("Capacity:       %lld\n", mp.Capacity);
  printf ("Remaining:      %lld\n", mp.Remaining);
  printf ("BlockSize:      %lu\n", mp.BlockSize);
  printf ("PartitionCount: %lu\n", mp.PartitionCount);
  printf ("WriteProtected: %d\n", mp.WriteProtected);

fini:
  CloseHandle (mt);
  return 0;
}
======== SNAP =======


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]