CN103294784A - File packing method and system based on Hook technology - Google Patents

File packing method and system based on Hook technology Download PDF

Info

Publication number
CN103294784A
CN103294784A CN2013101839495A CN201310183949A CN103294784A CN 103294784 A CN103294784 A CN 103294784A CN 2013101839495 A CN2013101839495 A CN 2013101839495A CN 201310183949 A CN201310183949 A CN 201310183949A CN 103294784 A CN103294784 A CN 103294784A
Authority
CN
China
Prior art keywords
file
filename
apmb package
access sequence
sequence list
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN2013101839495A
Other languages
Chinese (zh)
Other versions
CN103294784B (en
Inventor
陈飞舟
吴才忠
刘畅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Xishanju Interactive Entertainment Technology Co Ltd
Zhuhai Kingsoft Digital Network Technology Co Ltd
Original Assignee
Zhuhai Kingsoft Online Game Technology Co Ltd
Chengdu Xishanju Interactive Entertainment Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhuhai Kingsoft Online Game Technology Co Ltd, Chengdu Xishanju Interactive Entertainment Technology Co Ltd filed Critical Zhuhai Kingsoft Online Game Technology Co Ltd
Priority to CN201310183949.5A priority Critical patent/CN103294784B/en
Publication of CN103294784A publication Critical patent/CN103294784A/en
Application granted granted Critical
Publication of CN103294784B publication Critical patent/CN103294784B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a file packing method and system based on a Hook technology. The file packing method includes steps of A), adopting the Hook technology to acquire an access sequence of packed files to acquire a file access sequence list; B), packing to-be-packed files according to the acquired file access sequence list and writing the to-be-packed files into the packed files. According to the method, files are packed according to the acquired file access sequence list, the access sequence of the acquired file access sequence list is the same or similar to that of the packed files when software is actually operated, two files closely related in the access sequence are arranged closely in the packed files, so that a magnetic head of a hard drive can access to the whole packed files in an approximate sequence, and access speed of the packed files is increased. The file packing method and system based on the Hook technology is widely applicable to the field of computer application.

Description

