Reading Tapes

Mark Rowe mark21rowe at yahoo.com
Tue Aug 14 00:32:31 EDT 2001


>From the Win32 Platform SDK - CreateFile function:

Disk Devices
Windows NT: You can use the CreateFile function to open a disk drive or a
partition on a disk drive. The function returns a handle to the disk device;
that handle can be used with the DeviceIOControl function. The following
requirements must be met in order for such a call to succeed:

The caller must have administrative privileges for the operation to succeed
on a hard disk drive.
The lpFileName string should be of the form \\.\PHYSICALDRIVEx to open the
hard disk x. Hard disk numbers start at zero. For example:
String Meaning
\\.\PHYSICALDRIVE2 Obtains a handle to the third physical drive on the
user's computer.

The lpFileName string should be \\.\x: to open a floppy drive x or a
partition x on a hard disk. For example:
String Meaning
\\.\A: Obtains a handle to drive A on the user's computer.
\\.\C: Obtains a handle to drive C on the user's computer.


Mark


"Peter Hansen" <peter at engcorp.com> wrote in message
news:3B789CC6.2FD7FFB5 at engcorp.com...
> Juan Huertas wrote:
> >
> > Hi all.
> >
> > My pc has a DAT tape (Windows 2000 Tape0) and i need to read the content
of
> > a tape with unix format, using low level I'ts possible to read from the
> > device inside python?.
> >
> > I try:
> >
> > dat=open('\\.\Tape0','rb').read()
> >
> > but the system does not open the file (ilegal file name: \\.\Tape0).
>
> Why did you believe \.\TAPE0 was a valid file name in the first
> place?  I don't know W2K, but under previous versions of that
> operating system that file name is just equivalent to \TAPE0,
> meaning it would have to look like a file in the root directory
> (of the current drive, maybe C:, maybe not).  I'm not expert on
> tape drives under W2K, but I suspect that's not the case.
> This may not be a Python question, unless you can successfully
> access the drive as a file using some other program.  Can
> you just use "TYPE \\.\TAPE0" and get something?  I doubt it.
>
> Or is this a way of referring to a shared device named \TAPE0
> under the current computer (using \\. instead of \\COMPUTERNAME)?
> I've never seen that before, and it isn't valid under W98.
>
> I'm also suspicious as to whether a DAT tape under W2K would
> look like a file at all.  Usually Windows tape drives end
> up being available only through special device drivers to
> applications which know about tapes.  *Unix* is prone to
> making all things look like files, so maybe you've taken
> what was a valid path under Unix and tried to use it under
> W2K?  (i.e. the original device was addressed as /./tape0
> under Unix?)  That wouldn't work either.
>
> I don't like posting something so fundamentally unhelpful,
> but nobody else beat me to it ... :)





More information about the Python-list mailing list