www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/08/23/09:44:40

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Tue, 23 Aug 2005 15:43:27 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Unable to read/write to a tape with tar
Message-ID: <20050823134327.GR17452@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20050823113812 DOT GO17452 AT calimero DOT vinschen DOT de> <BAY104-F4226E3A194B6E902753A7D87A90 AT phx DOT gbl>
Mime-Version: 1.0
In-Reply-To: <BAY104-F4226E3A194B6E902753A7D87A90@phx.gbl>
User-Agent: Mutt/1.4.2i

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 AT cygwin DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019