Page 1 of 2
Initialising a floppy disk using Win32 API
Posted: Thu Feb 11, 2016 1:51 am
by Dreamland Fantasy
Hi there,
I have been experimenting with some disk routines programmed using the Windows API (IOCTL). I have been able to successfully format and verify floppy disks, but I am unable to initialise them with the FAT, etc. I have been trying to use IOCTL_DISK_CREATE_DISK which works for things like compact flash cards, but not floppies which throws up a "The request is not supported" error.
Does anyone know how I can initialise a floppy disk for use using the Windows API?
Kind regards,
Francis
Re: Initialising a floppy disk using Win32 API
Posted: Thu Feb 11, 2016 1:58 am
by IdeasVacuum
able to successfully format
Sounds like you are nearly there - have you searched the forum? I remember someone trying to do the same thing about a year or so ago. I assume the Windows API still supports floppy disks.....
Re: Initialising a floppy disk using Win32 API
Posted: Thu Feb 11, 2016 2:01 am
by Dreamland Fantasy
IdeasVacuum wrote:able to successfully format
Sounds like you are nearly there - have you searched the forum? I remember someone trying to do the same thing about a year or so ago. I assume the Windows API still supports floppy disks.....
I have searched the forum, but the only thing I found was using the fmifs.dll which doesn't give me the level of control I am looking for. I'm assuming that the Windows API still supports floppy disks to some degree as I can still format floppies through explorer, but who knows.
Kind regards,
Francis
Re: Initialising a floppy disk using Win32 API
Posted: Thu Feb 11, 2016 2:13 am
by IdeasVacuum
What are you using to do the format, Windows Shell? SHFormatDrive()? I thought that might be good but it's depreciated.
Again old, but interesting:
NTAPI Edit: No, it isn't, sorry.
Re: Initialising a floppy disk using Win32 API
Posted: Thu Feb 11, 2016 2:23 am
by Dreamland Fantasy
I'm using the IOCTL functions such as IOCTL_DISK_FORMAT_TRACKS which are called under DeviceIoControl().
Kind regards,
Francis
Re: Initialising a floppy disk using Win32 API
Posted: Thu Feb 11, 2016 2:23 am
by IdeasVacuum
Re: Initialising a floppy disk using Win32 API
Posted: Thu Feb 11, 2016 2:25 am
by RASHAD
How about
for all windows versions
Code: Select all
RunProgram("Format"," a: /V:Test /F:1.44 /S","")
Re: Initialising a floppy disk using Win32 API
Posted: Thu Feb 11, 2016 2:29 am
by Dreamland Fantasy
I did look at this earlier, but I wasn't sure how to implement it in PB. I'll give it another look tomorrow.
Kind regards,
Francis
Re: Initialising a floppy disk using Win32 API
Posted: Thu Feb 11, 2016 2:33 am
by Dreamland Fantasy
RASHAD wrote:How about
for all windows versions
Code: Select all
RunProgram("Format"," a: /V:Test /F:1.44 /S","")
Thanks, but that doesn't give me the level of control that I am looking for.
Kind regards,
Francis
Re: Initialising a floppy disk using Win32 API
Posted: Thu Feb 11, 2016 2:41 am
by IdeasVacuum
It is worth sending a pm to JHPJHP - may have experience in this area.
Re: Initialising a floppy disk using Win32 API
Posted: Thu Feb 11, 2016 3:58 am
by heartbone
Dreamland Fantasy wrote:Hi there,
I have been experimenting with some disk routines programmed using the Windows API (IOCTL). I have been able to successfully format and verify floppy disks, but I am unable to initialise them with the FAT, etc. I have been trying to use IOCTL_DISK_CREATE_DISK which works for things like compact flash cards, but not floppies which throws up a "The request is not supported" error.
Does anyone know how I can initialise a floppy disk for use using the Windows API?
Kind regards,
Francis
Isn't formatting the same as initializing a floppy?
FAT12 remains in use on all common floppy disks, including 1.44 MB and later 2.88 MB disks (media descriptor byte 0xF0).
I'm probably missing something, or perhaps it's mounting a floppy drive that you seek?
Re: Initialising a floppy disk using Win32 API
Posted: Thu Feb 11, 2016 5:23 pm
by Dreamland Fantasy
Formatting a disk, from the point of view of the IOCTL_DISK_FORMAT_TRACKS function, only formats the tracks.
Initialising (perhaps I'm using the wrong term here) the disk sets up the file system. Unless the disk is initialised it will not be accessible to Windows.
Kind regards,
Francis
Re: Initialising a floppy disk using Win32 API
Posted: Thu Feb 11, 2016 5:42 pm
by fryquez
There is some nice source code:
Floppy Disk Format
It creates FAT12 for manually, but only supports the default 1.44 MB floppy.
Have to ask, why in the year 2016 you need floppies

Re: Initialising a floppy disk using Win32 API
Posted: Thu Feb 11, 2016 6:06 pm
by Dreamland Fantasy
fryquez wrote:There is some nice source code:
Floppy Disk Format
It creates FAT12 for manually, but only supports the default 1.44 MB floppy.
Have to ask, why in the year 2016 you need floppies

Thanks for that link. Although it might be more complicated that doing a IOCTL_DISK_CREATE_DISK call, it may be just what I am looking for!
As for why I need floppies, I still use them for my Amigas (3.5") and BBC Micro (5.25" & 3.5"), plus my music keyboards uses 3.5" floppies.
Kind regards,
Francis
Re: Initialising a floppy disk using Win32 API
Posted: Sat Feb 13, 2016 10:17 am
by JHPJHP
Hi Dreamland Fantasy,
I included an example in my
Services, Stuff, and Shellhook post that may provide a solution.
- Stuff\OtherStuff\FormatDevice.pb