Solved

Formatting a floppy disk

Posted on 1998-04-22
13
353 Views
Last Modified: 2013-12-03
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.
0
Comment
Question by:wiggershaus
  • 6
  • 5
  • 2
13 Comments
 
LVL 11

Expert Comment

by:alexo
ID: 1334315
Did you try it?  According to my info, IOCTL_DISK_FORMAT_TRACKS will format it as FAT.
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 1334316
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
 
LVL 11

Expert Comment

by:alexo
ID: 1334317
You can use the SHFormatDrive() API.
See: http://support.microsoft.com/support/kb/articles/q173/6/88.asp
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 1334318
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
 
LVL 11

Expert Comment

by:alexo
ID: 1334319
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
 

Author Comment

by:wiggershaus
ID: 1334320
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 11

Accepted Solution

by:
alexo earned 200 total points
ID: 1334321
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
 

Author Comment

by:wiggershaus
ID: 1334322
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
 
LVL 11

Expert Comment

by:alexo
ID: 1334323
I don't have the DDK but my guess would be one of the following:
- NtFsControlFile()
- NtDeviceIoControlFile()

0
 

Author Comment

by:wiggershaus
ID: 1334324
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
 

Author Comment

by:wiggershaus
ID: 1334325
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
 
LVL 11

Expert Comment

by:alexo
ID: 1334326
The Nt...() functions have equivalent functions starting with Zw (or something similar).
0
 

Author Comment

by:wiggershaus
ID: 1334327
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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MS Access (Newest One): Pulling Data out of a MS SQL DB 1 45
Example of WebAPI 7 32
WPF issue with Trigger 2 96
Having a different time zone on your task bar 3 53
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now