A kind of file packing method and system based on the Hook technology
Technical field
The present invention relates to computer application field, especially a kind of file packing method and system based on the Hook technology.
Background technology
Hook is hook again, is a platform of windows messaging treatment mechanism.Application program can arrange subroutine with certain message of supervision specified window on Hook, and its window that monitors can be created by other processes.After message arrived, application program can be handled Hook before target window is handled function.Therefore, Hook mechanism allows application program to intercept and capture and handles windows messaging or particular event.
In fact, Hook is the program segment of a processing messages, can hang in the system by system call.The Hook program is just caught this message earlier, thereby is made the preferential controlled power of Hook function before the message no show purpose window that system sends.At this moment, the Hook function both can have been processed and handle or change this message, also can not do any processing and continued to transmit this message, can also force to finish the transmission of this message.
The resource of existing software client adopts packing manner to store usually, thereby obtains that transmission is more convenient, resource is more secret and advantage such as access speed is faster.Yet in the process of file packing, traditional packing manner can't be closed the position of file in the pericardium and be read relation between the order.These two positions of file in APMB package that may cause the visit order relation is arranged originally are at a distance of distant, and it is bigger that hard disc magnetic head is jumped when reading APMB package, thereby increased the seek time and the access speed that has reduced APMB package of hard disk.
Summary of the invention
In order to solve the problems of the technologies described above, the objective of the invention is: provide a kind of based on Hook technology and the fast file packing method of access speed.
Another object of the present invention is: provide a kind of based on Hook technology and the fast file packaging system of access speed.
The technical solution adopted for the present invention to solve the technical problems is: a kind of file packing method based on the Hook technology comprises:
A, employing Hook technology are gathered the access order of file in wrapping, thereby are obtained the file access sequence list;
The file access sequence list that B, basis obtain is treated the file of packing and is packed, thereby file that will be to be packed is written in the APMB package.
Further, described steps A, it comprises:
A1, empty the file access sequence list;
A2, by the Hook technology, the File Open function is redirected to file sequence collection function in will wrap;
A3, working procedure client trigger the logic that reads of wrapping interior file, thereby the filename of file store in the file access sequence list in will wrapping into;
A4, described file sequence are gathered the interior File Open function of function call bag and are judged whether that file all is read in all bags, if then finish collection, thereby obtain storing the file access sequence list of filename; Otherwise, then re-execute steps A 3.
Further, described step B, it comprises:
B1, file and corresponding file access sequence list that will be to be packed be passed to strapping tool;
B2, described strapping tool read the filename in the file access sequence list;
B3, described strapping tool are inquired about in file to be packed, and check the file that whether has filename identical with the described filename that reads, if having, then read the content of this document, and the content that reads is stored to the end of APMB package, execution in step B4 then, otherwise, direct execution in step B4 then;
B4, judge whether that the All Files name in the file access sequence list all is read, if, execution in step B5 then, otherwise, then re-execute step B2;
B5, the file to be packed of remainder is write the end of APMB package, and generate the index area that is used for file in the visit bag, then the index area that generates is stored to the end of APMB package.
Further, after described step B, also be provided with step C, described step C, it is specially:
APMB package after the packing is upgraded, thereby will need the outer file of bag that increases newly and the interior file of bag that needs upgrade to store in the APMB package, and regenerate the index area of APMB package.
Further, after described step B, also be provided with step D, described step D, it is specially, and treat the APMB package of arrangement according to the file access sequence list that obtains and put in order, thus file and file in wrapping resequenced in the deletion bag that can't have access to.
Further, described step D, it comprises:
D1, finishing tool load APMB package to be put in order and corresponding file access sequence list;
D2, described finishing tool read the filename in the file access sequence list;
D3, described finishing tool are inquired about in APMB package index area to be put in order, check whether file in the filename bag identical with the described filename that reads is arranged, if have, then read the content of this document, and the file content that reads is stored to the end of new APMB package, execution in step D4 then, otherwise, direct execution in step D4 then;
D4, judge whether that the All Files name in the file access sequence list all is read, if, execution in step D5 then, otherwise, then re-execute step D2;
D5, will be to be put in order APMB package in the remaining bag file be stored to the end of new APMB package, and generate the index area that is used for file in the visit bag, then the index area that generates is stored to the end of new APMB package;
D6, deletion APMB package to be put in order also keep the new APMB package after the arrangement.
Further, the filename of a described file file by name or be used for the asterisk wildcard of expression file class.
The present invention solves another technical scheme that its technical matters adopts: a kind of file packaging system based on the Hook technology comprises:
Acquisition module is used for adopting the Hook technology that the access order of file in wrapping is gathered, thereby obtains the file access sequence list;
Packetization module pack for the file for the treatment of packing according to the file access sequence list that obtains, thereby file that will be to be packed is written in the APMB package;
The output terminal of described acquisition module is connected with the input end of packetization module.
Further, described acquisition module comprises:
Empty the unit, be used for emptying the file access sequence list;
Be redirected the unit, be used for by the Hook technology, the File Open function is redirected to file sequence collection function in will wrapping;
The filename record cell is used for the working procedure client, trigger the logic that reads of the interior file of bag, thereby the filename of file stores in the file access sequence list in will wrapping into;
Call and judging unit, be used for described file sequence and gather the interior File Open function of function call bag and judge whether that file all is read in all bags, if then end is gathered, thereby obtain storing the file access sequence list of filename; Otherwise, then go to the filename record cell again;
The described output terminal that empties the unit is successively by being redirected unit and filename record cell and then being connected with calling with the input end of judging unit.
Further, described packetization module comprises:
Uploading unit is passed to strapping tool for file and corresponding file access sequence list that will be to be packed;
The filename reading unit is used for the filename that described strapping tool reads the file access sequence list;
Query unit, being used for described strapping tool inquires about at file to be packed, check the file that whether has filename identical with the described filename that reads, if have, then read the content of this document, and the content that reads is stored to the end of APMB package, go to judging unit then, otherwise, then jump directly to judging unit;
Judging unit is used for judging whether that the All Files name of file access sequence list all is read, if, then go to writing unit, otherwise, then go to the filename reading unit again;
Writing unit is used for the file to be packed of remainder is write the end of APMB package, and generates the index area that is used for file in the visit bag, then the index area that generates is stored to the end of APMB package;
The input end of described uploading unit is connected with the output terminal of acquisition module, and the output terminal of described uploading unit is connected with judging unit and then with the input end of writing unit by filename reading unit, query unit successively.
The beneficial effect of method of the present invention is: method of the present invention is packed according to the file access sequence list of gathering, and the file access sequence list of gathering when move with actual software visit to wrap the order of interior file identical or close, can make two positions of file in APMB package of visit order relation nearer, thereby make hard disc magnetic head read mode travel all over APMB package with approximate order, promoted the access speed of APMB package.Further, method of the present invention also comprises carries out updating steps C to the APMB package after the packing, can upgrade or the outer file of newly-increased bag reasonable more and science according to actual needs to the content of file in wrapping.Further, method of the present invention also comprises the step D that the APMB package for the treatment of arrangement is put in order, can delete the interior file of invalid bag and make the distance of two files in APMB package of visit order relation more approaching, thereby further improve the access speed of APMB package.
The beneficial effect of system of the present invention is: packetization module is packed according to the file access sequence list of acquisition module collection in the system of the present invention, and the file access sequence list of gathering when move with actual software visit to wrap the order of interior file identical or close, can make two positions of file in APMB package of visit order relation nearer, thereby make hard disc magnetic head read mode travel all over APMB package with approximate order, promoted the access speed of APMB package.
Description of drawings
The invention will be further described below in conjunction with the drawings and specific embodiments.
Fig. 1 is the process flow diagram of a kind of file packing method based on the Hook technology of the present invention;
Fig. 2 is the process flow diagram of method step A of the present invention;
Fig. 3 is the process flow diagram of method step B of the present invention;
Fig. 4 is the present invention packing APMB package structural representation after finishing;
Fig. 5 is the process flow diagram after method of the present invention adds step C;
APMB package structural representation after Fig. 6 finishes for the present invention upgrades;
Fig. 7 is the process flow diagram after method of the present invention adds step D;
Fig. 8 is the process flow diagram of method step D of the present invention;
Fig. 9 is the present invention arrangement APMB package structural representation after finishing;
Figure 10 is the theory diagram of a kind of file packaging system based on the Hook technology of the present invention;
Figure 11 is the structured flowchart of systematic collection module of the present invention;
Figure 12 is the structured flowchart of system of the present invention packetization module.
Embodiment
With reference to Fig. 1, a kind of file packing method based on the Hook technology of the present invention comprises:
A, employing Hook technology are gathered the access order of file in wrapping, thereby are obtained the file access sequence list;
The file access sequence list that B, basis obtain is treated the file of packing and is packed, thereby file that will be to be packed is written in the APMB package.
Wherein, APMB package is the file bag of packing, having upgraded or put in order, is made up of file in one or more bags.For example, an APMB package G is arranged, comprise among the G that filename is respectively the interior file of these four bags of a, b, c and d, then the file of file e by name is the outer file of bag of G.The file access sequence list is made of tactic filename or relative path, near the access order of actual software to file in wrapping.Read for convenience, can in access file list, increase access sequence number this (in fact, access sequence number be not present in the file access sequence list) usually.For example, software reads and will read the file that file b.tga file by name and file are called c.ani behind the file of file a.mesh by name again, and the access sequence that then obtains is listed as follows shown in the table 1:
Table 1
Access sequence number Filename
1 a.mesh
2 b.tga
3 c.ani
In the table 1, access sequence number 1 corresponding file is to be read at first when the software actual access.
The access file list that obtains also can be used for carrying out the arrangement of APMB package except being used for packing.
With reference to Fig. 2, be further used as preferred embodiment, described steps A, it comprises:
A1, empty the file access sequence list;
A2, by the Hook technology, the File Open function is redirected to file sequence collection function in will wrap;
A3, working procedure client trigger the logic that reads of wrapping interior file, thereby the filename of file store in the file access sequence list in will wrapping into;
A4, described file sequence are gathered the interior File Open function of function call bag and are judged whether that file all is read in all bags, if then finish collection, thereby obtain storing the file access sequence list of filename; Otherwise, then re-execute steps A 3.
Wherein, the File Open function reads to wrap function for software commonly used in the bag, and the file sequence is gathered function and then only Duoed this function of log file name than the interior File Open function of bag.The file sequence is gathered function and is realized by the entry address of File Open function in the Hook interception bag usually.The File Open function is redirected to the file sequence to gather the purpose of function is to gather function with the file sequence to substitute the interior File Open function of former bag in will wrapping in the steps A 2.Steps A 3 and A4 all are in order can successfully the filename that wraps interior file to be recorded in the access file list.
Steps A 3 is that the filename of file stores the file access sequence list in will wrapping according to top-down order, namely earlier in the bag of the file of visit file be stored in the bag of file of back visit on the file.The file sequence is gathered function after storing into file spare name in the access file list, still can call File Open function in the bag, in order to continue the filename of subsequent file is gathered.
Gatherer process with table 1 access file list is example below, and the gatherer process of access file list is described:
At first, empty the file access sequence list, and File Open function in the former bag of HOOK, the HOOK program will be redirected to the file sequence to File Open function in the former bag gathers function.
Then, working procedure client, client three files of by name a.mesh, b.tga of access file and c.ani successively.Because former APMB package is opened function by Hook and be redirected to the collection function, so the file sequence is gathered the filename that function can obtain current institute access file.And be appended to the bottom of access sequence tabulation at the filename that will obtain after, capture program can call APMB package again and open function, make the normal operation of calling program and continue to gather follow-up filename, filename a.mesh, b.tga and c.ani add in the access file list in order the most at last, thereby obtain the access file list of table 1.
With reference to Fig. 3, be further used as preferred embodiment, described step B, it comprises:
B1, file and corresponding file access sequence list that will be to be packed be passed to strapping tool;
B2, described strapping tool read the filename in the file access sequence list;
B3, described strapping tool are inquired about in file to be packed, and check the file that whether has filename identical with the described filename that reads, if having, then read the content of this document, and the content that reads is stored to the end of APMB package, execution in step B4 then, otherwise, direct execution in step B4 then;
B4, judge whether that the All Files name in the file access sequence list all is read, if, execution in step B5 then, otherwise, then re-execute step B2;
B5, the file to be packed of remainder is write the end of APMB package, and generate the index area that is used for file in the visit bag, then the index area that generates is stored to the end of APMB package.
Wherein, corresponding file access sequence list is a kind of of the resulting file access sequence list of steps A, and it is specifically designed to packs to wrapping outer file (file namely to be packed).And since the file access sequence list according to top-down acquisition order, therefore the order of the APMB package after the packing also is top-down, namely the position of the file of packing in bag is positioned at above the file of packing the back earlier.So the end of APMB package refers to, the bottom position of APMB package.
Packing process is finished by strapping tool.At first, the filename with the outer file of bag imports strapping tool into corresponding file access sequence list.Then, strapping tool can read the content of the outer file of bag successively according to the filename in the file access sequence list, and to be written into APMB package interior (be step B1~B4).After if all files corresponding with the filename in the file sequence list all are written in the APMB package, also have the outer file of unnecessary bag not to be written in the APMB package, then the file appending that strapping tool can be unnecessary with these is to the end of APMB package, and need not to be concerned about the position (be step B6) of these files in bag.
For example, if five files having filename to be respectively a.mesh, a.bone, b.tga, c.tga and c.ani need pack, and corresponding access file list is table 1 during packing, and then Da Bao process is as follows:
At first, strapping tool receives file to be packed (being these five files of file a.mesh, a.bone, b.tga, c.tga and c.ani by name) and corresponding file access sequence list (i.e. table 1).
Then, strapping tool reads first filename a.mesh in the table 1.
Follow again, strapping tool inquires the file existence of file a.mesh by name in file to be packed after, the content of this document is appended to the end of APMB package.
Then, strapping tool reads second filename b.tga again from table 1, and the file of finding file b.tga by name in file to be packed when inquiring about also exists, this moment, strapping tool still can read the content of the file of file b.tga by name, and it is appended to the end (namely being appended to file following of file a.mesh by name) of APMB package.
Then, strapping tool reads the 3rd filename c.mesh again from table 1.But the file of finding file c.mesh by name in file to be packed when inquiring about does not exist, this moment strapping tool what do not do, so far All Files name corresponding file reads and finishes in the table 1, also has this moment three files to be packed of file a.bone, c.tga by name and c.ani not to be written in the APMB package.Therefore, strapping tool can be appended to these three files the end of APMB package with any order.
At last, strapping tool can generate the index area, and the end that writes APMB package that will generate, thereby obtains the APMB package of structure (a three-dimensional square represents file in the bag among the figure) as shown in Figure 4.The index area comprises essential informations such as filename, document misregistration value and file size.
With reference to Fig. 5, be further used as preferred embodiment, after described step B, also be provided with step C, described step C, it is specially:
APMB package after the packing is upgraded, thereby will need the outer file of bag that increases newly and the interior file of bag that needs upgrade to store in the APMB package, and regenerate the index area of APMB package.
Wherein, the APMB package after the packing refers to the APMB package that obtained by step B.
The outer file of bag that the renewal process of step C can increase needs newly and the file appending that needs the to upgrade end to APMB package, and regenerate the index area.Renewal process is by the refresh routine load, and the original copy of file (being file in the former bag) still can be retained in the APMB package in the bag after upgrading, and just the index area owing to APMB package is changed and can't has access to forever.In addition, the renewal process of step C and packing process or arrangement process are different, and it can be according to position or the order of file in APMB package in the file access sequence list adjustment bag of gathering.
The renewal process of step C is as follows:
1) in refresh routine, imports the APMB package that needs renewal into;
2) in refresh routine, import file in the bag that needs to upgrade into;
3) in the bag that needs are upgraded file appending to the end of APMB package;
4) search successively in the index area of APMB package whether file exists in the bag that needs to upgrade,
If find that this file is present in the index area, then revise the index of this file, it is pointed to upgrade the position of file in bag, back; If find that this file not in the index area, then adds information such as this file name, document location and file size in the index area to.
For example, five files of include file a.mesh, a.bone, b.tga, c.tga and c.ani by name in the APMB package that has existed, its structure is as shown in Figure 4.If need the file of the outer file of newly-increased bag d.tga by name, the file of file b.tga by name in the bag that needs to upgrade.Then its process of upgrading is as follows:
At first, refresh routine loads the APMB package that has existed.
Then, refresh routine reads the file of file d.tga by name, and after its content appended to the APMB package that has existed.
Afterwards, refresh routine file whether Already in the APMB package in the bag of index area inquiry file d.tga by name.Owing in the index area, do not find the file of file d.tga by name, so refresh routine can write current off-set value, filename and the document size information of file of file d.tga by name in the index area.
Then, refresh routine reads the file of file b.tga by name, and after its content appended to the APMB package that has existed.
Follow, Already in whether refresh routine at the file of index area inquiry file b.tga by name in the APMB package again.Owing to the file that in the index area, can find file b.tga by name, so the index of the file of refresh routine meeting revised file b.tga by name, make its position of pointing to new b.tga file (position after namely adding).APMB package structure after the final updated as shown in Figure 6.
With reference to Fig. 7, be further used as preferred embodiment, after described step B, also be provided with step D, described step D, it is specially, treat the APMB package of arrangement according to the file access sequence list that obtains and put in order, thus file and file in wrapping resequenced in the deletion bag that can't have access to.
Wherein, the file access sequence list that obtains both can be the file access sequence list of gathering again, access file list that also can (being step B) uses when packing before.
In this arrangement process of step D, the at first loading APMB package to be put in order that collates program, and successively respective file is written in the new APMB package according to the filename in the access sequence tabulation.And exist for index area in the former APMB package but do not appear at file in the file access sequence list, the end (being the bottom position of new APMB package) of collating program and can simply its content be appended to new APMB package, and need not to be concerned about its order.After the All Files arrangement is finished, collate program former APMB package deletion, and only keep new APMB package.This new APMB package is compared with former APMB package, and access speed is faster, visits more efficient.
With reference to Fig. 8, be further used as preferred embodiment, described step D, it comprises:
D1, finishing tool load APMB package to be put in order and corresponding file access sequence list;
D2, described finishing tool read a filename in the file access sequence list;
D3, described finishing tool are inquired about in APMB package index area to be put in order, check whether file in the filename bag identical with the described filename that reads is arranged, if have, then read the content of this document, and be appended to execution in step D4 behind the end of new APMB package at the file content that will read, otherwise, direct execution in step D4 then;
D4, judge whether that the All Files name in the file access sequence list all is read, if, execution in step D5 then, otherwise, then re-execute step D2;
D5, will be to be put in order APMB package in the remaining bag file write the end of new APMB package, and after generating the index area that is used for file in the visit bag, the index area of generation is appended to the end of new APMB package;
D6, deletion APMB package to be put in order also keep the new APMB package after the arrangement.
Wherein, corresponding file access sequence list both can be new file access sequence list of gathering, the file access sequence list of using in the time of also can packing for step B.And since the file access sequence list according to top-down acquisition order, therefore the order of the APMB package after the arrangement also is top-down, namely the position of file in bag of storage earlier is positioned at above the file of storing the back when arrangement.So the end of new APMB package refers to, the bottom position of new APMB package.
Arrangement process similar with packing process, difference is that packing process can keep file former to be packed, the arrangement process then can be deleted file former to be put in order.
The arrangement process not only can be adjusted the position of file in the bag again and generate new index area, but also can remove the file that those can't have access to, and can further save resource and improve access speed.
For example, the structure of APMB package to be put in order as shown in Figure 6, APMB package namely to be put in order is the APMB package after upgrading.Have two filenames to be b.tga among the figure, the file that is positioned under the a.mesh can't be visited, and the file that is positioned under the c.tga then can have access to.If this moment is as shown in table 2 below through the new file access sequence list that steps A obtains:
Table 2
Figure 2013101839495100002DEST_PATH_IMAGE002
Then the APMB package structure that obtains behind process step D1~D6 as shown in Figure 9, can see that the arrangement process not only adjusted the order (namely having adjusted the position of file in the bag) of file in the bag according to table 2, and the file of that file that can't visit b.tga by name has been deleted.
Be further used as preferred embodiment, described file is called the filename of a file or is used for the asterisk wildcard of expression file class.
Comprise one or more filenames in the file access sequence list.Filename both can be the filename (as shown in table 1) of a file, also can be the asterisk wildcard for the expression file class.For example, if can visit again two files of file a.tga by name and a.ani behind the file of access file a.mesh by name, and can visit again two files of file b.tga by name and b.ani behind the file of access file b.mesh by name, then can represent above-mentioned two group access sequences with asterisk wildcard, thereby obtain file access sequence list as shown in table 3:
Table 3
Access sequence number Filename
1 *.mesh
2 {1}.tga
3 {1}.ani
In the table 3, * .mesh, { 1}.tga and { 1}.ani is the asterisk wildcard of representation file type.
With reference to Figure 10, a kind of file packaging system based on the Hook technology of the present invention comprises:
Acquisition module is used for adopting the Hook technology that the access order of file in wrapping is gathered, thereby obtains the file access sequence list;
Packetization module pack for the file for the treatment of packing according to the file access sequence list that obtains, thereby file that will be to be packed is written in the APMB package;
The output terminal of described acquisition module is connected with the input end of packetization module.
With reference to Figure 11, be further used as preferred embodiment, described acquisition module comprises:
Empty the unit, be used for emptying the file access sequence list;
Be redirected the unit, be used for by the Hook technology, the File Open function is redirected to file sequence collection function in will wrapping;
The filename record cell is used for the working procedure client, trigger the logic that reads of the interior file of bag, thereby the filename of file stores in the file access sequence list in will wrapping into;
Call and judging unit, be used for described file sequence and gather the interior File Open function of function call bag and judge whether that file all is read in all bags, if then end is gathered, thereby obtain storing the file access sequence list of filename; Otherwise, then go to the filename record cell again;
The described output terminal that empties the unit is successively by being redirected unit and filename record cell and then being connected with calling with the input end of judging unit.
With reference to Figure 12, be further used as preferred embodiment, described packetization module comprises:
Uploading unit is passed to strapping tool for file and corresponding file access sequence list that will be to be packed;
The filename reading unit is used for the filename that described strapping tool reads the file access sequence list;
Query unit, being used for described strapping tool inquires about at file to be packed, check the file that whether has filename identical with the described filename that reads, if have, then read the content of this document, and the content that reads is stored to the end of APMB package, go to judging unit then, otherwise, then jump directly to judging unit;
Judging unit is used for judging whether that the All Files name of file access sequence list all is read, if, then go to writing unit, otherwise, then go to the filename reading unit again;
Writing unit is used for the file to be packed of remainder is write the end of APMB package, and generates the index area that is used for file in the visit bag, then the index area that generates is stored to the end of APMB package;
The input end of described uploading unit is connected with the output terminal of acquisition module, and the output terminal of described uploading unit is connected with judging unit and then with the input end of writing unit by filename reading unit, query unit successively.
More than be that preferable enforcement of the present invention is specified, but the invention is not limited to described embodiment, those of ordinary skill in the art make all equivalent variations or replacement also can doing under the prerequisite of spirit of the present invention, the distortion that these are equal to or replace all is included in the application's claim institute restricted portion.

