[fpc-pascal] Low level disc access under windows with FPC

Vinzent Hoefler JeLlyFish.software at gmx.net
Mon Oct 9 11:03:55 CEST 2006


On Sunday 08 October 2006 12:08, Pianoman wrote:

>         Hello, I'd like to ask if someone has experiences with low
> level disk operations in windows with FPC.
> The program should be able to copy entire diskete to one single image
> file and for example extract a single file from that image or view
> its contents.

http://www.winmag.com/library/1995/0695/06howtoc.htm:

-- 8< -- snip --
To open a disk for direct access, you use the Win32 CreateFile function 
with a special format to specify the name of the disk (a floppy or a 
partition on a hard disk): "\\\\.\\a: " to open the a: floppy and "\\\.
\\c: " to open the c: partition on a hard disk.

On hard disks, you can even get direct access at the physical device 
level, bypassing the partition structure. This is done with the special 
name "\\\\.\\PhysicalDriveN," where N is the number of the hard disk, 
starting with 0. If you have only one physical hard disk, it's 
PhysicalDrive0, no matter how many partitions you have.
-- 8< -- snip --

So creating a floppy image seems fairly easy (provided you have the 
rights to access the disk in that way at all), but extracting a file 
from a disk image may be harder because that would require knowledge of 
the file system in question unless Windows has some sort of "mount" 
feature for such image files.


HTH,

Vinzent.




More information about the fpc-pascal mailing list