in reply to Reading a physical disk in windows as a File

I doubt you will find a module to allow you access to the correct api's to read disks in their raw format. I haven't looked, so I may be wrong on that.

As you already have a utility to do it, I would suggest the easiest way is to persue your notion of forking dd and reading it that way. Instead of trying to read the whole thing into memory as a line, use the method of setting $/=\nn, to control the amount you read from the pipe to dd.

See perlman:perlvar, search for $INPUT_RECORD_SEPARATOR, and read the second piece of sample code and its surrounding paragraph for a full explaination.

Out of interest, is 'dd' the MKSToolkit version?


Well It's better than the Abottoire, but Yorkshire!

Replies are listed 'Best First'.
Re: Re: Reading a physical disk in windows as a File
by John M. Dlugosz (Monsignor) on Sep 03, 2002 at 22:00 UTC
    It's Win32::API.

      True. That would give him access to the native api's. If he knows which ones to call, what parameters to pass, how to manipulate perl vars into their C counterparts and back again, that would work.

      Seems a lot of work to avoid typing local $/=\4096 or whatever buffersize he is comfortable with.

      I'd also be wary of doing anything complicated given dada's warning:

      this simplicistic approach doesn't by any mean address any issue, and leave a lot of work on the programmers side; you have to pack() and unpack() data as C wants it, you have to know the structures you're using, and so on. it's not recommended to use Win32::API for complex tasks; think about writing an XS extension for that.


      Well It's better than the Abottoire, but Yorkshire!