Claims (10)

1. file packing method based on the Hook technology is characterized in that comprising:
A, employing Hook technology are gathered the access order of file in wrapping, thereby are obtained the file access sequence list;
The file access sequence list that B, basis obtain is treated the file of packing and is packed, thereby file that will be to be packed is written in the APMB package.
2. a kind of file packing method based on the Hook technology according to claim 1 is characterized in that: described steps A, and it comprises:
A1, empty the file access sequence list;
A2, by the Hook technology, the File Open function is redirected to file sequence collection function in will wrap;
A3, working procedure client trigger the logic that reads of wrapping interior file, thereby the filename of file store in the file access sequence list in will wrapping into;
A4, described file sequence are gathered the interior File Open function of function call bag and are judged whether that file all is read in all bags, if then finish collection, thereby obtain storing the file access sequence list of filename; Otherwise, then re-execute steps A 3.
3. a kind of file packing method based on the Hook technology according to claim 1 is characterized in that: described step B, and it comprises:
B1, file and corresponding file access sequence list that will be to be packed be passed to strapping tool;
B2, described strapping tool read the filename in the file access sequence list;
B3, described strapping tool are inquired about in file to be packed, and check the file that whether has filename identical with the described filename that reads, if having, then read the content of this document, and the content that reads is stored to the end of APMB package, execution in step B4 then, otherwise, direct execution in step B4 then;
B4, judge whether that the All Files name in the file access sequence list all is read, if, execution in step B5 then, otherwise, then re-execute step B2;
B5, the file to be packed of remainder is write the end of APMB package, and generate the index area that is used for file in the visit bag, then the index area that generates is stored to the end of APMB package.
4. a kind of file packing method based on the Hook technology according to claim 1 is characterized in that: after described step B, also be provided with step C, and described step C, it is specially:
APMB package after the packing is upgraded, thereby will need the outer file of bag that increases newly and the interior file of bag that needs upgrade to store in the APMB package, and regenerate the index area of APMB package.
5. a kind of file packing method based on the Hook technology according to claim 1, it is characterized in that: after described step B, also be provided with step D, described step D, it is specially, treat the APMB package of arrangement according to the file access sequence list that obtains and put in order, thus file and file in wrapping resequenced in the deletion bag that can't have access to.
6. a kind of file packing method based on the Hook technology according to claim 5 is characterized in that: described step D, and it comprises:
D1, finishing tool load APMB package to be put in order and corresponding file access sequence list;
D2, described finishing tool read the filename in the file access sequence list;
D3, described finishing tool are inquired about in APMB package index area to be put in order, check whether file in the filename bag identical with the described filename that reads is arranged, if have, then read the content of this document, and the file content that reads is stored to the end of new APMB package, execution in step D4 then, otherwise, direct execution in step D4 then;
D4, judge whether that the All Files name in the file access sequence list all is read, if, execution in step D5 then, otherwise, then re-execute step D2;
D5, will be to be put in order APMB package in the remaining bag file be stored to the end of new APMB package, and generate the index area that is used for file in the visit bag, then the index area that generates is stored to the end of new APMB package;
D6, deletion APMB package to be put in order also keep the new APMB package after the arrangement.
7. according to claim 2 or 3 or 6 described a kind of file packing methods based on the Hook technology, it is characterized in that: described file is called the filename of a file or is used for the asterisk wildcard of expression file class.
8. file packaging system based on the Hook technology is characterized in that comprising:
Acquisition module is used for adopting the Hook technology that the access order of file in wrapping is gathered, thereby obtains the file access sequence list;
Packetization module pack for the file for the treatment of packing according to the file access sequence list that obtains, thereby file that will be to be packed is written in the APMB package;
The output terminal of described acquisition module is connected with the input end of packetization module.
9. a kind of file packaging system based on the Hook technology according to claim 8, it is characterized in that: described acquisition module comprises:
Empty the unit, be used for emptying the file access sequence list;
Be redirected the unit, be used for by the Hook technology, the File Open function is redirected to file sequence collection function in will wrapping;
The filename record cell is used for the working procedure client, trigger the logic that reads of the interior file of bag, thereby the filename of file stores in the file access sequence list in will wrapping into;
Call and judging unit, be used for described file sequence and gather the interior File Open function of function call bag and judge whether that file all is read in all bags, if then end is gathered, thereby obtain storing the file access sequence list of filename; Otherwise, then go to the filename record cell again;
The described output terminal that empties the unit is successively by being redirected unit and filename record cell and then being connected with calling with the input end of judging unit.
10. a kind of file packaging system based on the Hook technology according to claim 8, it is characterized in that: described packetization module comprises:
Uploading unit is passed to strapping tool for file and corresponding file access sequence list that will be to be packed;
The filename reading unit is used for the filename that described strapping tool reads the file access sequence list;
Query unit, being used for described strapping tool inquires about at file to be packed, check the file that whether has filename identical with the described filename that reads, if have, then read the content of this document, and the content that reads is stored to the end of APMB package, go to judging unit then, otherwise, then jump directly to judging unit;
Judging unit is used for judging whether that the All Files name of file access sequence list all is read, if, then go to writing unit, otherwise, then go to the filename reading unit again;
Writing unit is used for the file to be packed of remainder is write the end of APMB package, and generates the index area that is used for file in the visit bag, then the index area that generates is stored to the end of APMB package;
The input end of described uploading unit is connected with the output terminal of acquisition module, and the output terminal of described uploading unit is connected with judging unit and then with the input end of writing unit by filename reading unit, query unit successively.
CN201310183949.5A 2013-05-17 2013-05-17 A kind of file packing method based on Hook technology and system Active CN103294784B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310183949.5A CN103294784B (en) 2013-05-17 2013-05-17 A kind of file packing method based on Hook technology and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310183949.5A CN103294784B (en) 2013-05-17 2013-05-17 A kind of file packing method based on Hook technology and system

