Perl is just so cool (well, thanks to all those nice modules! :) ).
Anyway, since I havent been lazy waiting for a solution from you monks, Ive managed to do this:
use Win32API::File qw /:Func :IOCTL_DISK_ :MEDIA_TYPE/; use Data::Dumper; use strict; use warnings; use diagnostics; my $sDosDeviceName = []; my $osTargetPath; my @devices = Win32API::File::QueryDosDevice($sDosDeviceName, $osTarge +tPath, []) or die "Can't open: $^E\n"; print Dumper($sDosDeviceName); #foreach (@devices) { # print $_ . "\n"; #} my $hObject = createFile( "//./PhysicalDrive3", "r", "rw") or die "Can't open: $^E\n"; #Usage: Win32API::File::DeviceIoControl(hDevice, uIoControlCode, pInBu +f, lInBuf, opOutBuf, lOutBuf, olRetBytes, pOverlapped) my $opOutBuf; my $olRetBytes; Win32API::File::DeviceIoControl($hObject, IOCTL_DISK_GET_DRIVE_GEOMETR +Y, [], 0, $opOutBuf, [], $olRetBytes, []); # Calculate the number of DISK_GEOMETRY structures returned: my $cStructs= length($opOutBuf)/(4+4+4+4+4+4); my @fields= unpack( "L l I L L L" x $cStructs, $opOutBuf ); my( @ucCylsLow, @ivcCylsHigh, @uMediaType, @uTracksPerCyl, @uSectsPerT +rack, @uBytesPerSect ) = (); print Dumper(@fields); my $ucCylsLow = shift @fields; my $ivcCylsHigh = shift @fields; my $uMediaType = shift @fields; my $uTracksPerCyl = shift @fields; my $uSectsPerTrack = shift @fields; my $uBytesPerSect = shift @fields; if ($uMediaType eq FixedMedia) { print "FixedMedia"; }
Comments?

Well, so far it seems good (although I cant make QueryDosDevice to work!)... But next step? To actually read sector by sector?

(I've had some help from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/calling_deviceiocontrol.asp )

Thanks,
Ace

In reply to Re: Accessing a RAW partition! by Ace128
in thread Accessing a RAW partition! by Ace128

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.