13 int main(
int _argc,
char *_argv[])
17 uint8_t pactive, ptype;
26 printf(
"Usage: %s [image_file]\n", _argv[0]);
32 printf(
"Cannot attach image file '%s'\n", _argv[1]);
38 if (pstart == 0xffffffff) {
39 printf(
"Cannot find first partition\n");
43 printf(
"Partition 0 start sector 0x%-08.8lX active %-02.2hX type %-02.2hX size %-08.8lX\n", pstart, pactive, ptype, psize);
46 printf(
"Error getting volume information\n");
49 printf(
"Volume label '%-11.11s'\n", vi.
label);
51 printf(
"%d sectors per FAT, first FAT at sector #%d, root dir at #%d.\n",vi.
secperfat,vi.
fat1,vi.
rootdir);
52 printf(
"(For FAT32, the root dir is a CLUSTER number, FAT12/16 it is a SECTOR number)\n");
53 printf(
"%d root dir entries, data area commences at sector #%d.\n",vi.
rootentries,vi.
dataarea);
62 printf(
"[unknown]\n");
72 printf(
"error opening subdirectory\n");
77 printf(
"file: '%-11.11s'\n", de.
name);
99 printf(
"error opening file\n");
108 sprintf(sector2,
"test string at the end...");
109 DFS_WriteFile(&fi, sector, sector2, &cache, strlen(sector2));
113 printf(
"Readback test\n");
115 printf(
"error opening file\n");
118 p = (
void *) malloc(fi.
filelen+512);
119 memset(p, 0xaa, fi.
filelen+512);
122 printf(
"read complete %d bytes (expected %d) pointer %d\n", i, fi.
filelen, fi.
pointer);
126 fp=fopen(
"test.txt",
"wb");
127 fwrite(p, fi.
filelen+512, 1, fp);