CN104166721A - Registry file consolidation method and device - Google Patents

Registry file consolidation method and device Download PDF

Info

Publication number
CN104166721A
CN104166721A CN201410418573.6A CN201410418573A CN104166721A CN 104166721 A CN104166721 A CN 104166721A CN 201410418573 A CN201410418573 A CN 201410418573A CN 104166721 A CN104166721 A CN 104166721A
Authority
CN
China
Prior art keywords
file
registry
original
new
hive
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
CN201410418573.6A
Other languages
Chinese (zh)
Other versions
CN104166721B (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.)
Beijing Qihoo Technology Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing 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 Beijing Qihoo Technology Co Ltd, Qizhi Software Beijing Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201410418573.6A priority Critical patent/CN104166721B/en
Priority claimed from CN201110280181.4A external-priority patent/CN102346769B/en
Publication of CN104166721A publication Critical patent/CN104166721A/en
Application granted granted Critical
Publication of CN104166721B publication Critical patent/CN104166721B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/1724Details of de-fragmentation performed by the file system

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明公开了一种注册表文件整理方法及装置,其中,所述方法包括:当需要对注册表文件进行整理时,获取目标文件;将原注册表文件中的有效数据保存到所述目标文件中,生成新的注册表文件;通知操作系统将所述新的注册表文件作为注册表文件。通过本发明,能够减少注册表文件中的碎片,从而提高系统性能。

The invention discloses a method and device for sorting out a registry file, wherein the method includes: obtaining a target file when the registry file needs to be sorted out; saving valid data in the original registry file to the target file , generate a new registry file; notify the operating system to use the new registry file as a registry file. Through the invention, the fragmentation in the registry file can be reduced, thereby improving the system performance.

Description

一种注册表文件整理方法及装置Method and device for organizing registry files

技术领域technical field

本发明涉及计算机技术领域,特别是涉及一种注册表文件整理方法及装置。The invention relates to the field of computer technology, in particular to a method and device for organizing registry files.

背景技术Background technique

注册表是Windows操作系统中所有32位硬件/驱动和32位应用程序的数据文件,是一个系统信息的数据库,其中容纳了应用程序和计算机系统的全部配置信息、应用程序和文档文件的关联关系、硬件设备的说明、状态和属性以及各种状态信息和数据。注册表文件也被称为HIVE文件。它是注册表信息的物理存储形式。我们看到的注册表结构是经过注册表编辑器读取之后呈现给我们的,是由一组称被为HIVE文件组成。HIVE中文名曰“储巢”。每个HIVE文件可以被理解为一棵单独注册表树。The registry is the data file of all 32-bit hardware/drivers and 32-bit applications in the Windows operating system. It is a database of system information, which contains all configuration information of applications and computer systems, and the relationship between applications and document files. , the description, status and properties of the hardware device, and various status information and data. Registry files are also known as HIVE files. It is the physical storage form of registry information. The registry structure we see is presented to us after being read by the registry editor, and is composed of a group of files called HIVE. The Chinese name of HIVE is "Store Nest". Each HIVE file can be understood as a single registry tree.

注册表信息是按照一定格式存储在硬盘上的若干文件组成。修改某个注册表项目,本质上是修改对应的文件。当用户安装新的硬件,安装卸载软件,修改系统设置,都会涉及到注册表读,写,增,删操作。其中,删注册表信息项时候,会将对应的物理存储空间置上删除标记。注册表文件中会有很多这样被置为删除标记的空间。随着写入、删除的多次进行,会使得注册表文件中产生大量的碎片。这种碎片一般不会在系统中引起问题,但碎片过多会使系统在读写注册表的时候来回寻找,引起系统性能下降。另外,过多的碎片还有可能导致注册表信息的丢失。Registry information is composed of several files stored on the hard disk according to a certain format. Modifying a registry item is essentially modifying the corresponding file. When the user installs new hardware, installs and uninstalls software, and modifies system settings, it will involve reading, writing, adding, and deleting operations in the registry. Wherein, when the registry information item is deleted, the corresponding physical storage space will be marked with a deletion mark. There will be many such spaces marked for deletion in the registry file. As writing and deleting are performed many times, a large number of fragments will be generated in the registry file. This kind of fragmentation generally does not cause problems in the system, but too much fragmentation will cause the system to search back and forth when reading and writing the registry, causing system performance to decline. In addition, excessive fragmentation may also lead to loss of registry information.

因此,迫切需要本领域技术人员解决的技术问题就在于,如何对注册表文件进行有效地整理,以便减少其中的碎片。Therefore, a technical problem that urgently needs to be solved by those skilled in the art is how to effectively organize registry files so as to reduce fragments therein.

发明内容Contents of the invention

本发明提供一种注册表文件整理方法及装置,能够减少注册表文件中的碎片,从而提高系统性能。The invention provides a method and device for sorting out registry files, which can reduce fragments in registry files, thereby improving system performance.

本发明提供了如下方案:The present invention provides following scheme:

一种注册表文件整理方法,包括:A method for organizing registry files, comprising:

当需要对注册表文件进行整理时,获取目标文件;When the registry file needs to be sorted out, the target file is obtained;

将原注册表文件中的有效数据保存到所述目标文件中,生成新的注册表文件;Saving the valid data in the original registry file to the target file to generate a new registry file;

通知操作系统将所述新的注册表文件作为注册表文件。The operating system is notified to use the new registry file as a registry file.

其中:所述当需要对注册表文件进行整理时,获取目标文件包括:Wherein: when the registry file needs to be sorted out, obtaining the target file includes:

