Is there an API to format the HD?
Messages   Related Types
This message was discovered on microsoft.public.dotnet.languages.vc.

Post a new message to this list...

ZhangZQ
Is there an API to format the HD? I found to use the DeviceIoControl with
IOCTL_DISK_FORMAT_TRACKS code can format the floppy, but how to format the
HD, I don't want the SHFormatDrvie way.

Thank you very much!

Reply to this message...
 
    
David Mair
ZhangZQ wrote:
[Original message clipped]

There's a section on Physical Disks and Volumes in the Platform SDK
documentation for CreateFile() but you probably saw that as a method of
getting a handle for DeviceIoControl. I do believe you can just write to
the media direct with WriteFile() but I've never tried it other than for
floppy disks (Google appears to confirm it).

Most of the modern file systems I know of only lay down their
super-structure when formatting. This makes formats very quick but many
do a disk scan or even clear every sector with a pattern, adding a huge
amount of time. I once did something like this for floppy disks by
simply laying down the initialisation state programmatically (i.e. a
MBR, BPB, FAT, Root Dir). If you know the file system media format you
can probably just lay down a default, empty one but I don't know how to
make a file system driver do a format on its own (would save you from
having to know the media format). You could write a pattern of your
devising to do a basic clearing of data but that won't do a forensic
safe cleanup - I believe the US DoD specifies a set of per-sector write
patterns they believe shreds the data to a forensic (or at least DoD
approved) state.
Reply to this message...
 
    
ZhangZQ
Thanks for your answer. Actually, I can create a specified filesystem by
direct-access the HD, but that newly partition can't be mounted and assigned
a driver letter until the Windows restart, I want to find a way to let the
OS to mount my newly created partition without reboot.

Regards,
ZhangZQ

"David Mair" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
David Mair
ZhangZQ wrote:
[Original message clipped]

Reboot? Er, this is Windows...right? Have you looked at the services
for volume management. They associate volumes with mount points. Perhaps
you can coerce the OS into accepting the changes to the media and
activate the volumes you create. I don't know if they help or if you've
looked at them but, if not, they may contain the answer.
Reply to this message...
 
    
CheckAbdoul
Take a look at the following link

http://www.sysinternals.com/ntw2k/source/fmifs.shtml

--
Cheers
Check Abdoul [VC++ MVP]
-----------------------------------

"ZhangZQ" <Click here to reveal e-mail address> wrote in message
news:O$gyTu%Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
ZhangZQ
Check Abdoul,

This information is very useful, but I still have some question.

1. I create a new raw partition by directly add a record in HD partition
table, after this partition was created, how to let the OS know there is a
new partition was created without reboot the OS.
2. I wonder about how to use the Windows MOUNT-POINT API to mount a raw
partition that without filesystem in it and assigns it a driver letter or
volume lable, those are the necessary parameters to pass to FormatEx
function.

Thank you very much!

Regards,
ZhangZQ

"CheckAbdoul" <checkabdoul at mvps dot org> дÈëÓʼþ
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Jon S.
I know in C you can use system() to access lcaolsystem commands
"ZhangZQ" <Click here to reveal e-mail address> wrote in message
news:O$gyTu%Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Bill Thompson
"ZhangZQ" <Click here to reveal e-mail address> wrote in message
news:O$gyTu#Click here to reveal e-mail address...
[Original message clipped]

As a courtesy to the helpful members of this newsgroup, could you kindly
indicate how we can recognize the virus you're making?

Reply to this message...
 
    
ZhangZQ
Hi, I am not making virus, but making a storage application.

"Bill Thompson" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
 




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com