-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFAT12.h
More file actions
executable file
·93 lines (77 loc) · 3.21 KB
/
FAT12.h
File metadata and controls
executable file
·93 lines (77 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#pragma pack(push)
#pragma pack(1)
struct Fat12MBR {
char jump[3];
char BS_OEMName[8];
unsigned short BPB_BytsPerSec;
unsigned char BPB_SecPerClus;
unsigned short BPB_RsvdSecCnt;
unsigned char BPB_NumFATs;
unsigned short BPB_RootEntCnt;
unsigned short BPB_TotSec16;
unsigned char BPB_Media;
unsigned short BPB_FATSz16;
unsigned short BPB_SecPerTrk;
unsigned short BPB_NumHeads;
unsigned int BPB_HiddSec;
unsigned int BPB_TotSec32;
unsigned char BS_DrvNum;
unsigned char BS_Reserved1;
unsigned char BS_BootSig;
unsigned int BS_VolID;
char BS_VolLab[11];
char BS_FileSysType[8];
};
struct entry {
char DIR_Name[11];
unsigned char DIR_Attr;
unsigned char reserve[10];
unsigned short DIR_WrtTime;
unsigned short DIR_WrtDate;
unsigned short DIR_FstClus;
unsigned int DIR_FileSize;
};
#pragma pack(pop)
struct node {
entry obj;
bool dir;
int offset;
node* prev;
node* next;
node* down;
node(): dir(false), offset(0), prev(NULL), next(NULL), down(NULL) {}
};
void PrintMBR(char* MBR);
void fat12(char* img, int size);
char* cd(char* param, char* header, node** now, node* roots, int cnt);
void dir(char* img, char* param, char* header, node* now, node* roots, int cnt);
void mkdir(char* img, char* param, node* roots, int& cnt, node* now);
void rmdir(char* img, char* param, node* roots, int cnt, node* now);
void type(char* img, char* param, node* roots, int cnt, node* now);
void del(char* img, char* param, node* roots, int cnt, node* now);
void copy(char* img, char* param, node* roots, int& cnt, node* now);
void help();
int find_roots(node* roots, char* img);
void find_sub_entry(node* root, char* img);
int tree(node* roots, char* img);
void show_tree(node* roots, int cnt, node* now);
void clear_tree(node* roots, int cnt);
node* path_analyze(char* param, node* roots, int cnt, node* now);
void PrintEntry(entry obj, int& num, int& size);
void edit_roots(char* img, node* roots, int &cnt, int& pos, int size);
void edit_sub_dir(char* img, node* dir, node* tmp);
void edit_empty_dir(char* img, node* now, int cls_num);
void input(char* buffer, int size, int& length);
node* find_dir(char* param, node* roots, int cnt, node* now);
node* find_file(node* roots, int cnt, node* dir);
void edit_entry(char* img, node* obj);
void read_fat(char* img, int* chain, int &num);
void empty_fat(char* img, int init);
void find_0_fat(char* img, int* chain, int num);
void edit_fat(char* img, int* chain, int num);
void read_block(char* img, char* block, int num, bool cls);
void write_block(char* img, char* block, int num, bool cls);
void date(unsigned short days);
void time(unsigned short time);
void getdate(unsigned short &days);
void gettime(unsigned short ×);