all groups > visual c libraries > september 2004 >
You're in the

visual c libraries

group:

Is there an API to format the HD?


Re: Is there an API to format the HD? Jon S.
9/6/2004 8:39:57 AM
visual c libraries:
I know in C you can use system() to access lcaolsystem commands
[quoted text, click to view]

Re: Is there an API to format the HD? David Mair
9/6/2004 9:10:26 AM
[quoted text, click to view]

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
Re: Is there an API to format the HD? Bill Thompson
9/6/2004 10:00:34 AM
[quoted text, click to view]

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

Re: Is there an API to format the HD? David Mair
9/6/2004 2:15:20 PM
[quoted text, click to view]

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
Is there an API to format the HD? ZhangZQ
9/6/2004 4:29:01 PM
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!

Re: Is there an API to format the HD? ZhangZQ
9/6/2004 11:15:09 PM
Hi, I am not making virus, but making a storage application.


[quoted text, click to view]

Re: Is there an API to format the HD? ZhangZQ
9/7/2004 12:09:05 AM
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


[quoted text, click to view]

Re: Is there an API to format the HD? CheckAbdoul
9/7/2004 10:18:32 AM
Take a look at the following link

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

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

[quoted text, click to view]

Re: Is there an API to format the HD? ZhangZQ
9/8/2004 9:00:05 AM
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:OJkURXOlEHA.1356@TK2MSFTNGP09.phx.gbl...
[quoted text, click to view]

AddThis Social Bookmark Button