当需要对注册表文件进行整理时,新建文件,将所述新建的文件作为所述目标文件。When the registry file needs to be organized, a new file is created, and the newly created file is used as the target file.

其中:in:

所述当需要对注册表文件进行整理时,新建文件包括:When the registry file needs to be sorted out, the newly created file includes:

当需要对注册表文件进行整理时,查找原注册表文件中的注册表项及其对应的HIVE文件,并为各注册表项分别新建一文件;When the registry file needs to be sorted out, search for the registry entries in the original registry file and their corresponding HIVE files, and create a new file for each registry entry;

所述将原注册表文件中的有效数据保存到所述目标文件中,生成新的注册表文件包括:The effective data in the original registry file is saved in the target file, and generating a new registry file includes:

对于各注册表项,将原HIVE文件中的有效数据存放到对应各注册表项新建的文件中,综合各注册表项对应的新建文件,生成新的注册表文件。For each registry item, the valid data in the original HIVE file is stored in a newly created file corresponding to each registry item, and a new registry file is generated by synthesizing the newly created files corresponding to each registry item.

优选地,查找到原注册表文件中的注册表项及其对应的HIVE文件之后还包括:Preferably, after finding the registry entry in the original registry file and its corresponding HIVE file, it also includes:

根据每个注册表项的HIVE文件实际占用的空间以及HIVE文件中的有效数据所占用的空间,确定每个注册表项在整理后所占的空间,以及整理后优化的比例;According to the actual space occupied by the HIVE file of each registry item and the space occupied by the valid data in the HIVE file, determine the space occupied by each registry item after sorting, and the optimized ratio after sorting;

将每个注册表项在整理前后所占的空间,以及整理后优化的比例展现给用户。Show the user the space occupied by each registry item before and after sorting, as well as the optimized ratio after sorting.

优选地,还包括:Preferably, it also includes:

将原注册表文件中被分散保存到磁盘不同位置的同一注册表信息的数据连续存放。Continuously store the data of the same registry information in the original registry file that is scattered and stored in different locations on the disk.

其中,所述当需要对注册表文件进行整理时包括:Wherein, when the registry file needs to be sorted out, it includes:

检测用户是否发出整理注册表文件的请求,如果是,则需要对注册表文件进行整理;Detect whether the user sends a request to organize the registry file, and if so, the registry file needs to be organized;

或者,or,

检测原注册表文件占用的空间是否达到预置的阈值,如果是,则需要对注册表文件进行整理。Detect whether the space occupied by the original registry file reaches the preset threshold, and if so, the registry file needs to be sorted.

一种注册表文件整理装置,包括:A device for organizing registry files, comprising:

目标文件获取单元,用于当需要对注册表文件进行整理时,获取目标文件;The target file obtaining unit is used to obtain the target file when the registry file needs to be sorted out;

新注册表文件生成单元,用于将原注册表文件中的有效数据保存到所述目标文件中,生成新的注册表文件;A new registry file generation unit is used to save valid data in the original registry file into the target file to generate a new registry file;

通知单元,用于通知操作系统将所述新的注册表文件作为注册表文件。The notification unit is configured to notify the operating system to use the new registry file as the registry file.

其中,所述目标文件获取单元包括:Wherein, the target file acquisition unit includes:

新建文件单元,用于当需要对注册表文件进行整理时,新建文件,将所述新建的文件作为所述目标文件。The newly-created file unit is used to create a new file when the registry file needs to be organized, and use the newly-created file as the target file.

其中:in:

所述新建文件单元具体用于:The newly created file unit is specifically used for:

当需要对注册表文件进行整理时,查找原注册表文件中的注册表项及其对应的HIVE文件,并为各注册表项分别新建一文件;When the registry file needs to be sorted out, search for the registry entries in the original registry file and their corresponding HIVE files, and create a new file for each registry entry;

所述新注册表生成单元具体用于:The new registry generation unit is specifically used for:

对于各注册表项,将原HIVE文件中的有效数据存放到对应各注册表项新建的文件中,综合各注册表项对应的新建文件,生成新的注册表文件。For each registry item, the valid data in the original HIVE file is stored in a newly created file corresponding to each registry item, and a new registry file is generated by synthesizing the newly created files corresponding to each registry item.

优选地,还包括:Preferably, it also includes:

确定单元,用于查找到原注册表文件中的注册表项及其对应的HIVE文件之后,根据每个注册表项的HIVE文件实际占用的空间以及HIVE文件中的有效数据所占用的空间,确定每个注册表项在整理后所占的空间,以及整理后优化的比例;Determine the unit, after finding the registry entry in the original registry file and its corresponding HIVE file, determine according to the space actually occupied by the HIVE file of each registry entry and the space occupied by the valid data in the HIVE file The space occupied by each registry item after sorting, and the optimized ratio after sorting;

展现单元,用于将每个注册表项在整理前后所占的空间,以及整理后优化的比例展现给用户。The display unit is used to display to the user the space occupied by each registry item before and after sorting, and the optimized ratio after sorting.

优选地,还包括:Preferably, it also includes:

连续存放单元,用于将原注册表文件中被分散保存到磁盘不同位置的同一注册表信息的数据连续存放。The continuous storage unit is used to continuously store the data of the same registry information in the original registry file that is scattered and stored in different locations on the disk.

其中,所述目标文件获取单元包括:Wherein, the target file acquisition unit includes:

