Re: Multiple files with same filename on FAT
- From: Antonio Pasini <removethis_antonio.pasini@xxxxxxxx>
- Date: Tue, 30 Oct 2007 19:54:22 +0100
The holy grail, though, is a way to get the files out without writing
anything to the disk, to be sure it's still recognized by the PVR as
if it never was extracted. But I could well undo the editing before
returning the drive to the PVR...
Now to automate this, all I need is sample C code to read/write raw
sectors on a hard disk (bypassing the filesystem). Anybody has some
pointer ?
I would try the following:
1) Create a raw dump of your whole disk in a file; you can use DD on linux, or WinHex (need registration) or similar utilities; you could also try rawcopy.zip from http://www.ltr-data.se/opencode.html#ImDisk, which is free. I didn't try that.
2) From the link above, use ImDisk to mount your image file as a a virtual drive. I used the control panel, but you can do by command line also.
3) You can access the virtual drive using low level functions (sector by serctor) from WinXP using CreateFileA(), ReadFile and WriteFile().
Have a look to: http://www.codeguru.com/cpp/w-p/system/misc/article.php/c5765/
the code is similar to:
// drive: 0=A
char unitName[] = "A:";
char _devicename[] = "\\\\.\\A:";
assert('A' <= DRIVE_LETTER && DRIVE_LETTER <= 'Z');
unitName[0] = toupper(DRIVE_LETTER);
// Creating a handle to disk drive using CreateFile () function ..
_devicename[4] = toupper(DRIVE_LETTER);
hDevice = CreateFileA((LPCSTR ) _devicename, FILE_ACCESS,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
[....]
to read a sector: ReadFile(hDevice, buf, 512, &bytesRead, NULL)
to write a sector: WriteFile(hDevice, buf, 512, &bytesWritten, NULL) )
You can also find a lot of FAT code on the net... I would try EFSL library; you could hack that to follow your "double name" FAT arrangement.
Using the above snippets, I was able to test my FAT code very very easily under XP with VisualC++ Express without messing up my drives. It was very handy to have different image files for the different "corner" cases to test.
.
- Follow-Ups:
- Re: Multiple files with same filename on FAT
- From: Vicne
- Re: Multiple files with same filename on FAT
- Prev by Date: Information about Zigbee
- Next by Date: Re: Information about Zigbee
- Previous by thread: Information about Zigbee
- Next by thread: Re: Multiple files with same filename on FAT
- Index(es):
Relevant Pages
|