Re: Format and quick format
From: William DePalo [MVP VC++] (willd.no.spam_at_mvps.org)
Date: 07/12/04
- Next message: Igor Tandetnik: "Re: VC++ standard compliance - code"
- Previous message: Igor Tandetnik: "Re: Dialogbox did not show up. Please help!!!"
- In reply to: Paul: "Format and quick format"
- Next in thread: Paul: "Re: Format and quick format"
- Reply: Paul: "Re: Format and quick format"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 12 Jul 2004 13:39:22 -0400
"Paul" <Paul@discussions.microsoft.com> wrote in message
news:D7A159E0-F29E-4A25-82A1-2D0E988A7312@microsoft.com...
> What's the windows API to perform formatting or
> quick formatting of a floppy, a partition, or a volume?
I see that Dave has already pointed out the easiest way.
If you find that UI unacceptable then I think you are in for a lot of work.
On NT/2K/XP/2K+3 you can pass the name of a floppy drive, e.g. \\.\A: (or in
source code where backslashes must be doubled up "\\\\.\\A:") to
CreateFile(). Then to write to sector number n you write to the device
handle at an offset given by the product of the sector number n and the size
of one sector. Note this caveat from the docs:
<quote>
Note that all I/O buffers should be sector aligned (aligned on addresses in
memory that are integer multiples of the volume's sector size), even if the
disk device is opened without the FILE_FLAG_NO_BUFFERING flag. Depending the
disk, this requirement may not be enforced.
</quote>
To do this, you'll need to be aware of the layout of the MBR, the FAT table,
the root directory etc. It's a trip down memory lane. :-)
On 95/98/Me I think what you have to do is to get yourself a DOS reference
such as Ralf Brown's interrupt list and use DeviceIOControl() to issue DOS
interrupt functions (int 21h) to the virtual device driver in question. The
technique is sketched here:
As above, you'll need to know the layout of the disk.
You may want to post again in the kernel group to find out if there is an
easier alternative.
Regards,
Will
- Next message: Igor Tandetnik: "Re: VC++ standard compliance - code"
- Previous message: Igor Tandetnik: "Re: Dialogbox did not show up. Please help!!!"
- In reply to: Paul: "Format and quick format"
- Next in thread: Paul: "Re: Format and quick format"
- Reply: Paul: "Re: Format and quick format"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|