第一检测子单元,用于检测用户是否发出整理注册表文件的请求,如果是,则需要对注册表文件进行整理,获取目标文件;The first detection subunit is used to detect whether the user sends a request for sorting out the registry file, and if so, needs to sort out the registry file to obtain the target file;

或者,or,

第二检测子单元,用于检测原注册表文件占用的空间是否达到预置的阈值,如果是,则需要对注册表文件进行整理,获取目标文件。The second detection subunit is used to detect whether the space occupied by the original registry file reaches a preset threshold, and if so, the registry file needs to be sorted out to obtain the target file.

根据本发明提供的具体实施例,本发明公开了以下技术效果:According to the specific embodiments provided by the invention, the invention discloses the following technical effects:

本发明实施例中,如果需要对注册表文件进行整理,则会获取目标文件,然后将原注册表文件中的有效数据保存到该目标文件中,这样,就可以生成新的注册表文件,然后将其作为注册表文件。在这一过程中,由于仅将有效数据保存到新的文件中,这样,就可以使得新的注册表文件中不再存在无效数据,因此,相当于对注册表碎片进行了整理,有利于提高系统性能。In the embodiment of the present invention, if the registry file needs to be sorted out, the target file will be obtained, and then the valid data in the original registry file will be saved in the target file, so that a new registry file can be generated, and then Make it a registry file. In this process, since only valid data is saved to a new file, invalid data no longer exists in the new registry file, therefore, it is equivalent to sorting out registry fragments, which is beneficial to improve system performance.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the accompanying drawings required in the embodiments. Obviously, the accompanying drawings in the following description are only some of the present invention. Embodiments, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without any creative effort.

图1是本发明实施例提供的方法的流程图;Fig. 1 is the flowchart of the method provided by the embodiment of the present invention;

图2是本发明实施例中的第一界面示意图;Fig. 2 is a schematic diagram of the first interface in the embodiment of the present invention;

图3是本发明实施例中的第二界面示意图;Fig. 3 is a schematic diagram of a second interface in an embodiment of the present invention;

图4是本发明实施例中的第三界面示意图;Fig. 4 is a schematic diagram of a third interface in an embodiment of the present invention;

图5是本发明实施例提供的装置的示意图。Fig. 5 is a schematic diagram of a device provided by an embodiment of the present invention.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. All other embodiments obtained by persons of ordinary skill in the art based on the embodiments of the present invention belong to the protection scope of the present invention.

参见图1,本发明实施例提供的注册表文件整理方法包括以下步骤:Referring to Fig. 1, the registry file finishing method that the embodiment of the present invention provides comprises the following steps:

S101:当需要对注册表文件进行整理时,获取目标文件;S101: Obtain the target file when the registry file needs to be sorted;

在实际应用中,为了确定是否需要对注册表文件进行整理,可以为用户提供启动入口,当用户通过该入口发出整理注册表文件的请求时,就将其作为需要对注册表文件进行整理的指令,然后启动注册表文件整理的流程。或者,也可以设置自动监控的程序,例如,可以对注册表文件占用的空间进行监控,当注册表文件所占用的空间达到预置的阈值时,就可以启动对注册表文件进行整理的流程。当然,还可以将两者相结合,例如,可以在监控到注册表文件占用的空间达到预置的阈值时,向用户弹出提示,告知用户其注册表文件占用的空间过大,并询问用户是否需要进行注册表文件整理,如果用户选择需要,再启动整理注册表文件的流程。一旦确定需要整理注册表文件,就可以首先获取目标文件,为后续的整理做准备。In practical applications, in order to determine whether the registry files need to be sorted, a startup entry can be provided for the user, and when the user sends a request for sorting the registry files through this entry, it will be used as an instruction that needs to sort the registry files , and then start the registry file sorting process. Alternatively, an automatic monitoring program can also be set, for example, the space occupied by the registry file can be monitored, and when the space occupied by the registry file reaches a preset threshold, the process of sorting the registry file can be started. Of course, the two can also be combined. For example, when it is monitored that the space occupied by the registry file reaches a preset threshold, a prompt will pop up to the user, informing the user that the space occupied by the registry file is too large, and ask the user whether to It is necessary to sort out the registry files, and if the user chooses to do so, start the process of sorting out the registry files. Once it is determined that the registry file needs to be sorted, the target file can be obtained first to prepare for the subsequent sorting.

其中,具体在获取目标文件时,可以是新创建空的文件,将该空的文件作为目标文件(当然,该空的文件可以是预先创建好的,也可以是在需要对注册表文件进行整理时创建的)。或者,在实际应用中,目标文件还可以是预先获取的一保存有基本配置信息的文件,基本配置信息是指针对用户计算机的一些基本配置,这种基本配置可以是与用户计算机上安装的操作系统的版本号(例如Windows XP SP3等等)相对应的,也就是说,对于安装了某版本操作系统的计算机而言,注册表中的一些基本配置通常是相同的,因此,就可以针对各个不同的操作系统版本号分别预先设置标准文件,在需要对注册表文件进行整理时,就可以将这种标准文件作为目标文件。具体实现时,该标准文件可以是预先保存在用户计算机本地的,也可以是在需要对注册表文件进行整理时,根据计算机的系统版本号,到服务器侧下载相应的标准文件,再将其作为目标文件。Wherein, specifically when obtaining the target file, it may be to newly create an empty file, and use the empty file as the target file (of course, the empty file may be pre-created, or it may be necessary to organize the registry file created at the time). Or, in practical applications, the target file can also be a pre-acquired file with basic configuration information. The basic configuration information refers to some basic configurations for the user's computer. This basic configuration can be related to the operating system installed on the user's computer corresponding to the version number of the system (such as Windows XP SP3, etc.), that is to say, for computers with a certain version of the operating system installed, some basic configurations in the registry are usually the same, so you can target each Standard files are preset for different operating system version numbers, and such standard files can be used as target files when the registry files need to be sorted out. During specific implementation, the standard file can be pre-saved locally on the user's computer, or when the registry file needs to be sorted out, the corresponding standard file can be downloaded from the server side according to the system version number of the computer, and then used as Target file.

