Detailed Description
In order to make the technical field of the invention better understand the scheme of the embodiment of the invention, the embodiment of the invention is further described in detail with reference to the drawings and the implementation mode.
Referring to fig. 1, a flowchart of a method for updating a virtual registry according to an embodiment of the present invention is shown, where the method includes:
step 101: forming a private registry, wherein the private registry comprises a system registry virtual branch which is established in a host system registry and corresponds to the pocket operating system, and a memory tree structure which is established according to a virtual process in the pocket operating system;
in this embodiment, the private registry includes: the virtual branch of the system registry is a branch created in the registry of the host system when the pocket operating system is started; when the virtual process is started, analyzing the file of the virtual registry to obtain the information of the virtual registry; and constructing a memory tree structure of the virtual process in the memory space according to the virtual registry information. The virtual process is an application software process running in a pocket operating system.
The process of forming the private registry comprises the following steps: when a pocket operating system is started, firstly creating a system registry virtual branch, when a virtual process in the pocket operating system is started, analyzing a virtual registry file to obtain virtual registry information, creating a memory tree structure of the virtual process according to the virtual registry file and the state of the virtual branch of the current system registry, traversing the system registry virtual branch, deleting a key or item value which is the same as that of the system registry virtual branch in the memory tree structure, wherein the system registry virtual branch is a system registry virtual branch which is created when the pocket operating system is started and is updated when any virtual process of the pocket operating system runs; the memory tree structure and the virtual branch of the system registry are combined to form a private registry. The method for forming the private registry in the embodiment of the present invention is not limited to the above method, and as long as the private registry is formed by the memory tree structure corresponding to the virtual process and the virtual branch of the system registry, the key or item value in the memory tree structure that is the same as the virtual branch of the system registry may not be deleted when the private registry is formed.
Step 102: intercepting all operations of a virtual process on a system registry, redirecting all the operations into a system registry virtual branch and a memory tree structure, modifying a key value or an item value corresponding to the operation in the system registry virtual branch according to the intercepted operations when the intercepted operations are modification operations on the system registry, and deleting the same key value or item value corresponding to the operation in the system registry virtual branch in the memory tree structure when the intercepted operations correspond to the same key value or item value in the memory tree structure;
in this step, all operations of the virtual process on the registry are redirected to the private registry (i.e., the system registry virtual branch and the memory tree structure), for example, modification operations of the virtual process on the system registry are intercepted and redirected to the system registry virtual branch, and so on.
In this embodiment, the operation performed by the virtual process on the information in the virtual branch of the system registry may include, but is not limited to, a modification operation on the virtual registry information, or an inquiry operation on the virtual registry information, where the modification includes changing existing data and creating missing data.
Step 103: updating the modified virtual branches of the system registry into the virtual registry file;
in this step, the virtual process updates the contents of the private registry to the virtual registry file; the virtual registry file may be stored in a local disk or a mobile hard disk, or may be stored in another mobile device, as long as the virtual registry file can be recognized by the windows operating system, which is not limited in this embodiment. Wherein, the virtual registry file stores the modification operation of the registry by the virtual process.
When the pocket operating system exits, the content in the modified virtual branch of the system registry needs to be updated into the virtual registry file corresponding to the pocket operating system, which can be realized by the following method: traversing the system registry virtual branch, creating a temporary memory tree structure, adding all information of the system registry virtual branch into the temporary memory tree structure, then storing all information in the temporary memory tree structure into the virtual registry file in a tree structure form, and emptying all information in the temporary memory tree structure.
Step 104: deleting the private registry.
And when the pocket operating system exits, deleting the system registry virtual branch.
The previously established memory tree structure is automatically deleted when the pocket operating system exits, so that the private registry is deleted in the embodiment of the invention, and only the virtual branch of the system registry can be deleted.
In this embodiment, step 102 takes two cases as an example, but is not limited to this, and one case is that when a virtual process modifies a certain key value or item value (the key value or item value, which refers to an item or key or value in the registry, and the value includes a name, a type, and data) K in the registry, the virtual process may query whether a key value or item value to be modified exists in a virtual branch of the system registry and in the memory tree structure, respectively, to improve query efficiency. If the key value or the item value exists, deleting the key value or the item value K, modifying the key value or the item value K, and returning a message of successful modification to the virtual process. And if the key value or the item value does not exist, modifying the key value or the item value K and returning a message of successful modification to the virtual process. If the virtual branch of the system registry does not have the key value or the item value K, but the key value or the item value K exists in the memory tree structure, the key value or the item value K existing in the memory tree structure is imported into the virtual branch of the system registry, then the key value or the item value K of the virtual branch of the system registry is modified, and a message of successful modification is returned.
The other situation is that: when a virtual process inquires a certain key value K of the registry, the virtual process firstly inquires whether the key value or item value K exists in the virtual branch of the registry of the system, and then inquires whether the key value or item value K exists in the tree structure of the memory, and if the key value or item value does not exist in the virtual branch of the registry of the system and the tree structure of the memory, the key value or item value does not exist. And if the key value or the item value exists in both the virtual branch of the system registry and the memory tree structure, deleting the key value or the item value K in the memory tree structure and returning the key value or the item value. And if the key value or the item value K exists in the virtual branch of the system registry but the key value or the item value K does not exist in the memory tree structure, returning to the virtual branch of the system registry and the key value or the item value K exists. And if the system registry virtual branch does not have the key value or the item value K, but the memory tree structure has the key value or the item value K, returning to the memory tree structure that the key value or the item value K exists.
There may be multiple virtual programs in the pocket operating system, and the query or modification operation of each virtual program to the registry is different. It may happen that at some time the key values or entry values in the memory tree structure and the system registry virtual branches are not identical.
The embodiment of the present invention is applied to a Pocket Operating System (PKOS), which is stored in a mobile storage device, such as a mobile hard disk, but is not limited thereto. When the pocket operating system performs information interaction with the host system, for example, a common application program, all functions may involve a large amount of registry information, but at the time of starting, most registry operations are query type operations; when the program runs, only a small amount of registry information is modified; for the registry operation function, the query speed of the class function is high, and the modification time of the class function is low; based on this, in the embodiment of the present invention, when the pocket operating system is started, only the system registry virtual branch is created, and when the virtual process is started, the memory tree structure is constructed, and when the virtual process runs in the pocket operating system, the related functions in the virtual branch in the system registry are continuously modified, so that the contents such as modification of the system registry virtual branch are shared when each virtual process runs; if the related function to be modified exists in the memory tree structure during the running of the virtual process, the related function in the memory tree structure is deleted, so that the query quantity of the subsequent application program in the memory tree structure is reduced, and the processing speed is increased. Therefore, the pocket operating system of the embodiment of the invention optimizes the starting speed of the pocket operating system by combining the mode of establishing the virtual branch of the system registry (VRegSubNode) and the mode of establishing the tree structure of the memory space (VRegMemTree), improves the running performance of the pocket operating system and improves the experience of users.
The respective steps in fig. 1 are described in detail below.
Referring to fig. 2, a specific flowchart of an operation of composing a private registry provided in an embodiment of the present invention is shown, in this embodiment, composing the private registry may be understood as initializing a file of a virtual registry, and may also be understood as a loading operation of the virtual registry, which specifically includes:
step 201: when the pocket operating system is started, a system registry virtual branch is created;
step 202: when the virtual process is started, analyzing the file of the virtual registry to obtain the information of the virtual registry;
step 203: constructing a memory tree structure in a memory space according to the virtual registry information;
step 204: and traversing the virtual branches of the system registry, and deleting the keys or item values in the memory tree structure, which are the same as the virtual branches of the system registry.
The traversal system registry virtual branch is a branch created in the host system registry when the traversal PKOS is started, and the modification operation of the virtual process on the registry is intercepted and redirected to the branch. The building of the memory tree structure is to analyze the virtual registry file, and then build the memory tree structure of the virtual registry in the memory space according to the analyzed data, that is, the memory tree structure is built on the memory space of the host.
Referring to fig. 3, a flowchart of a virtual registry modifying operation according to an embodiment of the present invention is shown, where the embodiment is a case of performing operation processing on virtual registry information in a private registry, and the embodiment takes modifying a key value in the registry as an example, and specifically includes:
step 301: intercepting operation of a certain key value K in a virtual process modification registry;
step 302: the pocket operating system searches whether a key value K1 exists in the virtual branch of the system registry; if not, go to step 303; if so, go to step 304;
step 303: the pocket operating system inquires whether a key value K2 exists in the memory tree structure; if not, go to step 305; if so, go to step 306;
step 304: the pocket operating system inquires whether a key value K2 exists in the memory tree structure; if so, go to step 307; if not, go to step 308;
step 305: the pocket operating system creates a key value K1 in a virtual branch of a system registry;
step 306: the pocket operating system leads the key value K2 in the memory tree structure into a system registry virtual branch K1;
step 307: the pocket operating system deletes the key value K2 in the memory tree structure;
step 308: the pocket operating system modifies a key value K1 in the virtual branch of the system registry;
step 309: the pocket operating system feeds back the key value K1.
In this embodiment, K-K1-K2.
That is to say, in this embodiment, when the virtual process modifies the key value or the item value K1, the pocket operating system first queries whether the virtual branch of the system registry has the key value or the item value K1, and then queries whether the tree structure of the memory has the key value or the item value K2, and if neither K1 nor K2 exists, directly creates K1 in the virtual branch of the system registry, and returns a creation success message. If both K1 and K2 exist, K2 is deleted, K1 is modified, and a message that the modification was successful is returned. If K1 exists but K2 does not exist, K1 is modified and a message is returned that the modification was successful. If K1 does not exist but K2 exists, K2 is imported into K1, K1 is modified, and a message that the modification was successful is returned.
Referring to fig. 4, a flowchart of a virtual registry query operation according to an embodiment of the present invention is shown, where another case of performing operation processing on virtual registry information in the private registry specifically includes:
step 401: intercepting a virtual process to inquire a virtual registry K;
step 402: the pocket operating system inquires whether the system registry branch has K1; if not, go to step 403; if yes, go to step 404;
step 403: the pocket operating system inquires whether the memory tree structure has K2, if not, step 405 is executed; otherwise, go to step 406;
step 404: the pocket operating system inquires whether the memory tree structure has K2, if not, step 407 is executed; otherwise, go to step 408;
step 405: the pocket operating system feeds back that no key value or item value K exists; the virtual program returns the inquired key value or item value K;
step 406: pocket operating system feedback K2;
step 407: pocket operating system feedback K1;
step 408: the pocket operating system deletes K2; the search redundancy is reduced.
In this embodiment, K-K1-K2.
That is to say, when querying a certain key value K of the registry, the virtual process queries whether a key value or an item value K1 exists in the virtual branch of the registry of the system, and then queries whether a key value or an item value K2 exists in the memory tree structure, and if neither K1 nor K2 exists, directly returns that K does not exist. If both K1 and K2 exist, then K2 is deleted and K1 is returned. If K1 is present but K2 is not present, then K1 is returned. If K1 is not present but K2 is present, K2 is returned.
Referring to fig. 5, a flowchart of an embodiment of the present invention is shown, in which a private registry is deleted, including:
step 501: the pocket operating system traverses the modified registry information in the system registry virtual branch;
step 502: analyzing a virtual registry file and constructing a temporary memory tree structure, and adding all information of the virtual branches of the system registry to the temporary memory tree structure;
step 503: all information in the temporary memory tree structure is stored in the virtual registry file in a tree structure form;
step 504: and clearing the temporary memory tree structure and deleting the system registry virtual branch.
That is to say, the pocket operating system firstly traverses the system registry virtual branch, analyzes the virtual registry file and constructs a temporary memory tree structure, adds all information of the system registry virtual branch into the temporary memory tree structure, then stores all information in the temporary memory tree structure into the virtual registry file in a tree structure form, and finally clears the temporary memory tree structure and deletes the system registry virtual branch to prevent user information leakage.
When the virtual program is started, the virtual registry of the memory space tree structure is constructed, so that the time is short, namely the private key value or item value is created by the PKOS when the registry information is modified, the starting speed of the PKOS is improved, the running performance of a pocket operating system is improved, and the user experience is enhanced. Furthermore, when the information of the virtual registry changes, the virtual branch of the system registry is updated in time, so that the information is conveniently shared and transmitted among the processes through the registry, and the information of key values in the registry can be modified and inquired to judge whether the technical scheme of the invention is used.
Based on the implementation process of the foregoing method, an embodiment of the present invention further provides a virtual registry updating apparatus, a schematic structural diagram of which is shown in fig. 6 in detail, where the apparatus includes: a composition unit, 61, an interception redirection unit 62, an update unit 63 and a first deletion unit 64. Wherein,
the composition unit 61 is configured to compose a private registry, where the private registry includes a system registry virtual branch corresponding to the pocket operating system and established in the host system registry, and a memory tree structure established according to a virtual process in the pocket operating system; the interception redirecting unit 62 is configured to intercept all operations of a virtual process in the pocket operating system on the registry of the host system, and redirect all the operations to the virtual branch of the registry of the system and the memory tree structure, where when an intercepted operation is a modification operation on the registry of the system, a key value or an item value corresponding to the operation in the virtual branch of the registry of the system is modified according to the intercepted operation, and when the intercepted operation corresponds to the same key value or item value in the memory tree structure, the same key value or item value in the memory tree structure and the virtual branch of the registry of the system corresponding to the operation is deleted; the updating unit 63 is configured to update the modified virtual branch of the system registry into the virtual registry file; the first deleting unit 64 is configured to delete the private registry, and specifically, delete the system registry virtual branch when the pocket operating system exits.
Wherein the constituent units include: the system comprises an analysis unit, a memory tree structure construction unit and a second deletion unit, wherein the first initialization unit is used for creating a system registry virtual branch when a pocket operating system is started; the analysis unit is used for analyzing the virtual registry file to obtain virtual registry information when a virtual program is started; the memory tree structure construction unit is used for constructing a memory tree structure in a memory space according to the virtual registry information; and the second deleting unit is used for traversing the system registry virtual branch and deleting the key values or item values which are the same as the system registry virtual branch in the memory tree structure.
Preferably, when the operation is a modify operation, the intercepting redirection unit includes: the system comprises a first query unit, a creation unit, a third deletion unit, a first feedback unit and an import unit, wherein the first query unit is used for respectively querying whether a key value or an item value exists in a virtual branch of a system registry and a memory tree structure when the key value or the item value is modified; the creating unit is configured to directly create the key value or the item value in the system registry virtual branch and return the key value or the item value when the first querying unit does not query from the system registry virtual branch and the memory tree structure; the third deleting unit is configured to delete the key value or the item value in the memory tree structure and modify the key value or the item value in the virtual branch of the system registry when the first querying unit queries both the virtual branch of the system registry and the memory tree structure; the first feedback unit is configured to modify the key value or the item value in the virtual branch of the system registry when the first query unit queries the key value or the item value from the virtual branch of the system registry and does not query the key value or the item value from the memory tree structure; the import unit is configured to import the key value or the item value in the memory tree structure into the system registry virtual branch when the first query unit does not query the key value or the item value from the system registry virtual branch and queries the key value or the item value from the memory tree structure, and modify the imported key value or the imported item value in the system registry virtual branch.
Preferably, the intercepting redirection unit is further configured to, when the operation is a query operation on a system registry, return a query result, and delete a same key value or item value corresponding to the operation in the memory tree structure when both the key value and item value corresponding to the operation exist in the memory tree structure and the virtual branch of the system registry.
Wherein, when the operation is a query operation, the intercepting redirection unit may further include: the system comprises a first query unit, a first feedback unit, a first deletion unit, a first feedback unit and a first feedback unit, wherein the first query unit is used for respectively querying whether a system registry virtual branch and a memory tree structure have key values or item values when querying the key values or the item values; the second feedback unit is configured to directly return that no key value or item value exists when the second query unit queries no key value or item value from both the system registry virtual branch and the memory tree structure; the fourth deleting unit is configured to delete the key value or the item value in the memory tree structure and return the key value or the item value in the system registry virtual branch when the second querying unit queries the key value or the item value from both the system registry virtual branch and the memory tree structure; the third feedback unit is configured to return the key value or the item value in the virtual branch of the system registry when the second query unit finds the key value or the item value from the virtual branch of the system registry and does not find the key value or the item value from the memory tree structure; the fourth feedback unit is configured to return that the key value or the item value exists in the memory tree structure when the second query unit does not find the key value or the item value from the system registry virtual branch and finds the key value or the item value from the memory tree structure.
Preferably, when the operation is a query operation, the interception re-determining unit may further include: a third searching unit, a fourth searching unit, a fifth feedback unit, a sixth feedback unit, a fifth searching unit, a fifth deleting unit and a seventh feedback unit, wherein the third searching unit is configured to search whether the key value or the item value exists in the virtual branch of the system registry first, the fourth searching unit is configured to continue to search whether the corresponding key value or the item value exists in the memory tree structure when the key value or the item value is not found by the third searching unit, the fifth feedback unit is configured to feed back the key value or the item value found in the memory tree structure when the key value or the item value is searched by the fourth searching unit from the memory tree structure, and the sixth feedback unit is configured to feed back the key value or the item value found in the memory tree structure when the key value or the item value is not found by the fourth searching unit from the memory tree structure, feeding back that the key value or item value is not found in the virtual branch of the system registry and the memory tree structure; the fifth searching unit is configured to continue to search whether the memory tree structure has the corresponding key value or item value when the third searching unit searches the key value or item value; the fifth deleting unit is configured to delete the key value or the item value in the memory tree structure if the key value or the item value is found from the memory tree structure by the fifth querying unit, and return the key value or the item value in the virtual branch of the system registry; the seventh feedback unit is configured to return the key value or the item value in the virtual branch of the system registry if the key value or the item value is not found in the memory tree structure by the fifth query unit.
Preferably, the update unit includes: the system comprises a traversing unit, an analyzing unit, an adding unit and a writing unit, wherein the traversing unit is used for traversing the modified registry information in the virtual branch of the system registry when the pocket operating system exits; the analysis unit is used for analyzing the virtual registry file and constructing a temporary memory tree structure; the adding unit is used for adding all information of the virtual branches of the system registry into the temporary memory tree structure, and the writing unit is used for writing all information in the temporary memory tree structure into the virtual registry file in a tree structure form and emptying all information in the temporary memory tree structure.
When the virtual program is started, the virtual registry of the memory space tree structure is constructed, so that the time is short, namely the private key value or item value is created by the PKOS when the registry information is modified, the starting speed of the PKOS is improved, the running performance of a pocket operating system is improved, and the user experience is enhanced.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. The term "comprising", without further limitation, means that the element so defined is not excluded from the group consisting of additional identical elements in the process, method, article, or apparatus that comprises the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the present invention may be implemented by software plus a necessary general hardware platform, and certainly may also be implemented by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which may be stored in a storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that those skilled in the art can make various improvements and modifications without departing from the principle of the present invention, and these improvements and modifications should also be construed as the protection scope of the present invention.