Publications (2)

Publication Number Publication Date
CN103294784A true CN103294784A (en) 2013-09-11
CN103294784B CN103294784B (en) 2016-08-24

Family

ID=49095646

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310183949.5A Active CN103294784B (en) 2013-05-17 2013-05-17 A kind of file packing method based on Hook technology and system

Country Status (1)

Country Link
CN (1) CN103294784B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101382948A (en) * 2008-10-14 2009-03-11 成都市华为赛门铁克科技有限公司 File memory method, apparatus and system
CN101626391A (en) * 2008-07-08 2010-01-13 盛大计算机(上海)有限公司 Method for processing resource of network game client
CN101763436A (en) * 2010-02-08 2010-06-30 深圳市茁壮网络股份有限公司 File packing method and tool

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101626391A (en) * 2008-07-08 2010-01-13 盛大计算机(上海)有限公司 Method for processing resource of network game client
CN101382948A (en) * 2008-10-14 2009-03-11 成都市华为赛门铁克科技有限公司 File memory method, apparatus and system
CN101763436A (en) * 2010-02-08 2010-06-30 深圳市茁壮网络股份有限公司 File packing method and tool

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
贺细平等: "WindowsHooks中录制与回放钩子的运行机制剖析", 《电脑与信息技术》 *

Also Published As