S102:将原注册表文件中的有效数据保存到所述目标文件中,生成新的注册表文件;S102: Save the valid data in the original registry file to the target file, and generate a new registry file;

由于获取到的目标文件,因此,具体在对注册表文件进行整理时,就可以将原注册表文件中的有效数据转移到目标文件中并保存。值得注意的是,原注册表文件中既存在有效数据,还存在一些无效数据(当某应用程序被卸载之后,之前被写入到注册表中的关于该应用程序的数据可能并没有被删除,此时,由于应用程序已经被卸载了,因此这种数据就成为无效数据,也可以称为碎片),在向目标文件中转移数据时,仅将有效数据转移到目标文件中,因此,新生成的注册表文件就将不再包含无效数据。换言之,对于原注册表文件中的数据,首先判断出是有效数据还是无效数据(具体的,可以根据数据是否带有删除标记来进行判断,或者,由于被置为已删除的数据通常不具有显示特性,因此,用注册表编辑器打开对应的HIVE文件,能够看到的数据都是有效的,在这种情况下,由于本发明的目的也是仅将有效数据保存到目标文件中,因此也就没有必要再去识别出其中的已经无效的数据),如果是有效数据,则保存到目标文件中,因此,相当于将碎片进行了清除,避免影响到系统性能。Due to the obtained target file, when the registry file is sorted out, the valid data in the original registry file can be transferred to the target file and saved. It is worth noting that there are both valid data and some invalid data in the original registry file (when an application is uninstalled, the data about the application that was written into the registry before may not be deleted, At this time, since the application program has been uninstalled, this kind of data becomes invalid data, which can also be called fragments), when transferring data to the target file, only valid data is transferred to the target file, therefore, the newly generated registry files will no longer contain invalid data. In other words, for the data in the original registry file, first determine whether it is valid data or invalid data (specifically, it can be judged according to whether the data has a deletion mark, or, because the data that is set as deleted usually does not have a display characteristics, therefore, open the corresponding HIVE file with a registry editor, and the data that can be seen are all valid. There is no need to identify invalid data therein), if it is valid data, it is saved in the target file, therefore, it is equivalent to clearing the fragments to avoid affecting system performance.

需要说明的是,如果目标文件是新建的空文件,则直接将原注册表文件中的所有有效数据都转移到目标文件中保存即可。而如果目标文件是前文所述保存有基本配置信息的文件,则可以仅将基本配置信息以外的其他有效信息转移保存到该基本配置文件中即可,因此,有利于提高文件整理的效率,节省时间及系统资源。It should be noted that if the target file is a newly created empty file, all valid data in the original registry file can be directly transferred to the target file and saved. And if the target file is a file with basic configuration information as mentioned above, you can only transfer and save other valid information other than the basic configuration information to the basic configuration file. Therefore, it is beneficial to improve the efficiency of file organization and save time and system resources.

另外需要说明的是,关于本发明实施例所述的有效数据,还可以是根据用户的系统版本号以及安装的应用程序等特征进行分析之后,获得的关于当前系统的一些优化配置的数据,因此,在对注册表文件进行整理的同时,除了可以将原注册表文件中的有效数据保存到目标文件中,还可以将这些优化配置数据保存到目标文件中,使得新的注册表文件在得到整理的同时,优化了系统配置,进一步提高系统性能。In addition, it should be noted that the effective data described in the embodiments of the present invention may also be data about some optimized configurations of the current system obtained after analysis based on the characteristics of the user's system version number and installed applications. , while sorting the registry file, in addition to saving the valid data in the original registry file to the target file, you can also save these optimized configuration data to the target file, so that the new registry file can be sorted At the same time, the system configuration is optimized to further improve system performance.

S103:通知操作系统将所述新的注册表文件作为注册表文件。S103: Notify the operating system to use the new registry file as a registry file.

在生成新的注册表文件之后,就可以通知操作系统将该文件作为注册表文件。具体实现时,在生成新的注册表文件之后,还可以重新启动计算机(或者提示用户重新启动),重新启动之后,就会以新的注册表文件运行。当然,对于原注册表文件,由于已经不再有存在的价值,因此可以将其删除。至于原注册表文件的删除时机,则可以在生成新的注册表文件之后即删除,也可以等到重启计算机之后,再进行删除。After a new registry file is generated, the operating system can be notified to use the file as a registry file. During specific implementation, after the new registry file is generated, the computer can also be restarted (or the user is prompted to restart), and after restarting, the computer will run with the new registry file. Of course, for the original registry file, since it no longer has the value of existence, it can be deleted. As for the deletion timing of the original registry file, it can be deleted after the new registry file is generated, or it can be deleted after restarting the computer.

