in reply to Accessing a RAW partition!

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