Summary of the invention
In view of the above problems, the present invention has been proposed so that a kind of hot patch disposal route and device that overcomes the problems referred to above or address the above problem is at least in part provided.
According to one aspect of the present invention, a kind of hot patch disposal route is provided, comprising:
Whether monitoring has new program module to load;
If have, obtain patch information corresponding to described program module;
Before described program module operation, according to described patch information, described program module is carried out to hot patch processing.
Optionally, aforesaid hot patch disposal route, wherein, described in obtain patch information corresponding to described program module, comprising:
Extract the characteristic information of described program module;
According to default characteristic information and the corresponding relation of patch information, obtain the patch information that described characteristic information is corresponding.
Optionally, aforesaid hot patch disposal route, wherein, described characteristic information comprises: the filename of program module, the file path of program module, one or any number of combinations in the version information VersionInfo field of the time stamp T imeStamp field of program module, the verification of program module and CheckSum field and program module.
Optionally, aforesaid hot patch disposal route, wherein, described patch information comprises: patch function address and by patch function address; Accordingly,
Describedly before the operation of described program module, according to described patch information, described program module is carried out to hot patch processing, comprising:
Before described program module operation, according to described patch function address and described by patch function address, structure jump instruction;
To described in described program module, be replaced with described jump instruction by the instruction at patch function address place.
Optionally, aforesaid hot patch disposal route, described before described program module operation, according to described patch information, after described program module is carried out to hot patch processing, also comprise:
Carry out described program module, and in the process of implementation in the time calling described in described program module by the instruction at patch function address place, jump to the patch function at described patch function address place according to described jump instruction, carry out described patch function.
Optionally, aforesaid hot patch disposal route, also comprises:
Obtain the address of adding hook Hook function, wherein, whether described Hook function has new program module to load for monitoring;
Articulate described Hook function at described address place.
According to another aspect of the present invention, provide a kind of hot patch treating apparatus, having comprised:
Whether monitoring modular, have new program module to load for monitoring;
The first acquisition module, for when described monitoring module monitors is when having new program module to load, obtains patch information corresponding to described program module;
Processing module, for before described program module operation, according to described patch information, carries out hot patch processing to described program module.
Optionally, aforesaid hot patch treating apparatus, wherein, described the first acquisition module comprises:
Extraction unit, for extracting the characteristic information of described program module;
Acquiring unit, for according to default characteristic information and the corresponding relation of patch information, obtains the patch information that described characteristic information is corresponding.
Optionally, aforesaid hot patch treating apparatus, wherein, described patch information comprises: patch function address and by patch function address; Accordingly, described processing module comprises:
Tectonic element, for before described program module operation, according to described patch function address and described by patch function address, structure jump instruction;
Replacement unit, for being replaced with described jump instruction by the instruction at patch function address place described in described program module.
Optionally, aforesaid hot patch treating apparatus, also comprises:
Execution module, be used for carrying out described program module, and in the process of implementation in the time calling described in described program module by the instruction at patch function address place, jump to the patch function at described patch function address place according to described jump instruction, carry out described patch function.
Optionally, aforesaid hot patch treating apparatus, also comprises:
The second acquisition module, for obtaining the address of adding hook Hook function, wherein, whether described Hook function has new program module to load for monitoring;
Knock-down module, for articulating described Hook function at described address place.
By technique scheme, the technical scheme that the embodiment of the present invention provides at least has following advantages:
The technical scheme that the embodiment of the present invention provides is by the load condition of monitoring new procedures module, with after loading in program module, obtain the patch information of described program module, then before program module operation, according to described patch information, described program module is carried out to hot patch processing, so just can be in the situation that interrupt routine move, system program or application program are repaired or upgraded, improved the efficiency of patch processing.
Above-mentioned explanation is only the general introduction of technical solution of the present invention, in order to better understand technological means of the present invention, and can be implemented according to the content of instructions, below with preferred embodiment of the present invention and coordinate accompanying drawing to be described in detail as follows.
Embodiment
For making object, technical scheme and the advantage of the embodiment of the present invention clearer, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is the present invention's part embodiment, instead of whole embodiment.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtaining under creative work prerequisite, belong to the scope of protection of the invention.
The schematic flow sheet of the hot patch disposal route that as shown in Figure 1, the embodiment of the present invention one provides.As shown in Figure 1, the executive agent of the described method of the present embodiment can be hot patch treating apparatus.Wherein, described hot patch treating apparatus can be specially the client application software being arranged on client device.User is after hot patch treating apparatus described in local installation, in local computer, stored the patch information for carrying out hot patch processing, or local computer can carry out alternately to obtain corresponding patch information in real time by internet and server end.As shown in Figure 1, the hot patch disposal route described in the present embodiment comprises:
Whether step 101, monitoring have new program module to load.
Concrete, this step can adopt the message processing facility of existing Windows, and HOOK mechanism realizes.Wherein, the message processing facility of Windows for can be in application program the variety of event message of supervisory system, the function that articulates various hooks (also or claim readjustment or instead adjust English Hook) function is provided.HOOK function is used for monitoring the transmittance process of message, and before it arrives object process or object module, by its intercepting and capturing.
If step 102 has, obtain patch information corresponding to described program module.
Concrete, described patch information can be stored in default hot patch application configuration file.For example, in described hot patch application configuration file, include characteristic information and the corresponding patch information of at least one program module.Wherein, the characteristic information of described program module can comprise: the filename of program module, the file path of program module, one or any number of combinations in the version information field (VersionInfo) of the timestamp field (TimeStamp) of program module, the checksum field (CheckSum) of program module and program module.
Corresponding, this step can be adopted with the following method and be realized:
First, extract the characteristic information of described program module.
Then,, according to default characteristic information and the corresponding relation of patch information, obtain the patch information that described characteristic information is corresponding.
Here you need to add is that: described hot patch application configuration file is loaded and resolved by service processes, and preserve with Memory Mapping File and its (File Mapping) object of sharing, follow-up each process is only responsible for reading File Mapping, and need not reload and resolve described hot patch application configuration file.In addition, also it should be noted that: described hot patch application configuration file also comprises check information (as cyclic redundancy check (CRC) information and version information etc.) herein.Therefore patch information corresponding to described program module that, this step gets also should meet by the integrity checking based on CRC calculating and the security inspection of version information.
Step 103, before the operation of described program module, according to described patch information, described program module is carried out to hot patch processing.
Concrete, described patch information can comprise: patch function address and by patch function address.Corresponding this step 103 specifically can be adopted with the following method and be realized:
First, before described program module operation, according to described patch function address and described by patch function address, structure jump instruction.
For example, described patch function address is 0x1600000, is 0x300080 by patch function address, adopts jump instruction operational character JMP TO, and the jump instruction that structure obtains is JMP0x12fff7b.
Then, will described in described program module, be replaced with described jump instruction by the instruction at patch function address place.
The instruction by patch function address 0x300080 place in described program module is replaced with to the jump instruction JMP0x12fff7b that previous step obtains, completed the replacement of instruction.Like this in described program module implementation, in the time carrying out described 0x300080 address place, will jump to corresponding patch function by described jump instruction JMP0x12fff7b, carry out this patch function, so just realized in the operation of interrupt routine not and just can carry out the object of reparation in real time to program.
Further, described in the method described in the present embodiment, after step 103, also comprise the steps:
Carry out described program module, and in the process of implementation in the time calling described in described program module by the instruction at patch function address place, jump to the patch function at described patch function address place according to described jump instruction, carry out described patch function.
Here you need to add is that: described patch function is read in patch file buffer zone in advance.Described patch function address can be the address of described patch file in described buffer zone.
The technical scheme that the present embodiment provides is by the load condition of monitoring new procedures module, with after loading in program module, obtain the patch information of described program module, then before program module operation, according to described patch information, described program module is carried out to hot patch processing, so just can be in the situation that interrupt routine move, system program or application program are repaired or upgraded, improved the efficiency of patch processing.
Further, as shown in Figure 2, the method described in above-described embodiment, except comprising above steps, also comprises the steps:
Step 201, the address that obtains interpolation hook Hook function.
Wherein, whether described Hook function has new program module to load for monitoring.The address of LdrpCallInitRoutine can be used as the address of described Hook function.
Step 202, articulate described Hook function at described address place.
The principle that the present embodiment articulates described Hook function is: system program normally calls and load other program modules successively according to the loading sequence of oneself.In all program modules, may there is part to have leak, also may all have leak.When present procedure module one is loaded but does not also carry out, the hot patch disposal route providing according to the present embodiment has just been carried out hot patch processing.But, after the program module of current new loading, system program does not know to load any program module, so will add Hook function after the program module loading, monitor with the program module described program module newly being loaded by described Hook function later, system program is as long as one call so below, and system program just can be known and have new module loading at first.
It should be noted that: for aforesaid each embodiment of the method, for simple description, therefore it is all expressed as to a series of combination of actions, but those skilled in the art should know, the present invention is not subject to the restriction of described sequence of movement, because according to the present invention, some step can adopt other orders or carry out simultaneously.Secondly, those skilled in the art also should know, the embodiment described in instructions all belongs to preferred embodiment, and related action and module might not be that the present invention is necessary.
One of ordinary skill in the art will appreciate that: all or part of step that realizes said method embodiment can complete by the relevant hardware of programmed instruction, aforesaid program can be stored in a computer read/write memory medium, this program, in the time carrying out, is carried out the step that comprises said method embodiment; And aforesaid storage medium comprises: various media that can be program code stored such as ROM, RAM, magnetic disc or CDs.
The structural representation of the hot patch treating apparatus that as shown in Figure 3, the embodiment of the present invention two provides.As shown in Figure 3, the device described in the present embodiment two comprises: monitoring modular 1, the first acquisition module 2 and processing module 3.Wherein, whether described monitoring modular has new program module to load for monitoring.When described the first acquisition module 2 loads for monitor new program module when described monitoring modular 1, obtain patch information corresponding to described program module.Described processing module 3, for before described program module operation, according to described patch information, is carried out hot patch processing to described program module.The described hot patch treating apparatus that the present embodiment provides can be realized the described hot patch disposal route that above-described embodiment provides.
The technical scheme that the present embodiment provides is by the load condition of monitoring new procedures module, with after loading in program module, obtain the patch information of described program module, then before program module operation, according to described patch information, described program module is carried out to hot patch processing, so just can be in the situation that interrupt routine move, system program or application program are repaired or upgraded, improved the efficiency of patch processing.
Further, the acquisition module described in above-described embodiment can adopt the structure shown in Fig. 4 to realize.Concrete, as shown in Figure 4, described the first acquisition module 2 comprises: extraction unit 21 and acquiring unit 22.Wherein, described extraction unit 21 is for extracting the characteristic information of described program module.Described acquiring unit 22, for according to default characteristic information and the corresponding relation of patch information, obtains the patch information that described characteristic information is corresponding, and wherein, the described patch information getting is patch information corresponding to described program module.The characteristic information of described program module comprises: the filename of program module, the file path of program module, one or any number of combinations in the version information field (VersionInfo) of the timestamp field (TimeStamp) of program module, the checksum field (CheckSum) of program module and program module.
Further, the patch information described in above-described embodiment comprises: patch function address and by patch function address.Accordingly, the processing module described in above-described embodiment can adopt the structure shown in Fig. 5 to realize.Concrete, as shown in Figure 5, described processing module 3 comprises: tectonic element 31 and replacement unit 32.Wherein, described tectonic element 31, for before described program module operation, according to described patch function address and described by patch function address, is constructed jump instruction.Described replacement unit 32 is for being replaced with described jump instruction by the instruction at patch function address place described in described program module.
Further, based on the processing module of said structure, described hot patch treating apparatus also comprises as shown in Figure 6: execution module 4.Described execution module 4 is for carrying out described program module, and in the process of implementation in the time calling described in described program module by the instruction at patch function address place, jump to the patch function at described patch function address place according to described jump instruction, carry out described patch function.
Further, as shown in Figure 6, described hot patch treating apparatus also comprises: the second acquisition module 5 and knock-down module 6.Wherein, described the second acquisition module 5 is for obtaining the address of adding hook Hook function, and wherein, whether described Hook function has new program module to load for monitoring.Described knock-down module 6 is for articulating described Hook function at described address place.
In the above-described embodiments, the description of each embodiment is all emphasized particularly on different fields, in certain embodiment, there is no the part of detailed description, can be referring to the associated description of other embodiment.
Be understandable that the reference mutually of the correlated characteristic in said method and switch.In addition, " first ", " second " etc. in above-described embodiment are for distinguishing each embodiment, and do not represent the quality of each embodiment.
Those skilled in the art can be well understood to, for convenience and simplicity of description, the system of foregoing description, the specific works process of device and unit, can, with reference to the corresponding process in preceding method embodiment, not repeat them here.
The algorithm providing at this is intrinsic not relevant to any certain computer, virtual system or miscellaneous equipment with demonstration.Various general-purpose systems also can with based on using together with this teaching.According to description above, it is apparent constructing the desired structure of this type systematic.In addition, the present invention is not also for any certain programmed language.It should be understood that and can utilize various programming languages to realize content of the present invention described here, and the description of above language-specific being done is in order to disclose preferred forms of the present invention.
In the instructions that provided herein, a large amount of details are described.But, can understand, embodiments of the invention can be put into practice in the situation that there is no these details.In some instances, be not shown specifically known method, structure and technology, so that not fuzzy understanding of this description.
Similarly, be to be understood that, in order to simplify the disclosure and to help to understand one or more in each inventive aspect, in the above in the description of exemplary embodiment of the present invention, each feature of the present invention is grouped together into single embodiment, figure or sometimes in its description.But, the method for the disclosure should be construed to the following intention of reflection: the present invention for required protection requires than the more feature of feature of clearly recording in each claim.Or rather, as reflected in claims below, inventive aspect is to be less than all features of disclosed single embodiment above.Therefore, claims of following embodiment are incorporated to this embodiment thus clearly, and wherein each claim itself is as independent embodiment of the present invention.
Those skilled in the art are appreciated that and can the module in the equipment in embodiment are adaptively changed and they are arranged in one or more equipment different from this embodiment.Module in embodiment or unit or assembly can be combined into a module or unit or assembly, and can put them in addition multiple submodules or subelement or sub-component.At least some in such feature and/or process or unit are mutually repelling, and can adopt any combination to combine all processes or the unit of disclosed all features in this instructions (comprising claim, summary and the accompanying drawing followed) and disclosed any method like this or equipment.Unless clearly statement in addition, in this instructions (comprising claim, summary and the accompanying drawing followed) disclosed each feature can be by providing identical, be equal to or the alternative features of similar object replaces.
In addition, those skilled in the art can understand, although embodiment more described herein comprise some feature instead of further feature included in other embodiment, the combination of the feature of different embodiment means within scope of the present invention and forms different embodiment.For example, in the following claims, the one of any of embodiment required for protection can be used with array mode arbitrarily.
All parts embodiment of the present invention can realize with hardware, or realizes with the software module of moving on one or more processor, or realizes with their combination.It will be understood by those of skill in the art that and can use in practice microprocessor or digital signal processor (DSP) to realize according to the some or all functions of the some or all parts in the hot patch treating apparatus of the embodiment of the present invention.The present invention can also be embodied as part or all equipment or the device program (for example, computer program and computer program) for carrying out method as described herein.Realizing program of the present invention and can be stored on computer-readable medium like this, or can there is the form of one or more signal.Such signal can be downloaded and obtain from internet website, or provides on carrier signal, or provides with any other form.
It should be noted above-described embodiment the present invention will be described instead of limit the invention, and those skilled in the art can design alternative embodiment in the case of not departing from the scope of claims.In the claims, any reference symbol between bracket should be configured to limitations on claims.Word " comprises " not to be got rid of existence and is not listed as element or step in the claims.Being positioned at word " " before element or " one " does not get rid of and has multiple such elements.The present invention can be by means of including the hardware of some different elements and realizing by means of the computing machine of suitably programming.In the unit claim of having enumerated some devices, several in these devices can be to carry out imbody by same hardware branch.The use of word first, second and C grade does not represent any order.Can be title by these word explanations.