可见,在本发明实施例提供的注册表文件整理方法中,如果需要对注册表文件进行整理,则会获取目标文件,然后将原注册表文件中的有效数据保存到目标文件中,这样,就可以生成新的注册表文件,然后将其作为注册表文件。在这一过程中,由于仅将有效数据保存到新的文件中,这样,就可以使得新的注册表文件中不再存在无效数据,因此,相当于对注册表碎片进行了整理,有利于提高系统性能。It can be seen that in the registry file sorting method provided in the embodiment of the present invention, if the registry file needs to be sorted, the target file will be obtained, and then the valid data in the original registry file will be saved in the target file, so that A new registry file can be generated and then used as a registry file. In this process, since only valid data is saved to a new file, invalid data no longer exists in the new registry file, therefore, it is equivalent to sorting out registry fragments, which is beneficial to improve system performance.

在实际应用中,由于注册表文件通常是由多个HIVE文件组成的,其中每个注册表项对应着一个HIVE文件,一个注册表项通常对应着一个群组,例如群组名为“\REGISTRY\MACHINE\SOFTWARE”的HIVE文件,相当于应用程序对应的注册表项,当新装某应用程序时,产生的注册表信息就写入到该HIVE文件中。或者,群组名为“\REGISTRY\MACHINE\SYSTEM”的HIVE文件,相当于系统对应的注册表项,当系统中的硬件等配置发生变化时,产生的注册表信息就写入到该HIVE文件中。也就是说,在注册表文件中,实际上对不同的注册表信息是进行了分类保存的,同一类的注册表信息对应的一个HIVE文件,并且每个HIVE文件中包含多个注册表信息,随着应用程序的新装与卸载、系统配置的更改等操作,会使得每个HIVE文件中都可能产生无效的数据。In practical applications, since the registry file is usually composed of multiple HIVE files, each registry item corresponds to a HIVE file, and a registry item usually corresponds to a group, for example, the group name is "\REGISTRY \MACHINE\SOFTWARE" HIVE file, which is equivalent to the registry key corresponding to the application. When a new application is installed, the generated registry information will be written into the HIVE file. Or, the HIVE file with the group name "\REGISTRY\MACHINE\SYSTEM" is equivalent to the corresponding registry item of the system. When the configuration of hardware and other things in the system changes, the generated registry information will be written into the HIVE file middle. That is to say, in the registry file, different registry information is actually classified and saved, the same type of registry information corresponds to a HIVE file, and each HIVE file contains multiple registry information, With the new installation and uninstallation of the application program, the change of the system configuration, etc., invalid data may be generated in each HIVE file.

因此,在本发明实施例中,如果将新建的文件作为目标文件,则在新建文件之前,还可以首先查找原注册表文件中的注册表项及其对应的HIVE文件,然后针对各个注册表项,分别新建一文件。具体对注册表文件进行整理时,就可以分别针对各个注册表项进行。其中,针对各个注册表项,就可以将原HIVE文件中的有效数据存放到对应该注册表项新建的文件中。这样,最终针对各个注册表项就可以分别得到一个新建的文件,并且新建的文件中仅保存有效的数据,此时,再将这些新建的文件综合到一起,就可以生成新的注册表文件。Therefore, in the embodiment of the present invention, if the newly created file is used as the target file, before creating a new file, you can also first search for the registry entries in the original registry file and their corresponding HIVE files, and then for each registry entry , create a new file respectively. Specifically, when sorting out the registry files, it can be done for each registry item. Wherein, for each registry item, the valid data in the original HIVE file can be stored in a newly created file corresponding to the registry item. In this way, finally, a newly created file can be obtained for each registry item, and only valid data is saved in the newly created file. At this time, these newly created files can be combined together to generate a new registry file.

需要说明的是,在实际应用中,还可能存在以下现象:在写注册表时,计算机会优先在HIVE文件中找足够大的一个连续可用空间上存储该信息。如果不存在足够大的连续可用空间,则通常会从可用存储空间中选择若干块,来存储该数据。这就会造成同一注册表信息在物理存储空间上的不连续,而由于这种在物理存储空间上的不连续,使得注册表信息被分散保存到不同地方,这也会造成系统读取数据变慢。It should be noted that in practical applications, the following phenomenon may also exist: when writing the registry, the computer will preferentially find a large enough contiguous free space in the HIVE file to store the information. If there is no large enough contiguous free space, several blocks are usually selected from the available storage space to store the data. This will result in the discontinuity of the same registry information in the physical storage space, and due to the discontinuity in the physical storage space, the registry information will be stored in different places, which will also cause the system to read data changes. slow.

考虑到上述现象,本发明实施例在对注册表文件进行整理时,除了将无效数据清除掉以外,还可以判断原注册表文件中是否存在同一注册表信息在物理空间的上的不连续存储的现象,如果存在,在向新建的文件中转移有效数据的过程中,还可以将将原注册表文件中被分散保存到磁盘不同位置的同一注册表信息的数据连续存放。这样,可以进一步地提高系统的性能。Considering the above-mentioned phenomenon, when the embodiment of the present invention arranges the registry file, in addition to clearing invalid data, it can also be judged whether there is a discontinuous storage of the same registry information in the physical space in the original registry file. Phenomenon, if it exists, in the process of transferring effective data to the newly created file, the data of the same registry information that is scattered and stored in different locations on the disk in the original registry file can also be continuously stored. In this way, the performance of the system can be further improved.

