I have a problem which seems like it should be simple to solve but I can't
work it out. I have developed a block device which is designed to store a
file system on a file. This file can then be mounted and unmounted
programatically to allow the user access to the filesystem. I've used the
technique of using a dummy block device which bootstraps the normal FAT FSD,
then the block device can be activated and deactived to bring the file system
up and down. However the problem I has is that if the file has just been
created it isn't formatted, so I need the option of being able to format it.
I want a prompt to ask if the device should be formatted, then the user can
decided to format or not to format.
My registry keys are:
[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\MyDisk]
"Name"="MyDisk"
"Folder"="MountedStorage"
"AutoMount"=1
"AutoFormat"=1
"AutoPart"=0
"PartitionDriver"=""
"DefaultFileSystem"="FATFS"
[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\MyDisk\FATFS]
"Flags"=4
Strangly it use to prompt me before formatting, but after I added the
PartitionDriver entry to the registry the original auto format prompt stopped
appearing. But without this key the disk was not being formatted correctly
and the MBR/Sector 0 didn't appear to be correct. Previously I could set
AutoFormat to 1 and the format was silent, or AutoFormat to 0 and the prompt
appeared before mounting and formatting. Now all I get is a silent auto
format, or nothing at all.
This silent autoformat will cause a problem because the software on the PDA
is designed to operate with an existing 2K/XP driver. If this file was
created on the desktop and formatted as NTFS rather than FAT then clearly I
don't just want the PDA to silently reformat the device and lose all the data.
Another possibilty might be if I can programatically format the device. But
I don't own the fsd driver so I don't know how to ask it to format the file
system (e.g. using FSDMGR_FormatVolume), and I can't open the volume and use
IOCTL_DISK_FORMAT_VOLUME or IOCTL_DISK_FORMAT_MEDIA because until it is
formatted it won't mount so \MountedStorage\Vol: doesn't exist.
Can anyone point of a solution to the auto format prompt, or tell me what I
am missing with regard to a programatic format?
Jamie