At first please refer to Fig. 1, the method for long filenames is backed up and recovers in the present invention's exposure in the environment of not supporting long filenames, be to realize by the carrying out in following hardware configuration, and these hardware configurations include:
One microprocessing unit 10 is in order to carry out the running program of the present invention's exposure in order to backup and recovery long filenames;
One Basic Input or Output System (BIOS) 20 (BIOS, Basic Input/Output System);
One hard disk 30, operating system, application software or the file etc. that are used to store computer can be for the data of microprocessing unit 10 utilizations;
One input block 40 is as keyboard, Genius mouse, light pen or other functionally similar equipment, in order to the input data;
One output unit 50, as screen, display, LCDs, touch control display or other functionally similar equipment are in order to the result of output microprocessing unit 10;
One random access memory membrane module 60 is in order to deposit relevant deal with data; And
One power supplier 70 is in order to supply with the required electric energy of aforementioned each element running.
The disclosed method according to the present invention is backup and the recovery that is realized long filenames by following two stages, includes:
1. the backup long filenames becomes a long filenames backup file; And
2. the inverse process that utilizes the long filenames backup file to back up, and finish the recovery of long filenames.
Before further describing the detailed technology content in above two stages, just implement earlier to do an explanation about the knowledge of long filenames and short filename in the process of the technology of the present invention.The data memory format of disk
Disk (as: rigid disk, diskette) is one of peripheral equipment of computer, belongs to a kind of of recording medium, in order to storage operating system, application program, numerical data, analog date .. etc.; No matter be that rigid disk or diskette before use all must be earlier through " opening the beginning ", this process that opens the beginning just is called format (Formatting), at present under DOS and Windows environment, the format mode of disk can be undertaken by " Format " instruction that Microsoft provides, by " Format " instruction disk is divided into many magnetic regions (Sector), and the track (Track) that synthesizes by the magnetic region; Respectively magnetic region and track are numbered again, and will be write in the file configuration table (FAT, File Allocation Table) set up in advance and the File Directory Table (FDT, File Directory Table) with magnetic region, data that track is relevant.See also Fig. 2, it is the structural representation of a disk cut section (Partition), comprising having one to start record, first file configuration table, second file configuration table, file directory district and data recorded area, and aforesaid file directory district and data recorded area are exactly the constitution content of called file catalogue listing (FDT).Wherein the file directory district is made up of a plurality of file directory items (contain short filename directory entry with corresponding long filenames directory entry) institute, in order to provide be stored in data recorded area in the relevant information of data (as; File name, appended document name, time-tagging ... or the like).
In aforesaid startup record, also include a disk parameter piece (DPB, Disc ParameterBlock, be designated hereinafter simply as DPB), and this DPB is also incomplete same with the structure in FAT 32 systems at FAT 16, its content is respectively shown in [table one] and [table two].
And short filename directory entry and long filenames directory entry in the configuration among the FDT shown in [table three].The structure of long filenames item and short filename item
A kind of method of utilizing the directory entry storage long filenames of 8.3 forms (short filename form) is provided in Win95 (Windows95).Microsoft (Microsoft) claims to utilize the file system of the method to be virtual file contingency table (VFAT.Virtual File Allocation Table).The 8.3 forms another name that a correspondence is all arranged according to each long filenames of this file system storage.Long filenames and short filename together are stored in a File Directory Table (FDT; File Directory Table; hereinafter to be referred as FDT); and each FDT has then comprised a plurality of file directory items (containing short filename directory entry and corresponding long filenames directory entry); each long filenames directory entry can be stored 13 characters in the long filenames, and [long filenames is to store with general code (UNICODE) form; and every character accounts for 2 bits (BYTE)]; and for the directory entry of distinguishing among the FDT be long filenames or short filename; Windows95 is made as " OF " with the directory attribute bit of long filenames; and " OF " attribute is illegal filename under DOS; DOS can't carry out access to this filename; can not rename or delete; so such long filenames just can be protected under DOS, and DOS then can be by its corresponding short filename at accessing file.
And about the form of long filenames directory entry and short filename directory entry please respectively with reference to [table four] content with [table five].
Following what lift is exactly that a long filenames is: RunOnceEx Log.txt, corresponding short filename is the file layout of file in computer of RUNONC~1.TXT: 1370:04E0 42 2E 00 74 00 78 00 74-00 00 00 00 0F 00 D0 FF FF
B..t.x.t…….1370:04f0?FF?FF?FF?FF?FF?FF??FF?FF??FF?FF??00?00??FF?FF?FF?FF
……………..1370:0500?01?52?00??75?00?6E?00?4F-00??6E?00??0F?00?D0??63
00.R.u.n.O.n….c.1370:0510?65?00?45?00?78?00?20??00-4c?00?00?00?6f?00?67?00?e.E.x..L…o.g.1370:0520?52?55?4E?4F?4E?43?7E?31-54?58?54?20?00?15?2B?6D?RUNONE~
1TXT..+m1370:0530?67?25?67?25?00?00?16?72-65?25?14?00?B3?45?00?00?g?%?g?%…re
%…E..
Wherein:
1370:04e0 begins the 32nd bit: long filenames finishes item
1370:0500 begins the 32nd bit: the long filenames item
1370:0520 begins the 32nd bit: the short filename directory entry
Windows can also by to the short filename checksummat again with long filenames in verification and compare, judge whether short filename is modified in the environment of non-Windows 9x.
So, the disclosed technology according to the present invention, just become a long filenames backup file as long as the long filenames directory entry in the file directory district and corresponding short filename directory entry together backed up, just can be at the short filename in the disk directory that recovers long filenames in the future according to desire, in the long filenames backup file, obtain corresponding long filenames directory entry again, and carry out the recovery operation of long filenames.Generate the operating process of long filenames backup file
See also Fig. 3, the present invention includes the operating process that long filenames backs up:
1. according to contingency table (Partition Table), search first sector (being the disk parameter piece, DPB, Disk Parameter Block) of the cut section (Partition) of hard disk 30;
2. long filenames item that the File Directory Table in the cut section (FDT) is included and short filename item back-up storage become a long filenames backup file under current catalogue;
3. search the File Directory Table (FDT) of sub-directory downwards;
4. long filenames item that the File Directory Table (FDT) of sub-directory is included and short filename item back-up storage are among the long filenames backup file of current sub-directory; And
5. judge whether that sub-directory is not finished backup in addition? if yes, with being back to step 4, if not, then finish backup operation.
See also Fig. 5, in the process that generates the long filenames backup file, owing among same FDT, may include a plurality of non-short filenames of long filenames form that are, as the short filename 1~short filename 3 among the figure, just not having corresponding long filenames exists, and the short filename item of these short filename 1~short filenames 3 is recovering in the operation of long filenames in the future, will without any use, therefore the present invention stores and after generating a long filenames backup file together at the long filenames item that FDT is included and short filename item, also can again the short filename that does not contain corresponding long filenames item in the long filenames backup file be removed, just be removed useless short filename information.
Continue to see also Fig. 7, it backs up the main implementation step process flow diagram of long filenames for the present invention, and it includes:
1. begin to carry out backup;
2. read the content of the disk parameter piece (DPB) of hard disk to be backed up, obtain the identification code (FSID, File System ID) of file system;
3. judge FSID,,,, then skip to step 9 if above the two is all non-if FAT32 then skips to step 6 if FAT16 then continues next step;
4. calculate the position that starts record sheet (BDT, Boot Directory Table);
5. establish the size (disk size/magnetic bunch) of BDT;
6. obtain the initial of BDT;
7. calculate the BDT reference position;
8. search all File Directory Table FDT, and under current search catalogue, generate the backup file of long filenames; And
9. end backup operation.
In the backup flow process of Fig. 7, at first according to the disc code of desire backup in the contingency table (Partition Table) (as C:), search the position of its root directory, with regard to FAT16, be first sector behind the FAT, with regard to FAT32, be usually located at second magnetic bunch, can certainly from DPB, obtain the root directory position of FAT32.Obtaining root directory afterwards just can be to the backup operation of root directory and all sub-directory executive chairman filenames.
Aforesaid step 8 also comprises the following steps: (seeing also Fig. 8)
1. do you judge that the long filenames backup file generating run under the current directory finishes? if yes, then skip to step 5, if not, then continue next step;
2. read a file directory item and deposit long filenames backup file under the current directory in;
3. do you judge that this file directory item is that long filenames finishes item? if yes, then carry out next step, if not, then be back to step 1;
The backup and preserve into a long filenames backup file that is positioned under the current directory, be back to step 1 then;
5. establishing initial file directory item is current directory;
6. do you judge that all the long filenames backup file generating runs under the current directory finish? if yes, then finish the generating run of long filenames backup file, if not, then continue next step;
7. read a file directory item and deposit long filenames backup file under the current directory in;
8. do you judge that this file directory item is a sub-directory? if yes, then carry out next step, if not, then be back to step 6; And
9. pull over and handle next sub-directory, be back to step 6 then.
In the product process shown in Fig. 8, wherein search FDT and backup preservation long filenames (LFN, Long File Name) mode, be to adopt the method for twice search to carry out, when searching for the first time, analyze all sectors and preserve all long filenames items and corresponding short filename item, and when searching for the second time, then be to analyze all sub-directories, carry out the depth search, preserve all long filenames items and corresponding short filename item in all sub-directories.
Because the present invention adopts the processing mode of pulling over, and adopts this kind mode can handle the sub-directory that the degree of depth reaches 40 grades as calculated.If when pulling over, do not keep current directory, the degree of depth of pulling over can be increased to more than 80 grades, not only be applicable to the file system of FAT16, also be applicable to the file system of FAT32.Recover the operating process of long filenames
See also Fig. 4, it is exactly the inverse process that long filenames is carried out backup operation for the operating process of the present invention according to long filenames backup file recovery long filenames, the step of recovery basically, and it includes:
1. according to contingency table (Partition Table), search first sector (being the disk parameter piece, DPB, Disk Parameter Block) of the cut section (Partition) of hard disk 30;
2. whole short filename items that include according to File Directory Table in the cut section (FDT), in the long filenames backup file, find content corresponding (comprise short filename item with corresponding long filenames item), in the File Directory Table under this catalogue (FDT) corresponding short filename item replaced with pairing short filename item and corresponding long filenames item in the backup file then; And become a new file directory item (as shown in Figure 6);
3. search the File Directory Table (FDT) of sub-directory downwards;
4. whole short filename items that include according to the File Directory Table under the sub-directory (FDT), in the long filenames backup file, find content corresponding (comprising short filename item and corresponding long filenames item), in the File Directory Table under this sub-directory (FDT) corresponding short filename item replaced with pairing short filename item and corresponding long filenames item in the backup file then, and become a new file directory item (as shown in Figure 4); And
5. judge whether to also have sub-directory not finish the recovery operation of long filenames item? if yes, then be back to step 4, if not, then finish recovery operation.
Continue to see also Fig. 9, it recovers the main implementation step process flow diagram of long filenames for the present invention, and it includes:
1. begin to carry out recovery operation;
2. read the file directory district content of FDT in the hard disk to be recovered;
3. under current catalogue, seek the long filenames backup file;
4. judge whether to find the long filenames backup file? if yes, then continue next step, if not, then skip to step 9;
5. recovery long filenames, be all short filename items that include according to File Directory Table in the current directory (FDT), in the long filenames backup file, find content corresponding (comprising short filename item and corresponding long filenames item), in the File Directory Table under this catalogue (FDT) corresponding short filename item replaced with pairing short filename item and corresponding long filenames item in the aforementioned backup file then, and become a new file directory item;
6. seek the sub-directory of current directory;
7. judge whether to exist sub-directory? if yes, then carry out next step, if not, then skip to step 9;
8. recover the long filenames under the current sub-directory, be back to step 6 then and pull over and handle other sub-directory; And
9. end recovery operation.
In the backup flow process of Fig. 9, be disc code (as C:) equally according to desire backup in the contingency table (Partition Table), search the position of its root directory, with regard to FAT16, be to be first sector behind the FAT, with regard to FAT32, be usually located at second magnetic bunch, can certainly from DPB, obtain the root directory position of FAT32.Just can convert a new file directory item that comprises short filename item and corresponding long filenames item to after obtaining root directory, and finish the recovery operation of long filenames the short filename item in root directory and all sub-directories.
In the earlier figures 9 for the detailed step that recovers long filenames shown in 10 figure, include:
1. from the current directory of disk, read a short filename item;
2. judge whether to finish the recovery of long filenames, if yes, then finish the long filenames recovery operation of this catalogue, if not, then continue next step;
3. in current directory, seek the long filenames backup file;
4. judge whether to find the long filenames backup file? if yes, then continue next step, if not, then be back to step 1;
5. deposit the information of short filename item;
6. delete the short filename item;
7. in the long filenames backup file, move into and include identical short filename item and corresponding long filenames item; And
8. revise short filename item first magnetic family of file pointed, make its short filename item consistent, be back to step 1 then with deletion just now.
In the treatment scheme in Figure 10, be from the file directory district, to obtain a short filename, search its corresponding long filenames item (its steps flow chart as shown in figure 11) then in the long article spare backup file under same catalogue, if find then short filename in the deleted file directory area, then the short filename item in the long article spare backup file is joined (its steps flow chart as shown in figure 12) in the file directory district with corresponding long filenames item, revise first magnetic bunch of short filename item file pointed again, make its short filename item consistent with deletion just.
Below just illustrate with the example shown in the table six, the long filenames under same catalogue, it is before backup and behind the system destruction and utilize content after method of the present invention is recovered.
And can see that in the result of this embodiment the present invention can return to the situation before the backup to the short filename of only depositing behind system destruction.
The position | Content |
0B-0C | Character number in each magnetic region (herein be 0x0002, promptly 512) |
0D | Magnetic region number in each magnetic bunch (number is by the decision of cut section size) |
0E-0F | Keep magnetic region (0x0100) |
10 | The number of FAT (0x02) |
11-12 | The maximal value of file directory item (herein being 0x0002) |
13-14 | Magnetic region sum (herein being 0 when greater than 65535) |
15 | Media descriptor handling (being 0xfg) |
16-17 | The magnetic region number of each FAT |
18-19 | The magnetic region number of each track |
1A-1B | The magnetic head number |
1C-1D | Hide magnetic region number (not influencing the result) |
20-23 | 13-14 character place is 0 o'clock a magnetic region sum |
24 | Phisical drive number (first is 0x80, and second is 0x81...) |
25 | Keep |
26 | The feature character (being 0x29) of expansion leader record |
27-2A | Disk sequence number (producing at random) |
2B-35 | Label (totally 11 words) |
36-3D | File system type (being FAT16) |
The structure of [table one], FAT16
The position | Content |
0B-0C | Character number in each magnetic region (herein be 0x0002, promptly 512) |
0D | Magnetic region number in each magnetic bunch (number is by the decision of cut section size) |
0E-0F | Keep magnetic region (0x0100) |
10 | The number of FAT (0x02) |
11-12 | The maximal value of file directory item (herein being 0) |
13-14 | Magnetic region sum (herein being 0) |
15 | Media descriptor handling (being 0xf8) |
16-17 | The magnetic region number of each FAT (herein being 0) |
18-19 | The magnetic region number of each track |
1A-1B | The magnetic head number |
1C-1F | Hide magnetic region number (not influencing the result) |
20-23 | 13-14 character place is 0 o'clock a magnetic region sum |
24-27 | The magnetic region sum |
28-29 | File System Ver (major) (be 0 get final product) |
2A-2B | File System Ver (minor) (be 0 get final product) |
2C-2D | File directory head bunch number (being 0x02000) |
2E-2F | The higher bit of file directory head bunch number |
30-31 | FSINFO Sector number (, then being 0xffff) if do not have |
32-33 | Backup Boot Sector (, then being 0xffff) if do not have |
34-3F | Keep |
40 | Phisical drive number (first is 0x80, and second is 0x81...) |
41 | Keep |
42 | The feature character (being 0 * 29) of expansion leader record |
43-46 | Disk sequence number (producing at random) |
47-51 | Label (totally 11 words) |
52-59 | File system type (being FAT32) |
The structure of [table two] FAT32
Long filenames directory entry (containing end mark) |
The long filenames directory entry |
...... |
...... |
...... |
The long filenames directory entry |
The short filename directory entry |
The configuration of [table three] length/short filename directory entry in FDT
Displacement | Length | Describe |
????00H | ????1BYTE | BIT0~5 are the position of directory entry with respect to short filename, and BIT6 is an end mark |
????01H | ????10BYTE | Sentence contains 5 characters of long filenames |
????0BH | ????1BYTE | Attribute, long filenames are 0FH |
????0CH | ????1BYTE | Keep |
????0DH | ????1BYTE | The short filename verification and |
????0EH | ????12BYTE | 6 characters that comprise long filenames |
????1AH | 1WORD (word group) | Keep (perseverance is 0) |
????1CH | ????4BYTE | 2 characters that comprise long filenames |
The form of [table four] long filenames directory entry
Displacement | Length | Describe |
????00H | ????8BYTE | The short filename part |
????08H | ????3BYTE | The extension filename part of short filename |
????0BH | ????1BYTE | File attribute |
????0CH | ????1WORD | Keep |
????0EH | ????1WORD | Last access date |
????10H | ????1WORD | Last update time |
????12H | ????1WORD | Last update date |
????14H | ????1WORD | The initial magnetic of FAT32 bunch high 2 |
????16H | ????1WORD | Last update time |
????18H | ????1WORD | Last update date |
????1AH | ????1WORD | Initial magnetic of FAT16 bunch or the initial magnetic of FAT32 bunch low 2 |
????1CH | ????1WORD | The size of file |
[]:1370:0460 42 4C 41 43 4B 54 7E 31-42 4D 50 20 00 0F 2B 6D BLACKT-1BMP..+m1370:0470 67 25 67 25 00 00 20 A0-AB 24 0D 00 B6 00 00 00 g%g%....S......1370:0480 42 6E 00 20 00 53 00 61-00 76 00 0F 00 6B 65 00 Bn..S.a.v...ke.1370:0490 72 00 2E 00 53 00 43 00-52 00 00 00 00 00 FF FF r...S.C.R.......1370:04A0 01 43 00 68 00 61 00 6E-00 6E 00 0F 00 6B 65 00 .C.h.a.n.n...ke.1370:04B0 6C 00 20 00 53 00 63 00-72 00 00 00 65 00 65 00 1..S.c.r...e.e.1370:04C0 43 48 41 4E 4E 45 7E 31-53 43 52 20 00 10 2B 6D CHANNE-1SCR..+m1370:04D0 67 25 67 25 00 00 20 A0-AB 24 0E 00 40 48 01 00 g%g%....S.. @ H..1370:04E0 42 2E 00 74 00 78 00 74-00 00 00 0F 00 D0 FF FF B..t..x.t........1370:04F0 FF FF FF FF FF FF FF FF-FF FF 00 00 FF FF FF FF ...............1370:0500 01 52 00 75 00 6E 00 4F-00 6E 00 0F 00 D0 63 00 .R.u.n.O.n....c.1370:0510 65 00 45 00 78 00 20 00-4C 00 00 00 6F 00 67 00 e.E.x..L...o.g.1370:0520 52 55 4E 4F 4E 43 7E 31-54 58 54 20 00 15 2B 6D RUNONC-1TXT..+m1370:0530 67 25 67 25 00 00 16 72-65 25 14 00 B3 45 00 00 g%g%...re%...E..1370:0540 42 69 00 66 00 00 00 FF-FF FF FF 0F 00 23 FF FF Bi.f..........#..1370:0550 FF FF FF FF FF FF FF FF-FF FF 00 00 FF FF FF FF ................ 1370:0560 01 45 00 78 00 69 00 74-00 20 00 0F 00 23 54 00 .E.x.i.l...#T.1370:0570 6F 00 20 00 44 00 6F 00-73 00 00 00 2E 00 70 00 o..D.o.s.....p1370:0580 45 58 49 54 54 4F 7E 31-50 49 46 20 00 1E 2B 6D EXITTO-1PIF..+m1370:0590 67 25 67 25 00 00 EC 49-66 25 16 00 C7 03 00 00 g%g%...If%......
This catalogue behind the Windows95 system destruction:
1370:0460?42?4C?41?43?4B?54?7E?31-42?4D?50?20?00?0F?2B?6D????BLACKT-1BMP..+m
1370:0470?67?25?67?25?00?00?20?A0-AB?24?0D?00?B6?00?00?00????g%g%....S......
1370:0480?43?48?41?4E?4E?45?7E?31-53?43?52?20?00?10?2B?6D????CHANNE-1SCR..+m
1370:0490?67?25?67?25?00?00?20?A0-AB?24?0E?00?40?48?01?00????g%g%....S..@H
1370:04A0?52?55?4E?4F?4E?43?7E?31-54?58?54?20?00?15?2B?6D????RUNONC-1TXT..+m
1370:04B0?67?25?67?25?00?00?16?72-65?25?14?00?B3?45?00?00????g%g%...re%...E..
1370:04C0?45?58?49?54?54?4F?7E?31-50?49?46?20?00?1E?2B?6D????EXITTO-1PIF..+m
1370:04D0?67?25?67?25?00?00?EC?49-66?25?16?00?C7?03?00?00????g%g%...If%......
Same catalogue after utilizing the present invention to recover
1370:0000?42?4C?41?43?4B?54?7E?31-42?4D?50?20?00?0F?2B?6D????BLACKT-1BMP..+m
1370:0010?67?25?67?25?00?00?20?A0-AB?24?0D?00?B6?00?00?00????g%g%....S......
1370:0020?42?6E?00?20?00?53?00?61-00?76?00?0F?00?6B?65?00????Bn..S.a.v...ke.
1370:0030?72?00?2E?00?53?00?43?00-52?00?00?00?00?00?FF?FF????r...S.C.R......
1370:0040?01?43?00?68?00?61?00?6E-00?6E?00?0F?00?6B?65?00????.C.h.a.n.n...ke.
1370:0050?6C?00?20?00?53?00?63?00-72?00?00?00?65?00?65?00????L.S.c.r...e.e.
1370:0060?43?48?4E?4E?45?45?7E?31-53?43?52?20?00?10?2B?6D????CHANNE-1SCR..+m
1370:0070?67?25?67?25?00?00?20?A0-AB?24?0E?00?40?48?01?00????g%g%....S..@H..
1370:0080?42?2E?00?74?00?78?00?74-00?00?00?0F?00?D0?FF?FF????B..t..x.t........
1370:0090?FF?FF?FF?FF?FF?FF?FF?FF-FF?FF?00?00?FF?FF?FF?FF??????...........
1370:00A0?01?52?00?75?00?6E?00?4F-00?6E?00?0F?00?D0?63?00????.R.u.n.O.n....c.
1370:00B0?65?00?45?00?78?00?20?00-4C?00?00?00?6F?00?67?00????e.E.x..L...o.g.
1370:00C0?52?55?4E?4F?4E?43?7E?31-54?58?54?20?00?15?2B?6D????RUNONC-1TXT..+m
1370:00D0?67?25?67?25?00?00?16?72-65?25?14?00?B3?45?00?00????g%g...re%...E..
1370:00E0?42?69?00?66?00?00?00?FF-FF?FF?FF?0F?00?23?FF?FF????Bi.f..........#..
1370:00F0?FF?FF?FF?FF?FF?FF?FF?FF-FF?FF?00?00?FF?FF?FF?FF??????................
1370:0100?01?45?00?78?00?69?00?74-00?00?00?0F?00?23?54?00????.E..x.i.t....#T.
1370:0110?6F?00?20?00?44?00?6F?00-73?00?00?00?2E?00?70?00????o..D.o.s.....p.
1370:0120?48?58?49?54?54?4F?7E?31-50?49?46?20?00?1E?2B?6D????EXITTO-1PIF..+m
1370:0130?67?25?67?25?00?00?EC?49-66?25?16?00?C7?00?00?00????g%g%...If%......
[table six]