另外,在由用户手动启动注册表文件整理的情况下,为了给用户提供是否进行注册表文件整理的参考,还可以在进行整理之前,首先对注册表文件进行分析,根据每个注册表项的HIVE文件实际占用的空间以及HIVE文件中的有效数据所占用的空间,确定每个注册表项在整理后所占的空间(也即有效数据所占用的空间),以及整理后优化的比例(相当于是无效数据所占的空间与原文件占用的总空间之间的比值),并将每个注册表项在整理前后所占的空间,以及整理后优化的比例展现给用户。也就是说,用户根据这些信息,可以直观地了解到,如果对注册表文件进行整理,则可以得到多大的优化,进而决定是否要对注册表文件进行整理。In addition, in the case that the registry file is manually started by the user, in order to provide the user with a reference on whether to organize the registry file, the registry file can be analyzed first before sorting, and according to the value of each registry item The actual space occupied by the HIVE file and the space occupied by the valid data in the HIVE file determine the space occupied by each registry item after sorting (that is, the space occupied by valid data), and the optimized ratio after sorting (equivalent to Therefore, the ratio between the space occupied by invalid data and the total space occupied by the original file), and the space occupied by each registry item before and after sorting, and the optimized ratio after sorting are displayed to the user. That is to say, based on the information, the user can intuitively know how much optimization can be obtained if the registry file is sorted, and then decides whether to sort the registry file.

例如,首先可以从Windows系统中找到所有的HIVE文件,并一一列举出来,如图2所示,其中“群组名”就代表各个注册表项对应的HIVE文件的名称,“当前大小”就代表各个HIVE文件当前占用的空间的大小(其中包含了无效数据占用的空间)。当用户点击右上角的“分析注册表”之后,就可以对各个HIVE文件进行分析,计算出各个HIVE文件整理后的大小和能够优化的比率,并展现给用户,如图3所示。接下来,如果用户点击“立即优化”按钮,可以在界面中给出需要重新启动计算机的提示,如图4所示。如果用户点击“是”,则相当于用户发出了整理注册表文件的请求,此时,就可以执行步骤S101至S103,重新组合其物理存储结构,将无法利用的小块存储区彻底释放掉,然后重新启动系统,注册表碎片整理完成。For example, first you can find all HIVE files from the Windows system and list them one by one, as shown in Figure 2, where "group name" represents the name of the HIVE file corresponding to each registry entry, and "current size" is Represents the size of the space currently occupied by each HIVE file (including the space occupied by invalid data). After the user clicks "Analyze Registry" in the upper right corner, each HIVE file can be analyzed, and the size and optimized ratio of each HIVE file can be calculated and displayed to the user, as shown in Figure 3. Next, if the user clicks the "Optimize Now" button, a prompt that the computer needs to be restarted can be given in the interface, as shown in FIG. 4 . If the user clicks "Yes", it means that the user has sent a request to organize the registry files. At this time, steps S101 to S103 can be performed to reassemble the physical storage structure and completely release the unusable small storage areas. Then restart the system and the registry defragmentation is complete.

与本发明实施例提供的注册表文件整理方法相对应,本发明实施例还提供了一种注册表文件整理装置,参见图5,该装置包括:Corresponding to the registry file organizing method provided in the embodiment of the present invention, the embodiment of the present invention also provides a registry file organizing device, see FIG. 5, the device includes:

目标文件获取单元501,用于当需要对注册表文件进行整理时,获取目标文件;The target file obtaining unit 501 is used to obtain the target file when the registry file needs to be sorted out;

新注册表文件生成单元502,用于将原注册表文件中的有效数据保存到所述目标文件中,生成新的注册表文件;A new registry file generating unit 502, configured to save valid data in the original registry file into the target file to generate a new registry file;

通知单元503,用于通知操作系统将所述新的注册表文件作为注册表文件。The notification unit 503 is configured to notify the operating system to use the new registry file as a registry file.

具体实现时,目标文件获取单元501具体可以包括:During specific implementation, the target file acquisition unit 501 may specifically include:

新建文件单元,用于当需要对注册表文件进行整理时,新建文件,将所述新建的文件作为所述目标文件。The newly-created file unit is used to create a new file when the registry file needs to be organized, and use the newly-created file as the target file.

由于注册表信息通常是进行分类保存的,因此,可以分别针对不同的注册表项,分别新建一文件,此时,新建文件单元具体可以用于:Since the registry information is usually stored in categories, a new file can be created for different registry entries. At this time, the newly created file unit can be specifically used for:

当需要对注册表文件进行整理时,查找原注册表文件中的注册表项及其对应的HIVE文件,并为各注册表项分别新建一文件;When the registry file needs to be sorted out, search for the registry entries in the original registry file and their corresponding HIVE files, and create a new file for each registry entry;

相应的,新注册表生成单元502具体可以用于:Correspondingly, the new registry generation unit 502 can be specifically used for:

对于各注册表项,将原HIVE文件中的有效数据存放到新建的文件中,综合各注册表项对应的新建文件,生成新的注册表文件。For each registry item, the effective data in the original HIVE file is stored in the newly created file, and the newly created file corresponding to each registry item is synthesized to generate a new registry file.

为了在用户决定是否需要对注册表文件进行整理之前,给用户提供参考,该装置还可以包括:In order to provide reference to the user before the user decides whether to organize the registry file, the device may also include:

确定单元,用于查找到原注册表文件中的注册表项及其对应的HIVE文件之后,根据每个注册表项的HIVE文件实际占用的空间以及HIVE文件中的有效数据所占用的空间,确定每个注册表项在整理后所占的空间,以及整理后优化的比例;Determine the unit, after finding the registry entry in the original registry file and its corresponding HIVE file, determine according to the space actually occupied by the HIVE file of each registry entry and the space occupied by the valid data in the HIVE file The space occupied by each registry item after sorting, and the optimized ratio after sorting;

