Formatting a floppy disk

How can I format a floppy disk silently (without prompting the user for anything) from a windows program without using the command "format" in NT 4.0? DeviceIOControl with parameter IOCTL_DISK_FORMAT_TRACKS formats the disks, but in raw format. I need FAT to use it.
wiggershausAsked:
Who is Participating?
 
alexoConnect With a Mentor Commented:
The "low level" functions you need are not a part of the SDK, you'll have to use the DDK for that.

QuickView the file IFSUTIL.DLL (which contains the functions used by FORMAT).  See the list of functions it imports from NTDLL.DLL, all those NtXXX functions are accessible using the DDK.

0
 
alexoCommented:
Did you try it?  According to my info, IOCTL_DISK_FORMAT_TRACKS will format it as FAT.
0
 
RONSLOWCommented:
Check MFTM.C sample program which does low-level format, copy disk images etc.

It appeas IOCTL_DISK_FORMAT_TRACKS will only do a low-level format, not lay down a file system etc.


0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
alexoCommented:
You can use the SHFormatDrive() API.
See: http://support.microsoft.com/support/kb/articles/q173/6/88.asp
0
 
RONSLOWCommented:
alexo - that sounds like an answer.

Interesting that (according to the KB) it is not documented in the SDK or in the .h file.

No wonder I had trouble finding something like that when I went looking.

0
 
alexoCommented:
Roger, I'm not sure it will do a silent format (never used the API myself), that's why it's a comment until wiggershaus acknowledges it.  I prefer to submit an answer when I'm fairly sure I'm correct.
0
 
wiggershausAuthor Commented:
I've tested SHFormatDrive(). It works (formats the disk correctly), but does not work silently; it pops up the normal windows dialog to format the disk. I'm looking for a solution which does it's work without popping up any window.
0
 
wiggershausAuthor Commented:
Thanks, I've got the DDK, but which functions do I need for formatting? Where can I look for those functions used by format?

0
 
alexoCommented:
I don't have the DDK but my guess would be one of the following:
- NtFsControlFile()
- NtDeviceIoControlFile()

0
 
wiggershausAuthor Commented:
Sorry, alexa, I can't try this out before monday next week, so I can't grade your answer now. The first thing I'll do on monday is
formatting the disk.
0
 
wiggershausAuthor Commented:
Sorry for being so late, (I'm very busy with an other project) but I can't get it to work so far. I neither find the functions NtFsControlFile (or NtDeviceIoControlFile) in the DDK nor other functions for formatting disks.
0
 
alexoCommented:
The Nt...() functions have equivalent functions starting with Zw (or something similar).
0
 
wiggershausAuthor Commented:
the Zw-functions do not contain any functions to format a disk.
I haven't any function in the DDK to format anything so far.
0
All Courses

From novice to tech pro — start learning today.