Process management and control method and device based on hook framework, electronic equipment and storage medium
By loading a hook framework and plugin when the terminal boots up, and listening to and controlling process creation, the system stability problem under multiple operating systems is solved, and the stability and flexibility are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- PRANUS BEIJING TECH CO LTD
- Filing Date
- 2025-12-16
- Publication Date
- 2026-04-21
AI Technical Summary
When multiple operating systems are installed in a terminal, users manually modify the system source code to achieve the same functionality, which can affect the stability of the operating systems.
A process control method based on a hook framework is adopted. By loading the hook framework and preset plugins when the terminal starts up, the system listens for the process creation requests of applications and decides whether to intercept and how to create the process based on the judgment result, thus avoiding direct modification of the system source code.
It improves system stability and flexibility, reduces the workload of porting between systems, supports hot updates and on-demand loading of plugins, and reduces the impact on system performance.
Smart Images

Figure CN121900837A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and more specifically, to a process management method, apparatus, electronic device, and storage medium based on a hook framework. Background Technology
[0002] Terminals (such as mobile phones and computers) have become ubiquitous in people's daily lives. It can be said that people's daily lives are inseparable from terminals. In order to use terminals normally, it is often necessary to install an operating system on the terminal, and then users can use and control the terminal through the operating system.
[0003] In practice, when a user needs to perform a certain function through an application on the terminal (such as enabling Bluetooth), the operating system installed on the terminal will generate a corresponding process to achieve the function. For some users, their terminals have two or more operating systems installed. For convenience, users often consider setting the steps triggered when these multiple operating systems perform the same function to be the same. This requires modifying the system's source code. However, this approach is highly intrusive to the system and will affect the stability of the operating system. Summary of the Invention
[0004] The purpose of this application is to at least solve one of the aforementioned technical defects. The technical solution provided by the embodiments of this application is as follows:
[0005] Firstly, embodiments of this application provide a process management method based on a hook framework, including: In response to the power-on operation, start the first process; The first process loads a first file, a second file, and a third file; the first file is used to load the hook framework, the hook framework is used to instruct the interception of the first process, the first process is the process of creating a second process using the first execution logic; the second process is the process required to run any application of the target terminal, the first process is the parent process of each second process, and is used to listen for the creation request of each second process, and the second file is used to load the preset plugin for running the hook framework. When the first process detects a request from any application to create a second process, it determines whether the application belongs to the preset applications to be intercepted based on a third file, determines the creation method of the second process based on the determination result, and creates the second process based on the creation method.
[0006] Secondly, embodiments of this application provide a process management device based on a hook framework, comprising: The first process startup module is used to start the first process in response to the power-on operation; The file loading module is used to load a first file, a second file, and a third file in the first process. The first file is used to load the hook framework, which is used to instruct the interception of the first process. The first process is the process of creating a second process that adopts the first execution logic. The second process is the process required to run any application of the target terminal. The first process is the parent process of each second process and is used to listen for the creation request of each second process. The second file is used to load the preset plugin for running the hook framework. The process management module is used to determine whether any application belongs to the preset application to be intercepted when the first process listens for the creation request of any application to the second process based on a third file, and to determine the creation method of the second process based on the judgment result, and to create the second process based on the creation method.
[0007] Thirdly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory; The processor executes a computer program to implement the method provided in the first aspect embodiment or any alternative embodiment of the first aspect.
[0008] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the method provided in the first aspect embodiment or any optional embodiment of the first aspect.
[0009] The beneficial effects of the technical solutions provided in this application are: The solution provided in this application embodiment firstly loads a pre-set file for intercepting the system's default process creation process into the first process after the terminal is powered on, so that the hook framework can intercept the process of each application when it needs to be created. Secondly, a pre-defined third file for determining whether application interception is required is loaded into the first process, so that when the first process listens for any application's request to create a second process, it can determine whether to intercept the creation process and re-determine the creation method of the second process based on the determination result.
[0010] The solution provided in this application embodiment implements a custom process generation method through a plugin using an applicable hook framework. The plugin loads when the system service or application starts, eliminating the need to adjust the original system code and improving system stability. Attached Figure Description
[0011] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below.
[0012] Figure 1 A flowchart illustrating a process control method based on a hook framework provided in this application embodiment; Figure 2 This is a schematic diagram of the overall architecture interaction of a process management method based on a hook framework, as an example of an embodiment of this application. Figure 3 A structural block diagram of a process management device based on a hook framework provided in an embodiment of this application; Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0013] The embodiments of this application are described below with reference to the accompanying drawings. It should be understood that the embodiments described below with reference to the accompanying drawings are exemplary descriptions for explaining the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions of the embodiments of this application.
[0014] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the terms “comprising” and “including” as used in embodiments of this application mean that the corresponding feature can be implemented as the presented feature, information, data, step, operation, element, and / or component, but do not exclude implementation as other features, information, data, step, operation, element, component, and / or combinations thereof supported by the art. It should be understood that when we say that an element is “connected” or “coupled” to another element, the one element can be directly connected or coupled to the other element, or it can mean that the one element and the other element establish a connection relationship through an intermediate element. Furthermore, “connected” or “coupled” as used herein can include wireless connection or wireless coupling. The term “and / or” as used herein indicates at least one of the items defined by the term; for example, “A and / or B” can be implemented as “A,” or as “B,” or as “A and B.”
[0015] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0016] The technical solutions of this application and their effects are described below through several exemplary embodiments. It should be noted that the following embodiments can be referenced, borrowed from, or combined with each other. Identical terms, similar features, and similar implementation steps in different embodiments will not be repeated.
[0017] Figure 1This application provides a flowchart illustrating a process control method based on a hook framework. The execution subject of this method can be a terminal (e.g., a computer, mobile phone, etc.) or an intelligent agent, such as... Figure 1 As shown, the method may include: Step S101: In response to the power-on operation, start the first process.
[0018] In the embodiments of this application, the first process can be a Zygote (incubator), that is, the parent process of the corresponding processes created when all applications perform related functions (the processes corresponding to the execution of related functions by all applications are created by the first process).
[0019] Specifically, when a user clicks the power button on the terminal, the terminal will first start its kernel, and then start the first process after the kernel has started.
[0020] Step S102: Load the first file, the second file, and the third file in the first process; the first file is used to load the hook framework, which is used to instruct the interception of the first process, which is a process for creating a second process using the first execution logic; the second process is a process required to run any application of the target terminal, the first process is the parent process of each second process, and is used to listen for the creation request of each second process; the second file is used to load the preset plugin for running the hook framework.
[0021] In the embodiments of this application, each file can be in binary format and can be compiled from a pre-written program module. The first file can be compiled from a system service and application process startup interception module and a hook API (Application Programming Interface) module. The system service and application process startup interception module is used to intercept processes created when various operating system services start and processes created when application-related functions start. The hook API module can be used to obtain the corresponding hook framework. By inputting the API corresponding to the hook framework to be used into this module, the corresponding hook framework can be called. By providing a standardized hook API module, a unified interface specification is provided for the preset plugins, so that the development of plugins with different control functions follows the same programming mode, reducing the development threshold, improving code readability and maintainability, and ensuring the consistency and reliability of hook operations. The second file provides a preset plugin for running the hook framework. In this embodiment, the preset plugin can be an MDM (Mobile Device Management) control plugin (the MDM control plugin implements specific control logic by calling the hook API, decoupling the control function from the system core code, allowing the control logic to be developed, deployed, and updated independently without modifying the system source code or recompiling the system, greatly improving the flexibility and configurability of the control strategy). The hook framework uses a runtime dynamic loading method, automatically loading the MDM control plugin when the system service or application starts, realizing on-demand loading of the control logic, avoiding performance loss during system startup, and supporting hot updates of the control plugin, updating the control strategy without restarting the system, improving the system's availability and flexibility. The second process can be a child process of the first process, and each second process will be created by the first process. The third file can be used to record relevant configuration information of the hook framework, such as which application process creation processes are intercepted, and the running logic adopted by the new second process after interception, etc.
[0022] Specifically, when the first process starts, the system reads the file with the preset identifier and loads it into the first process. Therefore, the first file, the second file and the third file in this embodiment of the application will all have the preset identifier before being stored in the terminal so that the system can identify and load them into the first process so that the first process can run the hook framework.
[0023] It should be noted that the first file, the second file, and the third file in this application embodiment are all pre-written with corresponding code, compiled into corresponding binary files, and stored in the terminal in advance. The binary format ensures the security and execution efficiency of the code and avoids the performance problems and security risks that scripting languages may bring.
[0024] Step S103: When the first process listens to any application's request to create the second process, it determines whether any application belongs to the preset applications to be intercepted based on the third file, determines the creation method of the second process based on the determination result, and creates the second process based on the creation method.
[0025] Specifically, when any application needs to perform certain functions, it needs to request the corresponding process creation request from the first process. After listening to the creation request, the first process can determine whether the original process creation process of the application needs to be intercepted based on whether the application is recorded in the already loaded third file, and determine how to create the second process (i.e., use the original default method or use a new method to create it) based on the judgment result.
[0026] The solution provided in this application embodiment firstly loads a pre-set file for intercepting the system's default process creation process into the first process after the terminal is powered on, so that the hook framework can intercept the process of each application when it needs to be created. Secondly, a pre-defined third file for determining whether application interception is required is loaded into the first process, so that when the first process listens for any application's request to create a second process, it can determine whether to intercept the creation process and re-determine the creation method of the second process based on the determination result.
[0027] The solution provided in this application embodiment implements a custom process generation method through a plugin using an applicable hook framework. The plugin loads when the system service or application starts, eliminating the need to adjust the original system code and improving system stability.
[0028] Meanwhile, the hook framework in this application adopts a standardized module design and a unified hook API interface. This allows the core hook framework code and hook API interface to be completely reused when porting between different versions of the same operating system or different device models. Only minor adaptation modifications are needed to address the differences in the underlying interfaces of different system versions or device models, without rewriting the entire process call logic code. Compared to traditional solutions that require rewriting and integrating all code for each system version or device model, the porting workload of this application is reduced, the porting cycle is greatly shortened, and deployment efficiency and maintainability within the same operating system ecosystem are significantly improved.
[0029] Based on the above embodiments, as an optional embodiment, if the determination result is that any application belongs to a preset application to be intercepted, the creation method specifically includes: Obtain the second execution logic of the second process and create a second process that adopts the second execution logic.
[0030] In embodiments of this application, the second execution logic may be newly designed execution logic for the second process.
[0031] Specifically, when an application is an application to be intercepted, the hook framework will intercept its original first process of creating a second process and then generate a second process using the second execution logic. This achieves the goal of generating a second process using the new execution logic without modifying the system source code, thus ensuring the integrity and stability of the system.
[0032] Based on the above embodiments, as an optional embodiment, to obtain the second execution logic of the second process, the method further includes: Establish a long-lived connection between the terminal and the server; Receive and store the second execution logic sent by the server.
[0033] In the embodiments of this application, the server can be located independently of the cloud outside the terminal, and can send new execution logic for the execution of a second process to the terminal in real time. A long-lived connection refers to a transmission connection established between a client and a server during network communication that is not immediately disconnected after a data exchange, but remains a persistent and reusable session channel. Its validity can be maintained through program keep-alive and heartbeat mechanisms to avoid interruption due to prolonged lack of data exchange in NAT, router, or carrier network environments.
[0034] Specifically, in this embodiment, a preset client for managing various applications can be pre-installed in the terminal. A long connection can be established with the server through the preset client. After the third file is read, the configuration information therein can be stored in the preset client. When the server sends the second execution logic of the second process to be created when a certain application performs a certain function to the preset client, the second execution logic can be stored through the preset client so that it can be read and the corresponding second process can be created based on the second execution logic when the corresponding second process is created later.
[0035] Based on the above embodiments, as an optional embodiment, the method further includes: The terminal receives the third execution logic sent by the server; wherein the third execution logic is the same as the second process pointed to by the second execution logic. Replace the second execution logic stored in the terminal with the third execution logic.
[0036] In embodiments of this application, the third execution logic may be a new execution logic for a second process of a certain application that needs to be modified and sent by the server.
[0037] Specifically, when the server sends a new third execution logic for a certain identical second process to a preset client on the terminal, if the preset client has the second execution logic of the second process stored in it, then the second execution logic can be replaced with the third execution logic to achieve real-time updates of the execution logic.
[0038] Based on the above embodiments, as an optional embodiment, if the determination result is that any application does not belong to the preset applications to be intercepted, the creation method further includes: Create a second process that uses the first execution logic.
[0039] Specifically, when the application is not among the applications that need to be intercepted, the first process will create the second process in the original system default way, that is, without changing the default execution logic of the second process.
[0040] Based on the above embodiments, as an optional embodiment, the hook framework includes an interception module and an API call module; The interception module is used to instruct the interception of the first process; the API call module is used to call the hook function selected by the hook framework from the preset API library. The hook function is used to characterize the interception method of the first process; the preset API library stores APIs for multiple hook functions.
[0041] Specifically, as mentioned above, the first file in this application embodiment is compiled from the aforementioned interception module and hookAPI framework, and the first file itself is used to load the hook framework.
[0042] The hook framework in this application allows for the selection of different hook functions to intercept the first-stage process based on actual needs. Each selectable hook function, along with its corresponding API, is stored in a pre-defined API library. When a specific hook function needs to be called, its corresponding API can be input into the hook API module, which then enables the call to the corresponding hook function.
[0043] It should be noted that the hook framework in this application adopts a modular architecture design, separating the interception module, hookAPI module, MDM management plugin, configuration files, etc. Each module has a clear responsibility and low coupling, which facilitates independent development, testing and maintenance, and improves the maintainability and scalability of the framework.
[0044] Based on the above embodiments, as an optional embodiment, the creation method of the second process is determined according to the judgment result, and the second process is created based on the creation method, specifically including: If the determination result is that any application is within the application scope and the current time is within the preset time interval, then a second process using the first execution logic is created.
[0045] Specifically, in the embodiments of this application, the time period for intercepting the first process can also be customized. For example, when it is determined that the default second system creation process (i.e. the first process) of an application needs to be intercepted by the hook framework, and the user does not want the process to be intercepted by the hook framework at the current time, the time period can be set as a preset time interval. In this way, if the first process is determined to need to be intercepted within the preset interval at the current time, the first process will still use the first process to create the second process of the application.
[0046] Optionally, in addition to setting a preset time interval, this application embodiment can also set a preset geographical location, that is, when the terminal is in a preset area, the first process that is determined to be intercepted can also not be intercepted.
[0047] The following is combined Figure 2 This paper introduces the overall process management method based on a hook framework provided in the embodiments of this application, such as... Figure 2 As shown: First, in this embodiment, a first file, a second file, and a third file are pre-written and compiled, and then stored in the terminal. (These files are used to modify the control methods of some applications in the system (i.e., hook technology). For example, for Bluetooth, the system's default control method is to control its on or off state by using the attribute value of the first preset field (0 or 1). If the system loads the preset configuration file, it can use the attribute value of the second preset field in the preset configuration file to control its on or off state. The attribute value of the second preset field can be 0 or 1, or other characters.) At the same time, a preset client is also installed in the terminal (when the execution logic of a certain process needs to be modified, it can receive data from the server through the preset client). Each file can be regarded as an application, but it exists in the form of a binary file (after the program is written, it is compiled into a binary file). Each file is set with a preset identifier, which can be read by the first process when the terminal's system starts.
[0048] After the written files are stored in the terminal, during the terminal restart process (corresponding to stage 1 in the diagram), the kernel will start first. After the kernel starts, the first process will start. When the first process starts, it will read all files with preset identifiers. At this time, the above files will be read. The first file will be read and loaded first. After the file is read and loaded, the system will start the corresponding hook framework and initialize the preset API library corresponding to the hook framework. After initialization, the second file will be loaded to run the preset plugin of the hook framework. At the same time, the third file will be loaded to obtain the corresponding configuration information.
[0049] After the terminal system starts up, the pre-installed client on the terminal will establish a long connection with the server (corresponding to stage 2 in the figure). The purpose of establishing the connection is that the user can send new execution logic about a certain second process to the pre-installed client in real time from the server. When the pre-installed client receives the new execution logic sent by the server, it can modify the execution logic of the corresponding second process that has been stored in real time, so as to realize the real-time adjustment of the execution strategy.
[0050] The first process then monitors each service or application in real time. When a service or application needs to start and execute a function, the hook framework loads and calls the code of the preset plugin. The preset plugin can hook the original first process of generating the second process (corresponding to stage 3 in the diagram). After hooking the first process, the preset plugin will further determine whether the interception conditions are met (such as whether the service or application process is within the interception range, whether the current time is within the preset time interval, or whether the current geographical location is within the preset area, etc.). Based on the result of whether the interception conditions are met, the corresponding subsequent process is executed. After the execution is completed, the corresponding execution result is returned to the corresponding service or application (that is, the second process is generated according to the original first process or a second process with new execution logic is generated).
[0051] Figure 3 A structural block diagram of a process management device based on a hook framework provided in this application embodiment is shown below. Figure 3 As shown, the process management device 300 based on the hook framework may include: a first process startup module 301, a file loading module 302, and a process management module 303, wherein, The first process startup module 301 is used to start the first process in response to the power-on operation; The file loading module 302 is used to load a first file, a second file, and a third file in the first process; the first file is used to load a hook framework, which is used to instruct the interception of the first process, which is a process for creating a second process using the first execution logic; the second process is a process required to run any application of the target terminal, the first process is the parent process of each second process, and is used to listen for the creation requests of each second process; the second file is used to load a preset plugin for running the hook framework. The process control module 303 is used to determine whether any application belongs to the preset application to be intercepted based on a third file when the first process listens for any application's request to create the second process. Based on the determination result, it determines the creation method of the second process and creates the second process based on the creation method.
[0052] The solution provided in this application embodiment firstly loads a pre-set file for intercepting the system's default process creation process into the first process after the terminal is powered on, so that the hook framework can intercept the process of each application when it needs to be created. Secondly, a pre-defined third file for determining whether application interception is required is loaded into the first process, so that when the first process listens for any application's request to create a second process, it can determine whether to intercept the creation process and re-determine the creation method of the second process based on the determination result.
[0053] The solution provided in this application embodiment implements a custom process generation method through a plugin using an applicable hook framework. The plugin loads when the system service or application starts, eliminating the need to adjust the original system code and improving system stability.
[0054] Based on the above embodiments, as an optional embodiment, if the determination result is that any application belongs to a preset application to be intercepted, the process control module is specifically used for: Obtain the second execution logic of the second process, and create the second process that adopts the second execution logic.
[0055] Based on the above embodiments, as an optional embodiment, the device further includes a long connection establishment module, specifically used for: Establish a long-lived connection between the terminal and the server; Receive and store the second execution logic sent by the server.
[0056] Based on the above embodiments, as an optional embodiment, the device further includes an execution logic receiving module, specifically used for: The terminal receives the third execution logic sent by the server; wherein the third execution logic is the same as the second process pointed to by the second execution logic. Replace the second execution logic stored in the terminal with the third execution logic.
[0057] Based on the above embodiments, as an optional embodiment, if the determination result is that any application does not belong to the preset applications to be intercepted, the process management module can also be used for: Create a second process that uses the first execution logic.
[0058] Based on the above embodiments, as an optional embodiment, the hook framework includes an interception module and an API call module; The interception module is used to instruct the first process to be intercepted. The API call module is used to call the hook function selected by the hook framework from the preset API library. The hook function is used to represent the interception method of the first process. The preset API library stores APIs for multiple hook functions.
[0059] Based on the above embodiments, as an optional embodiment, the process management module can also be used for: If the determination result is that any application is within the application scope and the current time is within the preset time interval, then a second process using the first execution logic is created.
[0060] The following is for reference. Figure 4 It illustrates an electronic device suitable for implementing embodiments of this application (e.g., performing...). Figure 1 The diagram shows the structure of the terminal device or server 400 of the method shown. The electronic devices in the embodiments of this application may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), wearable devices, etc., as well as fixed terminals such as digital TVs, desktop computers, etc. Figure 4 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0061] The electronic device includes a memory and a processor. The memory stores a program for executing the methods described in the above-described method embodiments; the processor is configured to execute the program stored in the memory. The processor may be referred to as processing device 401 as described below, and the memory may include at least one of read-only memory (ROM) 402, random access memory (RAM) 403, and storage device 408 as described below, as follows: like Figure 4 As shown, electronic device 400 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 401, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 402 or a program loaded from storage device 408 into random access memory (RAM) 403. RAM 403 also stores various programs and data required for the operation of electronic device 400. Processing device 401, ROM 402, and RAM 403 are interconnected via bus 404. Input / output (I / O) interface 405 is also connected to bus 404.
[0062] Typically, the following devices can be connected to I / O interface 405: input devices 406 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 407 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 408 including, for example, magnetic tapes, hard disks, etc.; and communication devices 409. Communication device 409 allows electronic device 400 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 4 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have alternatively.
[0063] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 409, or installed from storage device 408, or installed from ROM 402. When the computer program is executed by processing device 401, it performs the functions defined in the methods of embodiments of this application.
[0064] It should be noted that the computer-readable storage medium described above in this application can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0065] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0066] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0067] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: In response to the boot operation, a first process is started; a first file, a second file, and a third file are loaded in the first process; the first file is used to load the hook framework, which is used to instruct the interception of the first process, which is the process of creating a second process using the first execution logic; the second process is the process required to run any application on the target terminal, the first process is the parent process of each second process, and is used to listen for the creation requests of each second process, the second file is used to load the preset plugins for running the hook framework; when the first process listens for the creation request of any application for the second process, it determines whether any application belongs to the preset applications to be intercepted based on the third file, determines the creation method of the second process based on the determination result, and creates the second process based on the creation method.
[0068] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0069] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0070] The modules or units described in the embodiments of this application can be implemented in software or hardware. The names of modules or units do not necessarily limit the specific unit; for example, a first constraint acquisition module can also be described as a "module for acquiring the first constraint".
[0071] The functions described above in this document can be performed at least in part by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), complex programmable logic devices (CPLDs), and so on.
[0072] In the context of this application, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0073] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0074] The above description is only a partial embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A process management method based on a hook framework, characterized in that, Applied to terminals, including: In response to the power-on operation, start the first process; In the first process, a first file, a second file, and a third file are loaded; the first file is used to load a hook framework, which is used to instruct the interception of the first process, which is a process for creating a second process using a first execution logic; the second process is a process required to run any application of the target terminal, the first process is the parent process of each second process, and is used to listen for the creation requests of each second process, and the second file is used to load a preset plugin for running the hook framework. When the first process detects a request from any application to create the second process, it determines whether the application belongs to a preset list of applications to be intercepted based on the third file, determines the creation method of the second process based on the determination result, and creates the second process based on the creation method.
2. The method according to claim 1, characterized in that, If the determination result indicates that any of the applications belongs to a preset application to be intercepted, the creation method includes: Obtain the second execution logic of the second process, and create the second process that adopts the second execution logic.
3. The method according to claim 2, characterized in that, Prior to obtaining the second execution logic of the second process, the following is included: Establish a long-lived connection between the terminal and the server; Receive and store the second execution logic sent by the server.
4. The method according to claim 3, characterized in that, The method further includes: The terminal receives a third execution logic sent by the server; wherein the third execution logic is the same as the second process pointed to by the second execution logic. Replace the second execution logic stored in the terminal with the third execution logic.
5. The method according to claim 2, characterized in that, If the determination result indicates that any of the applications does not belong to the preset applications to be intercepted, the creation method includes: Create a second process that adopts the first execution logic.
6. The method according to claim 1, characterized in that, The hook framework includes an interception module and an API call module; The interception module is used to instruct the first process to be intercepted; The API call module is used to call the hook function selected by the hook framework from the preset API library. The hook function is used to characterize the interception method of the first process. The preset API library stores APIs for multiple hook functions.
7. The method according to claim 1, characterized in that, The step of determining the creation method of the second process based on the judgment result, and creating the second process based on the creation method, includes: If the determination result is that any of the applications is within the scope of the application and the current time is within the preset time interval, then the second process using the first execution logic is created.
8. A process management device based on a hook framework, characterized in that, include: The first process startup module is used to start the first process in response to the power-on operation; The file loading module is used to load a first file, a second file, and a third file in the first process; the first file is used to load a hook framework, which is used to instruct the interception of the first process, which is a process of creating a second process using a first execution logic; The second process is the process required to run any application of the target terminal. The first process is the parent process of each second process and is used to listen for the creation request of each second process. The second file is used to load the preset plugin for running the hook framework. The process control module is used to determine whether any application belongs to the preset application to be intercepted based on the third file when the first process listens for the creation request of any application to the second process, and to determine the creation method of the second process based on the determination result, and to create the second process based on the creation method.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the method of any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1-7.