Detailed Description
In order to make the objects, features and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The method for closing the software compatible mode provided by the embodiment of the invention is suitable for the scene that the software cannot operate correctly in the compatible mode. An operating system list is established in advance, and the system environment of the operating system versions contained in the operating system list cannot enable software to run correctly. And when detecting that the compatible mode of the software is started, acquiring path information for starting the compatible mode of the software. Analyzing the path information to obtain the system information of the operating system of the software in the compatible mode, judging whether the operating system is in a pre-established operating system list, and if the operating system is in the pre-established operating system list, deleting the path information for starting the software compatible mode, namely successfully closing the software compatible mode.
In the embodiment of the present invention, the terminal may include: examples of the Device include, but are not limited to, a mobile phone, a PAD (Portable Android Device), a notebook computer, and a Personal Digital Assistant (PDA). The method for turning off the software compatible mode provided by the embodiment of the invention will be specifically described below by directly taking the terminal as an illustration.
The operating system refers to a computer program for managing and controlling hardware and software resources of a computer, and is the most basic system software directly running on a terminal, and any other software can run only under the support of the operating system.
The registry may be a database in the Windows operating system, and is used to store the setting information of the system and the application program.
Referring to fig. 1, fig. 1 is a flowchart illustrating a method for closing a software compatibility mode according to a first embodiment of the present invention, where the method for closing the software compatibility mode is applicable to a terminal, and the method includes the following steps:
s101, after the compatible mode of the software is started, acquiring an executable program file of the software in a registry, wherein the executable program file comprises operating system information of the software in the compatible mode;
compatible mode refers to a functional mode that an operating system provides to ensure that legacy software can run in its environment. For example, if the software opens the compatible mode of the Windows XP operating system under the Windows 10 operating system, the software installed under the Windows 10 operating system will actually run under the Windows XP operating system environment.
An executable program File (EXE File) refers to a program File that can be directly run. Under the Windows operating system, such a file extension is ". exe".
Specifically, according to the principle that the Windows operating system sets the software compatibility mode, if the software sets the compatibility mode, Windows stores a file in the registry to indicate that the software opens the compatibility mode. The file is an executable program file of the software. The file comprises data information set by the Windows operating system in a compatible mode for the software. For example, the path of the registry may be: HKEY _ CURRENT _ USER \ Software \ Microsoft \ Windows \ Currentversion \ AppCompatFlags \ Layers. Under this path the Windows operating system creates a software executable program file.
S102, reading an operating system in the executable program file, traversing a preset operating system list, and judging whether the operating system is in the preset operating system list;
the operating systems in the preset operating system list refer to operating systems which can not enable software to run correctly. And reading the operating system information of the software in the executable program file in the compatible mode, traversing a preset operating system list, and judging whether the operating system of the software in the compatible mode is in the preset operating system list.
S103, if the operating system is in the preset operating system list, deleting the executable program file of the software.
If the operating system is in the preset operating system list, the user is indicated to start the compatible mode, and the software runs in the operating system in the compatible mode. At this time, the executable program file of the software, i.e., the data information representing that the software compatible mode is deleted, i.e., the compatible mode is successfully closed.
The preset operating system list refers to an array of system versions of a preset defined Windows compatible mode, and the array comprises all operating system versions in the compatible mode environment.
In the embodiment of the invention, after the compatible mode of the software is started, the executable program file of the software in the registry is obtained, then the operating system information in the executable program file is read, the preset operating system list is traversed, whether the operating system is in the preset operating system list is judged, if the operating system is in the preset operating system list, the executable program file of the software is deleted, and the compatible mode of the software can be successfully closed.
Referring to fig. 2, fig. 2 is a method for closing a software compatible mode according to a second embodiment of the present invention, including the following steps:
s201, after the compatible mode of the software is started, constructing an object, and acquiring an executable program file of the software in a registry according to the object, wherein the executable program file comprises operating system information of the software in the compatible mode;
and constructing an object, and reading an executable program file of the software according to the object.
Specifically, the function of the object is mainly to read the registry. The objects include an open function, a set function, a read function, a delete function, and a close function. In the embodiment of the present invention, the object is defined as a Regkey object, for example.
The object is a computer language taking a computer as a carrier, refers to an instance of a class loaded in a memory, has related member variables and member functions, and can be regarded as an object in all aspects occupying the actual memory. Such as functions, created threads, files, etc.
And acquiring a registry handle of the registry and an executable program file path of the software according to the object.
Specifically, an Open function (Open function) of the Regkey object is called, a registry path of the registry is opened, and a registry handle of the registry is saved.
It should be noted that any key value of the registry can be opened to obtain the handle of the registry, and this method is the prior art and will not be described herein again. For example, the key HKEY _ CURRENT _ USER \ Software \ Microsoft \ windows \ CurrentVersion \ AppCompatFlags \ Layers of the registry may be opened to obtain the registry handle of the registry.
The handle is a parameter used for identifying different objects, each object has a unique handle, and the application program can access the information of the corresponding object through the handle.
Further, a set function (setAppPath) of the Regkey object is called, and the path of the executable program file of the software under the path of the registry is saved.
Further, a read function (readValue) of the Regkey object is called, and the registry handle and the executable program file path of the software are opened, and the executable program file of the software is read.
Specifically, an executable program file path of the software is opened, a read function (readValue) of a Regkey object is called, information in the executable program file of the software is read through the registry handle, and the executable program file comprises operating system information of the software in a compatible mode.
S202, reading an operating system in the executable program file, traversing a preset operating system list, and judging whether the operating system is in the preset operating system list;
the operating systems in the preset operating system list refer to operating systems which can not enable software to run correctly. And reading the operating system information of the software in the compatible mode in the executable program file, traversing a preset operating system list, and judging whether the operating system of the software in the compatible mode is in the preset operating system list. That is, it is determined whether the operating system of the software in the compatible mode is an operating system that does not enable the software to operate correctly.
And S203, if the operating system is in the preset operating system list, deleting the executable program file of the software.
For example, if the operating system of the software in the compatible mode is Windows XP, and the operating systems in the preset operating system list include Windows 95, Windows 2000, Windows XP, and the like, the operating system of the software in the compatible mode is in the preset operating system list, that is, the operating system of the software in the compatible mode is an operating system which cannot enable the software to correctly run.
Further, a delete function (deleteValue) of the Regkey object is called, and a path and a registry handle of the opened executable program file are called. And deleting the executable program file of the software through the path and the registry handle of the opened executable program file, namely deleting the setting record of the software compatible mode, and successfully closing the software compatible mode.
And calling a close function (close) of the Regkey object, closing the registry handle of the registry, and finishing the change of the registry.
For further details of the embodiments of the present invention, please refer to the description of the embodiment shown in fig. 1.
In the embodiment of the invention, after the compatible mode of the software is started, the executable program file of the software in the registry is obtained, then the operating system information in the executable program file is read, the preset operating system list is traversed, whether the operating system is in the preset operating system list is judged, if the operating system is in the preset operating system list, the executable program file of the software is deleted, and the compatible mode of the software can be successfully closed.
Referring to fig. 3, fig. 3 is a schematic structural diagram of a device for turning off a software compatible mode according to a third embodiment of the present invention, where the device for turning off a software compatible mode may be built in a terminal, and is used to execute the method for turning off a software compatible mode in the embodiment shown in fig. 1, where the device includes: an acquisition module 301, a reading module 302, a judgment module 303 and a deletion module 304.
An obtaining module 301, configured to obtain an executable program file of the software in the registry after the software starts the compatible mode, where the executable program file includes operating system information of the software in the compatible mode;
compatible mode refers to a functional mode that an operating system provides to ensure that legacy software can run in its environment. For example, if the software opens the compatible mode of the Windows XP operating system under the Windows 10 operating system, the software installed under the Windows 10 operating system will actually run under the Windows XP operating system environment.
An executable program File (EXE File) refers to a program File that can be directly run. Under the Windows operating system, such a file extension is ". exe".
Specifically, according to the principle that the Windows operating system sets the software compatibility mode, if the software sets the compatibility mode, Windows stores a file in the registry to indicate that the software opens the compatibility mode. The file is an executable program file of the software. The file comprises data information set by the Windows operating system in a compatible mode for the software. For example, the path of the registry may be: HKEY _ CURRENT _ USER \ Software \ Microsoft \ Windows \ Currentversion \ AppCompatFlags \ Layers. Under this path the Windows operating system creates a software executable program file.
A reading module 302, configured to read an operating system in the executable program file;
the judging module 303 is configured to traverse a preset operating system list and judge whether the operating system is in the preset operating system list;
the operating systems in the preset operating system list refer to operating systems which can not enable software to run correctly. And traversing the preset operating system list, and judging whether the operating system of the software in the compatible mode is in the preset operating system list.
A deleting module 304, configured to delete the executable program file of the software if the operating system is in the preset operating system list.
If the operating system is in the preset operating system list, the user is indicated to start the compatible mode, and the software runs in the operating system in the compatible mode. At this time, the executable program file of the software, i.e., the data information representing that the software compatible mode is deleted, i.e., the compatible mode is successfully closed.
For further details of the embodiments of the present invention, please refer to the description of the example shown in fig. 1 and fig. 2.
In the embodiment of the invention, after the compatible mode of the software is started, the executable program file of the software in the registry is obtained, then the operating system information in the executable program file is read, the preset operating system list is traversed, whether the operating system is in the preset operating system list is judged, if the operating system is in the preset operating system list, the executable program file of the software is deleted, and the compatible mode of the software can be successfully closed.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a device for turning off a software compatible mode according to a fourth embodiment of the present invention, where the device for turning off a software compatible mode can be built in a terminal, and is used to execute the method for turning off a software compatible mode in the embodiments shown in fig. 1 to 2, and the device is different from the device shown in fig. 3 in that:
further, the obtaining module 301 includes:
an object construction module 3011 for constructing an object, the object for reading the registry;
the function of the object is mainly to read the registry. In the embodiment of the present invention, the object is defined as a Regkey object, for example.
An open function calling module 3012, configured to call an open function of the object, open a registry path of the registry, and store a registry handle of the registry;
and calling an Open function of the Regkey object, opening a registry path of the registry, and storing a registry handle of the registry.
A set function calling module 3013, configured to call a set function of the object, and store an executable program file path of the software in the registry path;
and calling a setappPath function of the Regkey object, and saving the path of the executable program file of the software under the path of the registry.
The read function calling module 3014 is configured to call a read function of the object, open a registry handle and an executable program file path of the software, and read an executable program file of the software.
And opening an executable program file path of the software, calling a readValue function of the Regkey object, and reading information in the executable program file of the software through the registry handle, wherein the executable program file comprises operating system information of the software in a compatible mode.
Further, the deleting module 304 is specifically configured to invoke the deleteValue function of the Regkey object, open the registry handle and the executable program file path of the software, and delete the software executable program file.
And calling a delete function (deleteValue) of the Regkey object through the path and the registry handle of the opened executable program file, deleting the executable program file of the software, namely the setting record which shows that the compatible mode of the software is deleted, and successfully closing the compatible mode of the software.
Further, the apparatus further comprises:
the Close function calling module 305 is configured to call a Close function of the Regkey object to Close the registry handle of the registry, and complete the change of the registry.
For further details of the embodiments of the present invention, please refer to the descriptions of the examples shown in fig. 1, fig. 2 and fig. 3.
In the embodiment of the invention, after the compatible mode of the software is started, the executable program file of the software in the registry is obtained, then the operating system information in the executable program file is read, the preset operating system list is traversed, whether the operating system is in the preset operating system list is judged, if the operating system is in the preset operating system list, the executable program file of the software is deleted, and the compatible mode of the software can be successfully closed.
Referring to fig. 5, fig. 5 shows a hardware configuration diagram of a terminal.
The terminal described in this embodiment includes:
a memory 51, a processor 52 and a computer program stored on the memory 51 and executable on the processor, the processor implementing the method of switching off the software compatibility mode described in the embodiments of fig. 1 to 4 as described above when executing the program.
Further, the terminal further includes:
at least one input device 53; at least one output device 54.
The memory 51, the processor 52, the input device 53 and the output device 54 are connected by a bus 55.
The input device 53 may be a camera, a touch panel, a physical button, or a mouse. The output device 54 may specifically be a display screen.
The Memory 51 may be a high-speed Random Access Memory (RAM) Memory or a non-volatile Memory (non-volatile Memory), such as a disk Memory. The memory 51 is used for storing a set of executable program codes, and the processor 52 is coupled to the memory 51.
Further, an embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium may be provided in the terminal in the foregoing embodiments, and the computer-readable storage medium may be the memory in the foregoing embodiment shown in fig. 5. The computer-readable storage medium has stored thereon a computer program which, when executed by a processor, implements the method of turning off the software compatibility mode described in the embodiments of fig. 1-2 above. Further, the computer-readable storage medium may be various media that can store program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
It should be noted that each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode.
The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be substantially or partially embodied in the form of a software product, or all or part of the technical solution that contributes to the prior art.
It should be noted that, for the sake of simplicity, the above-mentioned method embodiments are described as a series of acts or combinations, but those skilled in the art should understand that the present invention is not limited by the described order of acts, as some steps may be performed in other orders or simultaneously according to the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no acts or modules are necessarily required of the invention.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the above description, for a person skilled in the art, there are variations on the specific implementation and application scope according to the ideas of the embodiments of the present invention, and in summary, the content of the present specification should not be construed as a limitation to the present invention.