展现单元,用于将每个注册表项在整理前后所占的空间,以及整理后优化的比例展现给用户。The display unit is used to display to the user the space occupied by each registry item before and after sorting, and the optimized ratio after sorting.

为了进一步提高系统性能,该装置还可以包括:In order to further improve system performance, the device may also include:

连续存放单元,用于将原注册表文件中被分散保存到磁盘不同位置的同一注册表信息的数据连续存放。The continuous storage unit is used to continuously store the data of the same registry information in the original registry file that is scattered and stored in different locations on the disk.

此外,该装置还可以包括:Additionally, the device may include:

删除单元,用于将原注册表文件删除。The delete unit is used to delete the original registry file.

在实际应用中,可以通过多种方式来确定是否需要对注册表文件进行整理,具体的,目标文件获取单元501可以包括:In practical applications, it can be determined in various ways whether the registry file needs to be sorted out. Specifically, the target file acquisition unit 501 may include:

第一检测子单元,用于检测用户是否发出整理注册表文件的请求,如果是,则需要对注册表文件进行整理,获取目标文件;The first detection subunit is used to detect whether the user sends a request for sorting out the registry file, and if so, needs to sort out the registry file to obtain the target file;

或者,or,

第二检测子单元,用于检测原注册表文件占用的空间是否达到预置的阈值,如果是,则需要对注册表文件进行整理,获取目标文件。The second detection subunit is used to detect whether the space occupied by the original registry file reaches a preset threshold, and if so, the registry file needs to be sorted out to obtain the target file.

总之,通过本发明实施例提供的注册表文件整理装置,如果需要对注册表文件进行整理,则会获取目标文件,然后将原注册表文件中的有效数据保存到目标文件中,这样,就可以生成新的注册表文件,然后将其作为注册表文件。在这一过程中,由于仅将有效数据保存到新的文件中,这样,就可以使得新的注册表文件中不再存在无效数据,因此,相当于对注册表碎片进行了整理,有利于提高系统性能。In a word, through the registry file sorting device provided by the embodiment of the present invention, if the registry file needs to be sorted out, the target file will be obtained, and then the valid data in the original registry file will be saved in the target file, so that Generate a new registry file and make it a registry file. In this process, since only valid data is saved to a new file, invalid data no longer exists in the new registry file, therefore, it is equivalent to sorting out registry fragments, which is beneficial to improve system performance.

需要说明的是,本发明实施例所述的装置是与前述方法实施例相对应的,因此,装置实施例中的未详述部分可以参见方法实施例中的介绍,这里不再赘述。It should be noted that the device described in the embodiment of the present invention corresponds to the aforementioned method embodiment, therefore, the unspecified parts in the device embodiment can refer to the introduction in the method embodiment, and will not be repeated here.

以上对本发明所提供的一种注册表文件整理方法及装置,进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处。综上所述,本说明书内容不应理解为对本发明的限制。The method and device for arranging registry files provided by the present invention have been introduced in detail above. In this paper, specific examples have been used to illustrate the principle and implementation of the present invention. The descriptions of the above embodiments are only used to help understand the present invention. The method of the invention and its core idea; at the same time, for those of ordinary skill in the art, according to the idea of the invention, there will be changes in the specific implementation and application range. In summary, the contents of this specification should not be construed as limiting the present invention.

Claims (12)

1. A registry file arrangement method is characterized by comprising the following steps:
when the registry file needs to be sorted, acquiring a target file;
storing effective data in the original registry file into the target file to generate a new registry file;
and informing the operating system to use the new registry file as the registry file of the operating system.
2. The method of claim 1, wherein: when the registry file needs to be sorted, the obtaining of the target file comprises the following steps:
when the registry file needs to be sorted, a file is newly created, and the newly created file is used as the target file.
3. The method of claim 2, wherein:
when the registry file needs to be sorted, the newly-built file comprises the following steps:
when the registry file needs to be sorted, searching registry entries in the original registry file and the HIVE files corresponding to the registry entries, and respectively creating a file for each registry entry;
the storing the valid data in the original registry file into the target file, and the generating a new registry file comprises:
and for each registry key, storing effective data in the original HIVE file into the newly-built file corresponding to each registry key, and synthesizing the newly-built file corresponding to each registry key to generate a new registry file.
4. The method of claim 3, wherein after finding the registry key and the HIVE file corresponding to the registry key in the original registry file, further comprising:
determining the space occupied by each registry key after sorting and the optimized proportion after sorting according to the space actually occupied by the HIVE file of each registry key and the space occupied by the effective data in the HIVE file;
and displaying the space occupied by each registry key before and after sorting and the optimized proportion after sorting to a user.
5. The method of claim 1, further comprising:
and continuously storing the data of the same registry information which is dispersedly stored in different positions of the disk in the original registry file.
6. The method according to claim 1, wherein when the registry file needs to be sorted, the method comprises:
detecting whether a user sends a request for sorting registry files, if so, sorting the registry files;
or,
and detecting whether the space occupied by the original registry file reaches a preset threshold value, and if so, sorting the registry file.
7. A registry file collating apparatus comprising:
the target file acquisition unit is used for acquiring a target file when the registry file needs to be sorted;
the new registry file generating unit is used for storing the effective data in the original registry file into the target file and generating a new registry file;
and the notification unit is used for notifying the operating system to take the new registry file as the registry file.
8. The apparatus according to claim 7, wherein the target file acquiring unit includes:
and the new file creating unit is used for creating a new file when the registry file needs to be sorted, and taking the created file as the target file.
9. The apparatus of claim 8, wherein:
the new file unit is specifically configured to:
when the registry file needs to be sorted, searching registry entries in the original registry file and the HIVE files corresponding to the registry entries, and respectively creating a file for each registry entry;
the new registry generating unit is specifically configured to:
and for each registry key, storing effective data in the original HIVE file into the newly-built file corresponding to each registry key, and synthesizing the newly-built file corresponding to each registry key to generate a new registry file.
10. The apparatus of claim 9, further comprising:
the determining unit is used for determining the space occupied by each registry key after arrangement and the optimized proportion after arrangement according to the space actually occupied by the HIVE file of each registry key and the space occupied by the effective data in the HIVE file after the registry key in the original registry key file and the HIVE file corresponding to the registry key are searched;
and the display unit is used for displaying the space occupied by each registry key before and after sorting and the optimized proportion after sorting to a user.
11. The apparatus of claim 7, further comprising:
and a continuous storage unit for continuously storing the data of the same registry information dispersedly stored in different positions of the disk in the original registry file.
12. The apparatus according to claim 7, wherein the target file acquiring unit includes:
the first detection subunit is used for detecting whether a user sends a request for sorting the registry files, and if so, the registry files need to be sorted to obtain the target files;
or,
and the second detection subunit is used for detecting whether the space occupied by the original registry file reaches a preset threshold value, and if so, the registry file needs to be sorted to obtain the target file.
CN201410418573.6A 2011-09-20 2011-09-20 A kind of registry file method for sorting and device Active CN104166721B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410418573.6A CN104166721B (en) 2011-09-20 2011-09-20 A kind of registry file method for sorting and device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410418573.6A CN104166721B (en) 2011-09-20 2011-09-20 A kind of registry file method for sorting and device
CN201110280181.4A CN102346769B (en) 2011-09-20 2011-09-20 Method and device for consolidating registry file

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN201110280181.4A Division CN102346769B (en) 2011-09-20 2011-09-20 Method and device for consolidating registry file

