CN103218241A - Method and device for patch loading - Google Patents

Method and device for patch loading Download PDF

Info

Publication number
CN103218241A
CN103218241A CN2013101373194A CN201310137319A CN103218241A CN 103218241 A CN103218241 A CN 103218241A CN 2013101373194 A CN2013101373194 A CN 2013101373194A CN 201310137319 A CN201310137319 A CN 201310137319A CN 103218241 A CN103218241 A CN 103218241A
Authority
CN
China
Prior art keywords
dynamic load
load library
address
patch
patch file
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
CN2013101373194A
Other languages
Chinese (zh)
Other versions
CN103218241B (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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201310137319.4A priority Critical patent/CN103218241B/en
Publication of CN103218241A publication Critical patent/CN103218241A/en
Application granted granted Critical
Publication of CN103218241B publication Critical patent/CN103218241B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a method and a device for patch loading. The method for the patch loading comprises the following steps: loading a patch file to a patch area in a first dynamic loading library; determining the address of the patch file in the first process, according to the relative address of the patch file in the first dynamic loading library and the address of the first dynamic loading library in a first process, ,wherein the first process is the process loading the first dynamic loading library; and running the patch file according to the address of the patch file in the first process. According to the method and the device for the patch loading, a plurality of orders of the dynamic loading library to be modified are not need to be modified to enable the process to jump from a position to be modified, correct content of the patch file can be run, running crack of the process caused by the plurality of orders in the dynamic loading library waiting for being modified is avoided, and reliability of the patch loading is improved.

Description

Patch loading method and device
Technical field
The embodiment of the invention relates to computer realm, relates in particular to a kind of patch loading method and device.
Background technology
In modern work life, can high efficiency help people finish various tasks by the application program on the computer equipment.Application program is installed on the computer equipment after by artificial compiling and moves, but artificial coding can not be perfect in every way, certain defective can appear during operation, then can write and be used to repair the program of this defective as patch, when moving this application program, process loads patch, but with the trouble-free operation of assurance process.
In the prior art, dynamic load library as system file can be loaded when process is moved at random, when having defective in the dynamic load library, write mistake as a function in the dynamic load library, then process also need load the patch of dynamic load library, and be that correct function in the patch is pointed in jump instruction with the modifying of order of error functions porch, guarantee the true(-)running of process.
But when adopting said method to load patch, dynamic load library and patch file load with process, if the patch file of dynamic load library correspondence to be revised is far away with dynamic load library the to be revised address distance in process, many former instructions in the dynamic load library then to be revised need be revised as jump instruction, to finish the redirect of function, but many former instructions are modified and easily cause process operation collapse, have reduced the reliability that patch loads.
Summary of the invention
The embodiment of the invention provides a kind of patch loading method and device, to optimize the patch loading procedure, improves the reliability that patch loads.
First aspect, the embodiment of the invention provide a kind of patch loading method, comprising:
Patch file is loaded on patch area in first dynamic load library;
According to relative address and described first dynamic load library the address in first process of described patch file in described first dynamic load library, determine the address of described patch file in described first process; Wherein, described first process is for loading the process of described first dynamic load library;
Move described patch file according to the address of described patch file in described first process.
In conjunction with first aspect, in first implementation, the dynamic load library to be revised that described first dynamic load library provides for the provider of file destination; Wherein, described file destination is used to generate described patch file; Perhaps,
Described first dynamic load library and the address of dynamic load library in described process described to be revised are adjacent.
In conjunction with first implementation of first aspect or first aspect, in second implementation, the code segment of described patch area and described first dynamic load library is adjacent.
In conjunction with first aspect any one mode to first aspect second implementation, in the 3rd implementation, described according to relative address in described patch file and the described dynamic load library and described dynamic load library the address in described first process, determine also to comprise before the address of described patch file in described first process:
Described first dynamic load library that loads described patch file is loaded in a plurality of processes.
In conjunction with first aspect any one mode to first aspect second implementation, in the 4th implementation, described patch file is loaded on before the patch area in first dynamic load library, also comprise:
Determine the information substitution table according to the character that described file destination comprises;
According to the code segment and the data segment of described file destination, described information substitution table and dynamic load library dependence information generate described patch file.
In conjunction with first aspect, in the 5th implementation, the relative address of described patch file in described first dynamic load library is specially the correct relative address of character in described first dynamic load library in the patch file, and the address of described first dynamic load library in described first process is specially waits to revise the start address of character in first process in described first dynamic load library;
Then describedly determine the address of described patch file in described process, comprising according to the relative address and the address of described first dynamic load library in described first process of described patch file in described first dynamic load library:
When described correct character corresponding in the dynamic load library described to be revised wait to revise character the time, according to correct relative address and described first dynamic load library the start address in first process of character in described first dynamic load library in the described patch file, obtain the correct actual address of character in described first process in the described patch file;
When described correct character during corresponding to the character in the non-described dynamic load library to be revised, call the demonstration loading interface according to described dynamic record storehouse dependence information, obtain the correct actual address of character in described first process in the described patch file.
Second aspect, the embodiment of the invention provide a kind of patch charger, it is characterized in that, comprising:
First load-on module is used for patch file is loaded on the patch area of first dynamic load library;
Determination module is used for determining the address of described patch file in described first process according to the relative address and the address of described first dynamic load library in first process of described patch file in described first dynamic load library; Wherein, described first process is for loading the process of described first dynamic load library;
The operation module is used for moving described patch file according to described patch file in the address of described first process.
In conjunction with second aspect, in first implementation, the dynamic load library to be revised that described first dynamic load library provides for the provider of described file destination; Wherein, described file destination is used to generate described patch file; Perhaps,
Described first dynamic load library and the address of dynamic load library in described process described to be revised are adjacent.
In conjunction with second aspect or second aspect first implementation, in second implementation, the code segment of described patch area and described first dynamic load library is adjacent.
,, in the 3rd implementation, also comprise to second aspect second implementation in conjunction with second aspect:
Second load-on module, described first dynamic load library that is used for loading described patch file is loaded on a plurality of processes.
,, in the 4th implementation, also comprise to second aspect second implementation in conjunction with second aspect:
Generation module is used for determining the information substitution table according to the character that described file destination comprises;
Also be used for code segment and data segment according to described file destination, described information substitution table and dynamic load library dependence information generate described patch file.
In conjunction with second aspect, in the 5th implementation, the relative address of described patch file in described first dynamic load library is specially the correct relative address of character in described first dynamic load library in the described patch file, and the address of described first dynamic load library in described first process is specially the start address of described first dynamic load library in first process;
When described correct character corresponding in the dynamic load library described to be revised wait to revise character the time, described determination module specifically be used for according to correct character in the described patch file in described first dynamic load library relative address and described first dynamic load library in wait to revise the start address of character in first process, obtain the correct actual address of character in described first process in the described patch file;
When described correct character during corresponding to the character in the non-described dynamic load library to be revised, described determination module also is used for calling the demonstration loading interface according to described dynamic record storehouse dependence information, obtains the correct actual address of character in described first process in the described patch file.
In the present embodiment, because patch area is arranged in first dynamic load library, then patch file can be loaded on dynamic load library to be revised in the process, then need not revise many instructions in the dynamic load library to be revised just can make process jump to patch area to read patch file, avoid revising many process operation collapses that instruction causes in the dynamic load library to be revised, improved the reliability that patch loads.
Description of drawings
In order to be illustrated more clearly in the embodiment of the invention or technical scheme of the prior art, to do one to the accompanying drawing of required use in embodiment or the description of the Prior Art below introduces simply, apparently, accompanying drawing in describing below is some embodiments of the present invention, for those of ordinary skills, under the prerequisite of not paying creative work, can also obtain other accompanying drawing according to these accompanying drawings.
Fig. 1 is the process flow diagram of patch loading method embodiment one of the present invention;
Fig. 2 is the process flow diagram of patch loading method embodiment two of the present invention;
Fig. 3 is the embodiment of the invention two in-process first kind of patch area position view;
Fig. 4 is the embodiment of the invention two in-process second kind of patch area position view;
Fig. 5 is the structural representation of patch charger embodiment one of the present invention;
Fig. 6 is the structural representation of patch charger embodiment two of the present invention.
Embodiment
For the purpose, technical scheme and the advantage that make the embodiment of the invention clearer, below in conjunction with the accompanying drawing in the embodiment of the invention, technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that is obtained under the creative work prerequisite.
Fig. 1 is the process flow diagram of patch loading method embodiment one of the present invention.As shown in Figure 1, in the embodiment of the invention, the executive agent of carrying out the patch loading method can be the various communication facilitiess in the communication system, for example: PC(personal computer, personal computer), the patch charger in the terminal device such as server.This method comprises:
S101 is loaded on patch area in first dynamic load library with patch file.
When having defective in the dynamic load library, write mistake as a function in the dynamic load library, the patch file that then comprises correct function can be revised the dynamic load library that has defective.Wherein, correct function is compiled in the file destination, but again file destination is handled the patch file of generation corrective pitting.
When the identical situation in the making side of the making side of file destination and dynamic load library to be revised, file destination translator and compiler can leave certain space in this dynamic load library when making any dynamic load library, be used for when finding that defective appears in this dynamic load library, patch file can be loaded in this space, promptly first dynamic load library described in the S101 is the dynamic load library to be revised that the provider of file destination provides in the case, comprises data segment, code segment in this first dynamic load library and is used to load the patch area of patch file; Perhaps, when the different situation in the making side of the making side of file destination and dynamic load library to be revised, for example a dynamic load library is provided by the first making side, and when this dynamic load library of compiling, do not reserve certain space usually, and the second making side has found defective when using this dynamic load library, second making side's build targets is used to revise this defective, generate patch file according to file destination, and patch file is loaded in the independently dynamic load library that one second making side provides, this independently dynamic load library can be used as first dynamic load library, but only comprise patch area in this first dynamic load library, first dynamic load library described in the S101 is adjacent with the address of dynamic load library in process to be revised in the case.
S102 according to relative address and first dynamic load library the address in first process of patch file in first dynamic load library, determines the address of patch file in first process.
Above-mentioned first process can be regarded as any process that has loaded this dynamic load library in practice for loading the process of first dynamic load library; And for a dynamic load library that is not loaded in any process, each the bar instruction that compiles this dynamic load library is positioned at each row of this dynamic load library successively, can be understood as, the position that each row instruction is arranged in this dynamic load library is relative address, to be arranged in this dynamic load library first capable instruction is example, its relative address is designated as 0000 with 16 systems, when this dynamic load library is loaded in the process, and the space that loads is that address 4000 to the address 40FF(F in the process represents 15 in 16 systems counting), the address of instruction in process of then above-mentioned first row is 4000, the actual address of instruction in process that address 4000 can be regarded as above-mentioned first row, then patch file is loaded on patch area, and be loaded in first process with this first dynamic load library, for this patch file can be moved by process, then the patch charger also needs to carry out reorientation to determine the actual address of the correct character of process according to the correct character that is used for corrective pitting in the patch file.
When dynamic load library to be revised that above-mentioned first dynamic load library provides for the provider of file destination, correct character is in the relative address 0060 of first dynamic load library, and dynamic load library the to be revised initial actual address 4000 in process, then determine the correct actual address 4060 of character in process in the patch file;
When first dynamic load library and the address of dynamic load library in process to be revised adjacent, and known correct character is in the relative address 0060 of first dynamic load library, dynamic load library to be revised occupation space address in process is 4000 to 5FFF, because first dynamic load library is adjacent with the address of dynamic load library in process to be revised, then first dynamic load library occupation space start address in process is 6000, thereby can determine that the actual address of correct character in process is 6060.Hence one can see that, according to the relative address and the actual address of first dynamic load library in process of correct character in the patch file, can treat in dynamic load library to be revised that just Corrections Division provides the jump instruction of pointing to the actual address of correct character in the patch file.
S103 is according to the address operation patch file of patch file in first process.
Specifically the error functions that is used for revising dynamic load library with patch file is an example, when patch file is loaded on the patch area of dynamic load library to be revised of the process of being arranged in, the jump instruction of error functions porch jumps to the correct character at correct function entrance place in the patch file in the process basis dynamic load library to be revised, and according to each instruction operation successively in the correct function.
In the present embodiment, because patch area can be adjacent with the code segment in the dynamic load library to be revised, or it is adjacent with dynamic load library to be revised as first dynamic load library of patch area, after thereby process is loaded on patch area adjacent with code segment in the dynamic load library to be revised in the process or first dynamic load library adjacent with dynamic load library to be revised with patch file, many the instructions of then can not need revising in the dynamic load library to be revised just can make process jump to the interior correct content of patch area operation patch file, avoid revising many process operation collapses that instruction causes in the dynamic load library to be revised, improved the reliability that patch loads.
Fig. 2 is the process flow diagram of patch loading method embodiment two of the present invention.As shown in Figure 2, this method comprises:
S201, evaluating objects file and dynamic load library to be revised.
S202 determines the information substitution table according to the character that file destination comprises.
Above-mentioned S202 and following S203 can be carried out by the third party who makes patch file, also can carry out by the patch charger of integrated making patch file function, in addition if the patch file that dynamic load library need load has been finished making, directly begin when then dynamic load library loads patch file by S204, if patch file is for finishing making, then when realizing that loading can be revised the patch file of waiting to revise defective in the dynamic load library, then begin to carry out by the S201 place.Be example with the patch charger in the present embodiment, then the making side evaluating objects file of patch charger and dynamic load library to be revised, the defective of dynamic load library wherein to be revised is example with the error functions, because the title of the correct function of expression is consistent with the error functions title in the file destination, be file destination and have defective, possesses relevance between the dynamic load library to be revised, then the patch charger can be known the error functions in the corresponding dynamic load library of replacing of correct function in this file destination, thereby the patch charger can be determined relevant load information, should comprise the information substitution table by relevant load information, dynamic load library relies on information table etc., then patch charger and according to data segment and the code segment and the relevant load information generation patch file of file destination.
Concrete, defective in the dynamic load library to be revised is an example with the character of assignment mistake, in file destination, wait to revise character consistent (all being k) in correct character and the dynamic load library to be revised, but the correct assignment of correct character k is 3000 in the patch file, and the assignment of waiting to revise character in the dynamic load library to be revised is 3500, then process is no longer according to waiting to revise the character operation, the directly correct assignment operation of the correct character of patch file that points to according to jump instruction, be in the patch file correct character replacement fall to wait to revise character to be revised in the dynamic load library, hence one can see that, replacement information in the information substitution table " character k ", inform the load side of patch charger, need the information of replacing in the dynamic load library to be revised.
More specifically, defective is example with the error functions, when the making side of patch charger finds that the name of error functions is called character A in the dynamic load library to be revised, the title of correct function is similarly character A in the file destination, then the making side comparative analysis file destination of patch charger and dynamic load library to be revised, determine the information substitution table, a kind of replacement information that comprises in this information substitution table is function name character A, can know that function A(in the dynamic load library to be revised constitutes many instructions and the parameter of this function according to this information substitution table when then the load side of patch file charger loads this patch file) need to be constituted many instructions and the parameter of this function by the function A(in the patch file) replace.
S203, according to the code segment and the data segment of file destination, information substitution table and dynamic load library dependence information generate patch file.
The code segment of patch file and data segment are used to revise the dynamic load library defective; Concrete, the structure of patch file can be as shown in table 1:
Table 1
The patch file head
The segment information table
The information substitution table
Code segment
Data segment
String table
Dynamic load library relies on information
Relocation information
Table stage casing information table is used for illustrating the type, size, reference position of each section of this patch file (for example code segment, data segment etc.) etc.; The information substitution table is used for illustrating that dynamic load library to be revised needs the information that is replaced; In addition, be used for revising the code segment of dynamic load library defective and data segment in the file destination and can call character in other dynamic load library, therefore also comprise in the patch file and be used to illustrate the string table that calls character and illustrate that the dynamic load library of other dynamic load library that these characters are affiliated relies on information, for example, dynamic load library to be revised is M, called character C in the file destination code segment, and this calls character C and is defined in dynamic load library N, in dynamic load library N, be defined type and call character C, assignment etc., need when then moving this patch file to carry out correct operation according to the definition to C among the dynamic load library N, therefore comprise also in the patch file that dynamic load library relies on information, this dynamic load library dependence information comprises the title of dynamic load library N, information such as length, then the load side of patch charger relies on information may command process when loading patch file to the patch area of dynamic load library M according to dynamic load library, the dynamic load library N that relies on is loaded in the process, process is read when calling character C at the operation patch file, can be according to the actual address of calling among the dynamic load library N in the process under the character C, obtain among the dynamic load library N of dependence definition to character C, assignment etc.
In addition, relocation information in the patch file has specifically defined the segment type and the relative address of be called character and replacement information position, then when the operation patch file, the patch charger can be according to relative address in the relocation information and the address of dynamic load library in process to be revised, obtain the actual address of replacement information in process, and the adapter section type, adopt corresponding jump instruction to point to the actual address at replacement information place; Then can call and show that loading interface obtains and rely in the dynamic load library definition this calls the actual address of character for calling character in addition, in order to finish the operation of patch file.
S204 is loaded on patch area in first dynamic load library with patch file.
In the present embodiment, described patch area can be the part of first dynamic load library, promptly when dynamic load library to be revised that first dynamic load library provides for the provider of file destination, the provider of file destination has used compiling field such as section(" .text ") in dynamic load library to be revised, reserve one with dynamic load library to be revised in the zone that is close to of code segment as patch area, the available overall array define in this zone, and the overall array name of patch area correspondence is related with this dynamic load library, then comprise data segment in this dynamic load library, code segment and the patch area that is used to load patch file, because code segment and patch area next-door neighbour in the dynamic load library to be revised, then when operation, the patch charger can be revised a instruction in the code segment as jump instruction, just can point to the correct character of the code that is used for corrective pitting in patch area place;
Perhaps, patch area can with one independently first dynamic load library realize, when dynamic load library promptly to be revised provides for the provider of non-file destination, this first dynamic load library is provided by the provider of file destination, and this first dynamic load library is related with dynamic load library to be revised, and it is adjacent with this dynamic load library to be revised address in process, concrete, wherein first dynamic load library can use whole spaces in this dynamic load library of overall array define as the patch area that loads patch file, then only comprise patch area in first dynamic load library, and the overall array name of patch area correspondence is related with the dynamic load library that needs the patch file correction, then patch charger may command needs the dynamic load library of patch file correction with adjacent as the address of dynamic load library in process of patch area, so that the address in process of the code segment in patch area and the dynamic load library to be revised differs less, then the patch charger can only be revised in the dynamic load library to be revised an instruction in the code segment and just can point to the address, code porch that is used to revise the dynamic load library defective in the patch file as jump instruction.
There is restriction in the jump distance that a common jump instruction is controlled, if the distance of the code segment in patch area and the dynamic load library is far away, then need revise many instructions to point to the address, code porch that is used to revise the dynamic load library defective in the patch area, easily make the process operation collapse, cause risk, and the code segment of patch area and dynamic load library next-door neighbour or distance are less in the present embodiment, avoid long apart from redirect, can only revise an instruction and point to the address, code porch that is used to revise the dynamic load library defective in the patch area, have certain reliability.
S205 is loaded on first dynamic load library that loads patch file in the process.
Same dynamic load library can be used by a plurality of processes, and then when dynamic load library to be revised need be used by a plurality of processes, first dynamic load library that then loads patch file was loaded in a plurality of processes.Wherein, when carrying out S205, first dynamic load library that loads patch file can be for comprising first dynamic load library of code segment, data segment and patch area; Perhaps also can be for only comprising the dynamic load library of patch area, and this dynamic load library is adjacent with the address of dynamic load library in process to be revised.
Concrete, Fig. 3 is in-process first kind of patch area position view in the embodiment of the invention two.As shown in Figure 3, patch area is loaded in the process as the part in first dynamic load library; Fig. 4 is in-process second kind of patch area position view in the embodiment of the invention two.As shown in Figure 4, one independently first dynamic load library as patch area, and adjacent with dynamic load library address in process to be revised.
In addition, because patch file is positioned at dynamic load library to be revised, the i.e. dynamic load library to be revised that provides for the provider of file destination of first dynamic load library, perhaps patch charger may command is adjacent with dynamic load library to be revised as independently first dynamic load library of patch area, then correct character (will be positioned at each variable of patch file in the patch area, name character, call character and dependent instruction etc. and be referred to as correct character in the present embodiment) constant for the relative address of first dynamic load library, the dynamic load library same to be revised that loads for a plurality of different processes then, still can use same patch file correction, only in operation start address and patch file relative address in first dynamic load library according to first dynamic load library place process during patch file, actual address in the process at the correct character of the jump instruction sensing patch area place of waiting to revise the interpolation of character place or replacing gets final product accordingly, do not need different process according to dynamic load library place to be revised, load different patch files, simplified the administrative mechanism of patch charger, improved work efficiency patch file.
S206 according to relative address and first dynamic load library the start address in first process of patch file in first dynamic load library, determines the address of patch file in first process.
Need to prove at this, category with complete file, the file that present embodiment relates to can be divided into dynamic load library and patch file, but the operation in process of dynamic load library and patch file is according to each instruction in dynamic load library and the patch file, character goes to move, therefore, understandable, the relative address of above-mentioned patch file in first dynamic load library is specially the correct relative address of character in described first dynamic load library in the patch file, the address of first dynamic load library in described first process is specially the start address of first dynamic load library in first process, for instance, the character k that has correct assignment in the patch file is used to replace the character k that has the mistake assignment in first dynamic load library, then, determine to have in the patch file address (4C00) of character k in process of correct assignment according to the relative address (0400) and the start address (4800) of first dynamic load library in process of the character k that has correct assignment in the patch file in first dynamic load library.
More specifically, a plurality of correct character in the patch file, some correct characters are with to wait to revise character corresponding, and as the above-mentioned character k that has correct assignment, this correct character is also referred to as relative character; Other correct characters are for corresponding to the non-character of waiting to revise in the dynamic load library, call character C in other dynamic load library of for example calling, are also referred to as absolute character; Then when correct character corresponding to described wait to revise in the dynamic load library wait to revise character the time, according to correct relative address and first dynamic load library the start address in first process of character in first dynamic load library in the patch file, obtain the correct actual address of character in first process in the patch file; Described in detailed process such as the above-mentioned S102, do not repeat them here.
When described correct character during corresponding to the non-character of waiting to revise in the dynamic load library, call the demonstration loading interface according to dynamic load library dependence information, obtain the correct address of character in described first process in the described patch file.
Concrete, call the demonstration loading interface according to dynamic load library dependence information, obtain the actual address of absolute character in the process of place that patch file comprises, absolute character is corresponding to the character in the dynamic load library non-to be revised, the character C among the above-mentioned dynamic load library N that calls of patch file for example, then the patch charger is known dynamic load library N under the character C according to dynamic load library dependence information, and shows that by calling loading interface determines the actual address of character C in process among the dynamic load library N.
S207 is according to the address operation patch file of patch file in first process.
Concrete, when patch file moves in process, the patch charger is according to the relocation information in the patch file, revised exist defective wait revise an instruction at character place as jump instruction, correct character in this jump instruction sensing patch area in the patch file is positioned at the actual address of process, and then process can be according to the correct character operation in the patch file of this jump instruction sensing.
In the present embodiment, because patch area is arranged in first dynamic load library, then patch file can be loaded on dynamic load library to be revised in the process, then need not revise many instructions in the dynamic load library to be revised just can make process jump to patch area to read patch file, many process operation collapses that instruction causes in the dynamic load library to be revised have been avoided revising, and comprised the information substitution table in the patch file, dynamic load library relies on information and is used for obtaining the relocation information of patch file in the process actual address, can make the assignment of process reading command or character accurately, improve the reliability that patch loads.
Fig. 5 is the structural representation of patch charger embodiment one of the present invention.As shown in Figure 5, this device comprises:
First load-on module 501 is used for patch file is loaded on the patch area of first dynamic load library;
Determination module 502, be used for according to relative address and first dynamic load library the address in first process of patch file in first dynamic load library, determine the address of patch file in first process, wherein, first process is for loading the process of first dynamic load library;
Operation module 503 is used for according to patch file at the address of first process operation patch file.
The dynamic load library to be revised concrete, that above-mentioned first dynamic load library provides for the provider of file destination; Wherein, file destination is used to generate described patch file; Perhaps,
First dynamic load library is adjacent with the address of dynamic load library in process to be revised.
More specifically, the code segment of the patch area and first dynamic load library is adjacent.
In the present embodiment, because the patch charger makes patch area be arranged in first dynamic load library, then patch file can be loaded on dynamic load library to be revised in the process, then need not revise many instructions in the dynamic load library to be revised just can make process jump to patch area to read patch file, avoid revising many process operation collapses that instruction causes in the dynamic load library to be revised, improved the reliability that patch loads.
Fig. 6 is the structural representation of patch charger embodiment two of the present invention.As shown in Figure 6, this device also comprises:
Second load-on module 504, the dynamic load library that is used for loading patch file is loaded on a plurality of processes.
In addition, also comprise:
Generation module 505 is used for determining the information substitution table according to the character that file destination comprises;
Also be used for code segment and data segment according to file destination, information substitution table and dynamic load library dependence information generate patch file.
Concrete, the relative address of patch file in first dynamic load library is specially the correct relative address of character in first dynamic load library in the patch file, and the address of first dynamic load library in first process is specially the start address of first dynamic load library in first process; Then when described correct character corresponding in the dynamic load library described to be revised wait to revise character the time, determination module 502 specifically be used for according to correct character in the patch file in first dynamic load library relative address and first dynamic load library in the start address of first process, obtain the correct actual address of character in first process in the patch file;
When described correct character during corresponding to the character in the non-described dynamic load library to be revised, determination module 502 also is used for calling the demonstration loading interface according to dynamic record storehouse dependence information, obtains the correct actual address of character in first process in the patch file.
The present invention respectively installs the corresponding said method embodiment of embodiment, does not repeat them here.
In the present embodiment, because patch area is arranged in first dynamic load library, then patch file can be loaded on dynamic load library to be revised in the process, then need not revise many instructions in the dynamic load library to be revised just can make process jump to patch area to read patch file, many process operation collapses that instruction causes in the dynamic load library to be revised have been avoided revising, and comprised the information substitution table in the patch file, dynamic load library relies on information and is used for obtaining the relocation information of patch file in the process actual address, can make the assignment of process reading command or character accurately, improve the reliability that patch loads.
One of ordinary skill in the art will appreciate that: all or part of step that realizes above-mentioned each method embodiment can be finished by the relevant hardware of programmed instruction.Aforesaid program can be stored in the computer read/write memory medium.This program is carried out the step that comprises above-mentioned each method embodiment when carrying out; And aforesaid storage medium comprises: various media that can be program code stored such as ROM, RAM, magnetic disc or CD.
It should be noted that at last: above each embodiment is not intended to limit only in order to technical scheme of the present invention to be described; Although the present invention is had been described in detail with reference to aforementioned each embodiment, those of ordinary skill in the art is to be understood that: it still can be made amendment to the technical scheme that aforementioned each embodiment put down in writing, and perhaps some or all of technical characterictic wherein is equal to replacement; And these modifications or replacement do not make the essence of appropriate technical solution break away from the scope of various embodiments of the present invention technical scheme.

Claims (12)

1. a patch loading method is characterized in that, comprising:
Patch file is loaded on patch area in first dynamic load library;
According to relative address and described first dynamic load library the address in first process of described patch file in described first dynamic load library, determine the address of described patch file in described first process; Wherein, described first process is for loading the process of described first dynamic load library;
Move described patch file according to the address of described patch file in described first process.
2. method according to claim 1 is characterized in that, the dynamic load library to be revised that described first dynamic load library provides for the provider of file destination; Wherein, described file destination is used to generate described patch file; Perhaps,
Described first dynamic load library and the address of dynamic load library in described process described to be revised are adjacent.
3. method according to claim 1 and 2 is characterized in that, the code segment of described patch area and described first dynamic load library is adjacent.
4. according to each described method of claim 1-3, it is characterized in that, described according to relative address and described first dynamic load library the address in first process of described patch file in described first dynamic load library, determine also to comprise before the address of described patch file in described first process:
Described first dynamic load library that loads described patch file is loaded in a plurality of processes.
5. according to each described method of claim 1-3, it is characterized in that, described patch file be loaded on before the patch area in first dynamic load library, also comprise:
Determine the information substitution table according to the character that described file destination comprises;
According to the code segment and the data segment of described file destination, described information substitution table and dynamic load library dependence information generate described patch file.
6. method according to claim 1, it is characterized in that, the relative address of described patch file in described first dynamic load library is specially the correct relative address of character in described first dynamic load library in the described patch file, and the address of described first dynamic load library in described first process is specially the start address of described first dynamic load library in first process;
Describedly determine the address of described patch file in described process, comprising according to the relative address and the start address of described first dynamic load library in described first process of described patch file in described first dynamic load library:
When described correct character corresponding to described wait to revise in the dynamic load library wait to revise character the time, according to correct character in the described patch file in described first dynamic load library relative address and described first dynamic load library in start address in first process, obtain the correct actual address of character in described first process in the described patch file;
When described correct character during corresponding to the non-character of waiting to revise in the dynamic load library, call the demonstration loading interface according to described dynamic record storehouse dependence information, obtain the correct actual address of character in described first process in the described patch file.
7. a patch charger is characterized in that, comprising:
First load-on module is used for patch file is loaded on the patch area of first dynamic load library;
Determination module is used for determining the address of described patch file in described first process according to the relative address and the address of described first dynamic load library in first process of described patch file in described first dynamic load library; Wherein, described first process is for loading the process of described first dynamic load library;
The operation module is used for moving described patch file according to described patch file in the address of described first process.
8. device according to claim 7 is characterized in that, the dynamic load library to be revised that described first dynamic load library provides for the provider of file destination; Wherein, described file destination is used to generate described patch file; Perhaps,
Described first dynamic load library and the address of dynamic load library in described process described to be revised are adjacent.
9. according to claim 7 or 8 described devices, it is characterized in that the code segment of described patch area and described first dynamic load library is adjacent.
10. according to each described device of claim 7-9, it is characterized in that, also comprise:
Second load-on module, described first dynamic load library that is used for loading described patch file is loaded on a plurality of processes.
11. according to each described device of claim 7-9, it is characterized in that, also comprise:
Generation module is used for determining the information substitution table according to the character that described file destination comprises;
According to the code segment and the data segment of described file destination, described information substitution table and dynamic load library dependence information generate described patch file.
12. device according to claim 7, it is characterized in that, the relative address of described patch file in described first dynamic load library is specially the correct relative address of character in described first dynamic load library in the described patch file, and the address of described first dynamic load library in described first process is specially the start address of described first dynamic load library in first process;
When described correct character corresponding in the dynamic load library described to be revised wait to revise character the time, described determination module specifically be used for according to correct character in the described patch file in described first dynamic load library relative address and described first dynamic load library in the start address of first process, obtain the correct actual address of character in described first process in the described patch file;
When described correct character during corresponding to the character in the non-described dynamic load library to be revised, described determination module also is used for calling the demonstration loading interface according to described dynamic record storehouse dependence information, obtains the correct actual address of character in described first process in the described patch file.
CN201310137319.4A 2013-04-19 2013-04-19 patch loading method and device Expired - Fee Related CN103218241B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310137319.4A CN103218241B (en) 2013-04-19 2013-04-19 patch loading method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310137319.4A CN103218241B (en) 2013-04-19 2013-04-19 patch loading method and device

Publications (2)

Publication Number Publication Date
CN103218241A true CN103218241A (en) 2013-07-24
CN103218241B CN103218241B (en) 2016-08-31

Family

ID=48816068

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310137319.4A Expired - Fee Related CN103218241B (en) 2013-04-19 2013-04-19 patch loading method and device

Country Status (1)

Country Link
CN (1) CN103218241B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103744709A (en) * 2014-01-23 2014-04-23 华为技术有限公司 Patch loading method and device
CN103885808A (en) * 2014-04-08 2014-06-25 北京奇虎科技有限公司 Hotfix processing method and device
CN106462703A (en) * 2014-05-22 2017-02-22 软件营地株式会社 System and method for analyzing patch file
CN108874438A (en) * 2018-06-25 2018-11-23 南京中感微电子有限公司 Patch generation method, device, electronic equipment and computer program product

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6526574B1 (en) * 1997-07-15 2003-02-25 Pocket Soft, Inc. System for finding differences between two computer files and updating the computer files
CN101882094A (en) * 2010-06-10 2010-11-10 中兴通讯股份有限公司 Method and system for making patch by embedded system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6526574B1 (en) * 1997-07-15 2003-02-25 Pocket Soft, Inc. System for finding differences between two computer files and updating the computer files
CN101882094A (en) * 2010-06-10 2010-11-10 中兴通讯股份有限公司 Method and system for making patch by embedded system

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103744709A (en) * 2014-01-23 2014-04-23 华为技术有限公司 Patch loading method and device
CN103744709B (en) * 2014-01-23 2017-02-15 华为技术有限公司 patch loading method and device
CN103885808A (en) * 2014-04-08 2014-06-25 北京奇虎科技有限公司 Hotfix processing method and device
CN106462703A (en) * 2014-05-22 2017-02-22 软件营地株式会社 System and method for analyzing patch file
CN106462703B (en) * 2014-05-22 2019-08-02 软件营地株式会社 Patch file analysis system and analysis method
CN108874438A (en) * 2018-06-25 2018-11-23 南京中感微电子有限公司 Patch generation method, device, electronic equipment and computer program product
CN108874438B (en) * 2018-06-25 2021-09-21 南京中感微电子有限公司 Patch generation method and device, electronic equipment and computer storage medium

Also Published As

Publication number Publication date
CN103218241B (en) 2016-08-31

Similar Documents

Publication Publication Date Title
CN103744709B (en) patch loading method and device
CN104778127B (en) The method and apparatus that a kind of NAND FLASH write data
US20070233941A1 (en) Method for initializing and operating flash memory file system and computer-readable medium storing related program
CN102541521B (en) Automatic operating instruction generating device based on structured query language and method
CN103218241A (en) Method and device for patch loading
CN112289360A (en) Read retry threshold voltage selection
CN105760184A (en) Method and device for loading component
CN104615594A (en) Data updating method and device
CN105630491A (en) Method and device for changing functions of program
CN103019707A (en) Call stack analyzing and processing method and device
CN104919433A (en) Page allocation for flash memories
US10169141B2 (en) Modifiable stripe length in flash memory devices
CN105404794A (en) Protection method and device of Java application software
US9928137B2 (en) Data storage device and error correction method
CN106055375A (en) Application program installation method and device
CN103744656A (en) Method and device for data analysis
CN104461621A (en) Attribute information updating method and device
US20180254092A1 (en) Data-storage device and block-releasing method
CN102736932A (en) Image file, image file producing method and multisystem start guiding method
US9779017B2 (en) Data storage device and data accessing method thereof
CN105677805A (en) Data storing and reading method and device using protobuf
CN103744331A (en) Education robot, controller thereof and programming method of controller
CN102403041B (en) Data programming circuit and method for one-time programmable memory
CN105702293A (en) Method and device for checking disturbed nonvolatile storage unit
CN105243011A (en) Memory leak positioning method and apparatus

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
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20160831

Termination date: 20180419

CF01 Termination of patent right due to non-payment of annual fee