Initialising a floppy disk using Win32 API
- Dreamland Fantasy
- Enthusiast

- Posts: 335
- Joined: Fri Jun 11, 2004 9:35 pm
- Location: Glasgow, UK
- Contact:
Initialising a floppy disk using Win32 API
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
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
-
IdeasVacuum
- Always Here

- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Initialising a floppy disk using Win32 API
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.....able to successfully format
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
- Dreamland Fantasy
- Enthusiast

- Posts: 335
- Joined: Fri Jun 11, 2004 9:35 pm
- Location: Glasgow, UK
- Contact:
Re: Initialising a floppy disk using Win32 API
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.IdeasVacuum wrote: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.....able to successfully format
Kind regards,
Francis
-
IdeasVacuum
- Always Here

- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Initialising a floppy disk using Win32 API
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.
Again old, but interesting: NTAPI Edit: No, it isn't, sorry.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
- Dreamland Fantasy
- Enthusiast

- Posts: 335
- Joined: Fri Jun 11, 2004 9:35 pm
- Location: Glasgow, UK
- Contact:
Re: Initialising a floppy disk using Win32 API
I'm using the IOCTL functions such as IOCTL_DISK_FORMAT_TRACKS which are called under DeviceIoControl().
Kind regards,
Francis
Kind regards,
Francis
-
IdeasVacuum
- Always Here

- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Initialising a floppy disk using Win32 API
Take a look at this: https://msdn.microsoft.com/en-us/librar ... 85%29.aspx
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: Initialising a floppy disk using Win32 API
Egypt my love
- Dreamland Fantasy
- Enthusiast

- Posts: 335
- Joined: Fri Jun 11, 2004 9:35 pm
- Location: Glasgow, UK
- Contact:
Re: Initialising a floppy disk using Win32 API
I did look at this earlier, but I wasn't sure how to implement it in PB. I'll give it another look tomorrow.IdeasVacuum wrote:Take a look at this: https://msdn.microsoft.com/en-us/librar ... 85%29.aspx
Kind regards,
Francis
- Dreamland Fantasy
- Enthusiast

- Posts: 335
- Joined: Fri Jun 11, 2004 9:35 pm
- Location: Glasgow, UK
- Contact:
Re: Initialising a floppy disk using Win32 API
Thanks, but that doesn't give me the level of control that I am looking for.RASHAD wrote:How about
for all windows versions
Code: Select all
RunProgram("Format"," a: /V:Test /F:1.44 /S","")
Kind regards,
Francis
-
IdeasVacuum
- Always Here

- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Initialising a floppy disk using Win32 API
It is worth sending a pm to JHPJHP - may have experience in this area.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: Initialising a floppy disk using Win32 API
Isn't formatting the same as initializing a floppy?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
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?
Keep it BASIC.
- Dreamland Fantasy
- Enthusiast

- Posts: 335
- Joined: Fri Jun 11, 2004 9:35 pm
- Location: Glasgow, UK
- Contact:
Re: Initialising a floppy disk using Win32 API
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
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
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
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
- Dreamland Fantasy
- Enthusiast

- Posts: 335
- Joined: Fri Jun 11, 2004 9:35 pm
- Location: Glasgow, UK
- Contact:
Re: Initialising a floppy disk using Win32 API
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!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
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
Hi Dreamland Fantasy,
I included an example in my Services, Stuff, and Shellhook post that may provide a solution.
- Stuff\OtherStuff\FormatDevice.pb
I included an example in my Services, Stuff, and Shellhook post that may provide a solution.
- Stuff\OtherStuff\FormatDevice.pb
Last edited by JHPJHP on Sat Feb 13, 2016 8:04 pm, edited 3 times in total.
If you're not investing in yourself, you're falling behind.
My PureBasic Stuff ➤ FREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.

