ms-sys  2.7.0
About: ms-sys writes Microsoft compatible boot records. Development version.
  Fossies Dox: ms-sys-2.7.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

fat12.c
Go to the documentation of this file.
1 
18 #include <stdio.h>
19 #include <string.h>
20 
21 #include "file.h"
22 #include "fat12.h"
23 
24 int is_fat_12_fs(FILE *fp)
25 {
26  char *szMagic = "FAT12 ";
27 
28  return contains_data(fp, 0x36, szMagic, strlen(szMagic));
29 } /* is_fat_12_fs */
30 
32 {
33  #include "br_fat12_0x0.h"
34  #include "br_fat12_0x3e.h"
35 
36  return
37  ( contains_data(fp, 0x0, br_fat12_0x0, sizeof(br_fat12_0x0)) &&
38  /* BIOS Parameter Block might differ between systems */
39  contains_data(fp, 0x3e, br_fat12_0x3e, sizeof(br_fat12_0x3e)) );
40 } /* entire_fat_12_br_matches */
41 
42 int write_fat_12_br(FILE *fp, int bKeepLabel)
43 {
44  #include "label_11_char.h"
45  #include "br_fat12_0x0.h"
46  #include "br_fat12_0x3e.h"
47 
48  if(bKeepLabel)
49  return
50  ( write_data(fp, 0x0, br_fat12_0x0, sizeof(br_fat12_0x0)) &&
51  /* BIOS Parameter Block might differ between systems */
52  write_data(fp, 0x3e, br_fat12_0x3e, sizeof(br_fat12_0x3e)) );
53  else
54  return
55  ( write_data(fp, 0x0, br_fat12_0x0, sizeof(br_fat12_0x0)) &&
56  /* BIOS Parameter Block might differ between systems */
57  write_data(fp, 0x2b, label_11_char, sizeof(label_11_char)) &&
58  write_data(fp, 0x3e, br_fat12_0x3e, sizeof(br_fat12_0x3e)) );
59 } /* write_fat_12_br */
write_data
int write_data(FILE *fp, unsigned long ulPosition, const void *pData, unsigned int uiLen)
Definition: file.c:78
br_fat12_0x0
unsigned char br_fat12_0x0[]
Definition: br_fat12_0x0.h:1
write_fat_12_br
int write_fat_12_br(FILE *fp, int bKeepLabel)
Definition: fat12.c:42
br_fat12_0x3e.h
label_11_char.h
contains_data
int contains_data(FILE *fp, unsigned long ulPosition, const void *pData, unsigned int uiLen)
Definition: file.c:29
entire_fat_12_br_matches
int entire_fat_12_br_matches(FILE *fp)
Definition: fat12.c:31
br_fat12_0x0.h
fat12.h
file.h
is_fat_12_fs
int is_fat_12_fs(FILE *fp)
Definition: fat12.c:24
br_fat12_0x3e
unsigned char br_fat12_0x3e[]
Definition: br_fat12_0x3e.h:1
label_11_char
unsigned char label_11_char[]
Definition: label_11_char.h:1