Publications (2)

Publication Number Publication Date
CN104166721A true CN104166721A (en) 2014-11-26
CN104166721B CN104166721B (en) 2018-03-27

Family

ID=51910534

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410418573.6A Active CN104166721B (en) 2011-09-20 2011-09-20 A kind of registry file method for sorting and device

Country Status (1)

Country Link
CN (1) CN104166721B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1667608A (en) * 2003-12-15 2005-09-14 国际商业机器公司 Method and system of accessing at least one target file in a computer system
CN101000634A (en) * 2007-01-05 2007-07-18 北京握奇数据系统有限公司 Method for realizing arbitrary catalog applied management to telecommunication smart card
CN101777018A (en) * 2010-02-08 2010-07-14 北京同有飞骥科技有限公司 Copying and snapshot combined Windows system protection method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1667608A (en) * 2003-12-15 2005-09-14 国际商业机器公司 Method and system of accessing at least one target file in a computer system
CN101000634A (en) * 2007-01-05 2007-07-18 北京握奇数据系统有限公司 Method for realizing arbitrary catalog applied management to telecommunication smart card
CN101777018A (en) * 2010-02-08 2010-07-14 北京同有飞骥科技有限公司 Copying and snapshot combined Windows system protection method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
YELLOW 转载: "注册表修改技术小集", 《新浪博客》 *

Also Published As

Publication number Publication date
CN104166721B (en) 2018-03-27

Similar Documents

Publication Publication Date Title
US9582511B2 (en) Maintaining versions of data in solid state memory
US8838875B2 (en) Systems, methods and computer program products for operating a data processing system in which a file delete command is sent to an external storage device for invalidating data thereon
JP5886447B2 (en) Location independent files
RU2608668C2 (en) System and method for control and organisation of web-browser cache for offline browsing
RU2629448C2 (en) System and method of controlling and organizing web-browser cash
US9122582B2 (en) File system for maintaining data versions in solid state memory
CN102289451A (en) Method and device for searching files or folders
CN103345411A (en) Method and device for uninstalling application program
US9135162B2 (en) Data versioning in solid state memory
CN102346769B (en) Method and device for consolidating registry file
CN106599247A (en) Method and device for merging data file in LSM-tree structure
US20150160994A1 (en) Investigation program, information processing apparatus, and information processing method
CN110352410A (en) Track the access module and preextraction index node of index node
JP2009129067A5 (en)
CN106503186A (en) A kind of data managing method, client and system
CN104572943B (en) Exempt from installation procedure method for cleaning and device
CN104166721B (en) A kind of registry file method for sorting and device
CN106649756A (en) Log synchronization method and device
CN102346776B (en) Method and device for arranging registry file
CN114428790A (en) A data concurrent processing method, device, electronic device and storage medium
US20170147571A1 (en) File creation
JP6124640B2 (en) Document management apparatus, information processing method, and program
JP5585565B2 (en) File management apparatus, file management apparatus control method, and program thereof
JP5772527B2 (en) Data management system and information processing apparatus
CN111914105A (en) File query method and device and electronic equipment

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20220712

Address after: Room 801, 8th floor, No. 104, floors 1-19, building 2, yard 6, Jiuxianqiao Road, Chaoyang District, Beijing 100015

Patentee after: BEIJING QIHOO TECHNOLOGY Co.,Ltd.

Address before: 100088 room 112, block D, 28 new street, new street, Xicheng District, Beijing (Desheng Park)

Patentee before: BEIJING QIHOO TECHNOLOGY Co.,Ltd.

Patentee before: Qizhi software (Beijing) Co., Ltd

TR01 Transfer of patent right