Publication number Publication date
CN103294784B (en) 2016-08-24

Similar Documents

Publication Publication Date Title
US9575976B2 (en) Methods and apparatuses to optimize updates in a file system based on birth time
US9529808B1 (en) Efficient and flexible organization and management of file metadata
US8108446B1 (en) Methods and systems for managing deduplicated data using unilateral referencing
US9736270B2 (en) Automated client/server operation partitioning
KR101356470B1 (en) Flash file system
CN103109293B (en) A kind of user behavior processing system and method
US10642530B2 (en) Global occupancy aggregator for global garbage collection scheduling
CN109710668B (en) Multi-source heterogeneous data access middleware construction method
CN102880671A (en) Method for actively deleting repeated data of distributed file system
JP2018538600A (en) Signature-based cache optimization for data preparation
CN109582215A (en) Execution method, hard disk and the storage medium of hard disk operation order
CN102402622A (en) Memory page managing and scheduling method for embedded memory database
CN103049393B (en) Memory headroom management method and device
CN102147723A (en) Method and system for generating software packages
EP3224742A1 (en) Efficient data manipulation support
US7454436B2 (en) Generational global name table
CN103500206A (en) Storage method and device based on file storage data
CN103019956B (en) A kind of to data cached method of operating and device
CN1687899A (en) Method, system and module for dynamic downloading of applied programe to user identification
CN102331920B (en) Data processing method and device
US10621158B2 (en) Transaction log tracking
US20170046183A1 (en) Method for Hard Disk to Execute Application Code and Apparatus
CN103294784A (en) File packing method and system based on Hook technology
US9646014B1 (en) Systems and methods for selective defragmentation
CN110110034A (en) A kind of RDF data management method, device and storage medium based on figure

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CP03 Change of name, title or address

Address after: 519000 Room 102, 202, 302 and 402, No. 325, Qiandao Ring Road, Tangjiawan Town, high tech Zone, Zhuhai City, Guangdong Province, Room 102 and 202, No. 327 and Room 302, No. 329

Patentee after: Zhuhai Jinshan Digital Network Technology Co.,Ltd.

Patentee after: CHENGDU XISHANJU INTERACTIVE ENTERTAINMENT TECHNOLOGY Co.,Ltd.

Address before: 519000 Jinshan software building, 8 Lanshan lane, Jida Jingshan Hill Road, Zhuhai, Guangdong

Patentee before: ZHUHAI KINGSOFT ONLINE GAME TECHNOLOGY Co.,Ltd.

Patentee before: CHENGDU XISHANJU INTERACTIVE ENTERTAINMENT TECHNOLOGY Co.,Ltd.

CP03 Change of name, title or address