Question

Is there a way to purposefully corrupt a FAT file system using only Win32 calls or must you do it at lower level? We're encountering FAT corruption on a WinCE 5.0 device and have written a utility to detect and attempt to correct it, but don't have a means to create FAT corruption on demand. Thanks.

The media is a CF card, but it's not removable as a normal course as it's mounted internal to the device.

Était-ce utile?

La solution

What's the FAT on (e.g. inserted USB, on-board flash, etc)? That's going to make a large difference.

If it's the on-board flash, you need to get underneath the file system driver (FSD), which is typically going to be the flash driver itself. It's going to have access to the raw flash sectors (it's what the FSD uses for its reads and writes) either through Xxx_Write or Xxx_Ioctl. Exactly how it works is going to depend on the flash driver in use, so looking at the driver source is your best path.

Autres conseils

You can access device data as a raw file and write random data in that file to corrupt FAT. E.g. if you write random data on:

\?\Device\HarddiskVolume1

This would corrupt first partition.

This page has some hints on how to figure out paths for HDD/USB drive etc.

http://www.chrysocome.net/dd

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top