CN114416219A - System function calling method and device, electronic equipment and readable medium - Google Patents

System function calling method and device, electronic equipment and readable medium Download PDF

Info

Publication number
CN114416219A
CN114416219A CN202111678012.6A CN202111678012A CN114416219A CN 114416219 A CN114416219 A CN 114416219A CN 202111678012 A CN202111678012 A CN 202111678012A CN 114416219 A CN114416219 A CN 114416219A
Authority
CN
China
Prior art keywords
function
springboard
dynamic link
link library
called
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
CN202111678012.6A
Other languages
Chinese (zh)
Other versions
CN114416219B (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 58 Information Technology Co Ltd
Original Assignee
Beijing 58 Information Technology 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 58 Information Technology Co Ltd filed Critical Beijing 58 Information Technology Co Ltd
Priority to CN202111678012.6A priority Critical patent/CN114416219B/en
Publication of CN114416219A publication Critical patent/CN114416219A/en
Application granted granted Critical
Publication of CN114416219B publication Critical patent/CN114416219B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the invention provides a system function calling method, a device, electronic equipment and a readable medium, wherein the method comprises the following steps: when a current function is called in an application program, a dynamic link library of the application program is called; the dynamic link library comprises a springboard function, the springboard function has a corresponding function address, and the function address is a function address of a system function in the system library; if the dynamic link library comprises a target springboard function corresponding to the current function, the target springboard function calls the system function in the dynamic link library through the function address; and calling the target springboard function after the system function is called in the application program. When the system function needs to be called in the application program, the embodiment of the invention indirectly calls the system function through the springboard function in the dynamic link library, thereby improving the calling efficiency of the system function.

Description

System function calling method and device, electronic equipment and readable medium
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to a system function calling method, a system function calling device, electronic equipment and a computer readable medium.
Background
The system library packages and stores some functions as system functions for corresponding calling of users. The system library needs to be relied on in the development process of the Application program (App), so the Application program often needs to access the system library to call the system function.
Currently, to call a system function in a system library, bind information in a data segment needs to be dynamically modified (a bind is a resource pointer outside a pointed mirror) when an application program runs, so that the application program can call a required system function based on the modified bind information. However, if the application is a large application, the corresponding bind information is also large, and it is time-consuming to search and modify the bind information in the application, resulting in inefficient calling of system functions.
Disclosure of Invention
The embodiment of the invention provides a system function calling method, a system function calling device, electronic equipment and a computer readable storage medium, and aims to solve the problem of low calling efficiency of a system function.
The embodiment of the invention discloses a system function calling method, which comprises the following steps:
when a current function is called in an application program, a dynamic link library of the application program is called; the dynamic link library comprises a springboard function, the springboard function has a corresponding function address, and the function address is a function address of a system function in the system library;
if the dynamic link library comprises a target springboard function corresponding to the current function, the target springboard function calls the system function in the dynamic link library through the function address;
and calling the target springboard function after the system function is called in the application program.
Optionally, before the calling the dynamic link library of the application program when the current function is called in the application program, the method further includes:
setting an overlay system function in an executable file of an application program; the covering system function and the system function in the system library have the same function identification and function attribute parameters;
adding a springboard function corresponding to the coverage system function in a dynamic link library of the application program; the function identification of the springboard function is different from the function identification of the coverage system function, and the function attribute parameters are the same, and the springboard function is provided with a function address of the system function.
Optionally, if the dynamic link library includes a target springboard function corresponding to the current function, the target springboard function calls the system function in the dynamic link library through the function address, including:
and if the function identification of the target springboard function corresponding to the function identification of the current function is contained in the dynamic link library, calling the system function by the target springboard function in the dynamic link library through the function address.
Optionally, after the invoking the dynamically linked library of the application, the method further includes:
and if the dynamic link library contains a target function to be called corresponding to the current function, calling the target function to be called.
Optionally, if the dynamic link library includes a target function to be called corresponding to the current function, calling the target function to be called includes:
and if the function identification of the function to be called corresponding to the function identification of the current function is included in the dynamic link library, calling the function to be called.
Optionally, the system function comprises a C function library C function.
The embodiment of the invention also discloses a system function calling device, which comprises:
the current function calling module is used for calling a dynamic link library of the application program when the current function is called in the application program; the dynamic link library comprises a springboard function, the springboard function has a corresponding function address, and the function address is a function address of a system function in the system library;
a system function calling module, configured to, if a target springboard function corresponding to the current function is included in the dynamic link library, call, by the target springboard function, the system function in the dynamic link library through the function address;
and the springboard function calling module is used for calling the target springboard function after the system function is called in the application program.
Optionally, the apparatus further comprises: the springboard function setting module is used for setting an overlay system function in an executable file of the application program; the covering system function and the system function in the system library have the same function identification and function attribute parameters; adding a springboard function corresponding to the coverage system function in a dynamic link library of the application program; the function identification of the springboard function is different from the function identification of the coverage system function, and the function attribute parameters are the same, and the springboard function is provided with a function address of the system function.
Optionally, the system function calling module is configured to, if the function identifier of the target springboard function corresponding to the function identifier of the current function is included in the dynamic link library, call, by the target springboard function, the system function in the dynamic link library through the function address.
Optionally, the apparatus further comprises: and the function calling module to be called is used for calling the target function to be called if the dynamic link library contains the target function to be called corresponding to the current function.
Optionally, the function to be called calls the function to be called if the function identifier of the function to be called corresponding to the function identifier of the current function is included in the dynamic link library.
The embodiment of the invention also discloses electronic equipment which comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory finish mutual communication through the communication bus;
the memory is used for storing a computer program;
the processor is configured to implement the method according to the embodiment of the present invention when executing the program stored in the memory.
Also disclosed are one or more computer-readable media having instructions stored thereon, which, when executed by one or more processors, cause the processors to perform a method according to an embodiment of the invention.
The embodiment of the invention also discloses a computer program product, which is stored in a storage medium and is executed by at least one processor to realize the method according to the embodiment of the invention.
The embodiment of the invention has the following advantages:
in the embodiment of the invention, a springboard function is set in a dynamic link library of an application program, wherein the function address of the springboard function is the function address of a system function, when the current function is called in the application program, if a target springboard function corresponding to the current function is included in the dynamic link library, the target springboard function calls the system function in the dynamic link library through the function address, and then the target springboard function after the system function is called can be called in the application program. According to the embodiment of the invention, when the system function needs to be called in the application program, the system function is indirectly called through the springboard function in the dynamic link library, and because the system function is not directly called in the application program, the bind information in the application program does not need to be searched and modified, and the calling efficiency of the system function is improved.
Drawings
FIG. 1 is a flowchart illustrating steps of a method for invoking a system function according to an embodiment of the present invention;
fig. 2 is a block diagram of a structure for implementing a system function call provided in an embodiment of the present invention;
FIG. 3 is a flowchart illustrating indirect invocation of a system function in an application according to an embodiment of the present invention;
fig. 4 is a block diagram of a system function call apparatus provided in the embodiment of the present invention.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
First, some technical terms involved in the embodiments of the present invention are described:
hook: the hooking technology is a technology that can replace a certain function of an application program with another function to be executed, and the hooking technology can be used for modifying the function of the execution logic of the certain function of the application program.
AOP: in the software industry, AOP refers to Aspect organized Programming, meaning: the method is a technique for realizing the unified maintenance of the program functions by a precompilation mode and a dynamic proxy during the running process in the aspect-oriented programming. The AOP is a continuation of OOP (Object Oriented Programming), is a hot spot in software development, is also an important content in Spring framework, and is a derived normal form of functional Programming.
Dynamic library: also known as Dynamic Link Library (DLL) is one way to implement the concept of shared function libraries in operating systems. Dynamic linking provides a way for an application to call functions that do not belong to its executable code.
bind: when the system dynamically links, the bind points to a resource pointer outside the mirror.
At present, the technical solution for implementing the call to the system function in the application program includes:
the technical scheme 1: in an iOS system, a common solution currently implemented for calling system functions is the fisherhook solution. In particular, the fisherhook scheme implements invocation of system functions by dynamically modifying bind information in a data section of an application program while the application program is running.
The defects of the technical scheme 1 comprise: in a large application, since there is a lot of bind information, it takes time to call a system function, and for example, when a system function is called by a fisherhook scheme for a large application that can provide a plurality of services such as web shopping, web house finding, and web work finding, it takes 50ms for the iPhone 11.
The technical scheme 2 is as follows: after the executable file (binary file) of the application program is compiled, the bind information in the binary file is directly modified, and the system function to be called is replaced by the function of the application program written by a developer.
The defects of the technical scheme 2 comprise: 1) the binary file of the application program needs to be modified and re-signed, the development cost is high, if 100 system functions need to be called, namely bin information at 100 positions in the binary file needs to be modified, the maintenance cost is too high, and an additional script flow needs to be added.
In view of the above problems, the system function calling method provided in the embodiment of the present invention calls a system function by using a customized dynamic link library of an application program as a middle springboard. Specifically, the principle of the embodiment of the invention is as follows: the method comprises the steps of defining a system function to be called in an application program to intercept all calls related to the system function in the application program, calling the system function which the application program wants to call in a dynamic link library by virtue of the isolation of the dynamic link library, and calling a jump board function of the system function in the dynamic link library in the application program to realize the section-oriented programming behavior.
Referring to fig. 1, a flowchart illustrating steps of a system function call method provided in the embodiment of the present invention is shown, which may specifically include the following steps:
step 102, when a current function is called in an application program, calling a dynamic link library of the application program; the dynamic link library comprises a springboard function, the springboard function has a corresponding function address, and the function address is a function address of a system function in the system library.
In a specific implementation, the dynamic link library includes codes and other resources necessary for the application program to run, the dynamic link library is a library that needs to be loaded when the application program runs, and when the dynamic link library is correctly installed, the application program can be normally run by using the dynamic link library.
In the embodiment of the invention, the overlay system function corresponding to the system function is set in the application program, and the springboard function capable of indirectly calling the system function is added in the dynamic link library of the application program, wherein the springboard function corresponds to the overlay system function, so that if the current system function is the overlay system function, the calling of the system function can be realized through the corresponding springboard function.
The overlay system function is a function which is customized by developers and is the same as the system function, and the springboard function in the dynamic link library is a function which is customized by developers and is the same as other information of the system function except for the function identification of the function.
As a specific example of the present invention, the system function may refer to a C function in a C function library, for example, NSLog is a C function in the C function library, and assuming that a function desired to be called in the application is NSLog, an overlay system function may be customized in an executable file of the application, where the customized overlay system function is the same as NSLog of the system library. Correspondingly, in the dynamic link library of the application program, a function which is the same as the NSLog except for the function identifier is added as the springboard function, for example, the function identifier of the springboard function may be "My _ NSLog", which is different from the function identifier "NSLog" of the system function NSLog.
In the specific implementation, function call is performed in the running process of the application program, and if the current function called in the application program is the overlay system function, the dynamic link library of the application program can be called, so that the system function is indirectly called through the springboard function of the dynamic link library.
And 104, if the dynamic link library comprises a target springboard function corresponding to the current function, calling the system function in the dynamic link library by the target springboard function through the function address.
And 106, calling the target springboard function after the system function is called in the application program.
In the embodiment of the present invention, if the dynamic link library includes the target springboard function corresponding to the current function, the springboard function may be used as the target springboard function corresponding to the current function, then the corresponding system function in the system library may be called based on the function address corresponding to the target springboard function in the dynamic link library, and then the target springboard function to which the system function is called in the application program. For example, assuming that the overlay system function NSLog in the application program corresponds to the springboard function My _ NSLog in the dynamic link library, when the overlay system function NSLog is called in the application program, the system function NSLog in the system library can be called based on the springboard function My _ NSLog in the dynamic link library through a corresponding function address, and then the application program calls the springboard function My _ NSLog calling the system function NSLog, so that the application program indirectly calls the system function NSLog.
It should be noted that the dynamic link library and the application program are independently compiled and linked, so that the application program and the dynamic link library have isolation, and therefore, the springboard function in the dynamic link library calls the system function that the application program wants to call, and then the springboard function that the system function is called in the dynamic link library is called in the application program, and the bind information in the application program does not need to be modified.
In the method for calling the system function, a springboard function is set in a dynamic link library of an application program, wherein a function address of the springboard function is a function address of the system function, when the current function is called in the application program, if a target springboard function corresponding to the current function is included in the dynamic link library, the target springboard function calls the system function in the dynamic link library through the function address, and then the target springboard function after the system function is called can be called in the application program. According to the embodiment of the invention, when the system function needs to be called in the application program, the system function is indirectly called through the springboard function in the dynamic link library, and because the system function is not directly called in the application program, the bind information in the application program does not need to be searched and modified, and the calling efficiency of the system function is improved.
On the basis of the above-described embodiment, a modified embodiment of the above-described embodiment is proposed, and it is to be noted herein that, in order to make the description brief, only the differences from the above-described embodiment are described in the modified embodiment.
In an exemplary embodiment, before the step 102, when the current function is called in the application program, and the dynamic link library of the application program is called, the method may further include the following steps:
setting an overlay system function in an executable file of an application program; the covering system function and the system function in the system library have the same function identification and function attribute parameters;
adding a springboard function corresponding to the coverage system function in a dynamic link library of the application program; the function identification of the springboard function is different from the function identification of the coverage system function, and the function attribute parameters are the same, and the springboard function is provided with a function address of the system function.
In a specific implementation, a function may have a corresponding function identifier and a function attribute parameter, where the function identifier refers to a function name, such as "NSLog", "My _ NSLog", and the like, and the function attribute parameter may include a function parameter, a return value, and the like.
The overlay system function is a function defined by a developer in an application program and having the same function identifier and function attribute parameters as the system function, and the springboard function in the dynamic link library is a function defined by the developer and having different function identifiers and function attribute parameters from the system function. In short, the overlay system function and the system function are functions of the same name and the same return value, and the springboard function and the system function are functions of different names and the same return value. Specifically, the functions may be associated with each other by function names (symbols).
As a specific example of the present invention, it is assumed that a system function NSLog is included in the system library, which is defined as void NSLog (NSString format.), and it is assumed that a system function desired to be called in the application program is NSLog, and an overlay system function that can be customized in an executable file of the application program is provided, wherein the customized overlay system function is the same as NSLog of the system library, and is void NSLog (NSString format.). Accordingly, in the dynamic link library of the application program, a function having the same information as the NSLog except for the function identifier is added as a springboard function, for example, the springboard function may be defined as void My _ NSLog (NSString _ format.), wherein the springboard function My _ NSLog corresponds to the overlay system function NSLog.
In the above exemplary embodiment, the overlay system function identical to the system function is defined in the application program, and the springboard function corresponding to the overlay system function and identical to the system function except for the function identifier is defined in the dynamic link library of the application program, so that when the current function called by the application program is the overlay system function, the system function can be indirectly called through the springboard function in the dynamic link library.
In an exemplary embodiment, the step 104, if the dynamic link library includes a target springboard function corresponding to the current function, the target springboard function calls the system function in the dynamic link library through the function address, which may include the following steps:
and if the function identification of the target springboard function corresponding to the function identification of the current function is contained in the dynamic link library, calling the system function by the target springboard function in the dynamic link library through the function address.
In the embodiment of the present invention, when defining the overlay system function and the springboard function, the function identifier of the overlay system function and the function identifier of the springboard function may be associated, so that it may be determined whether a target springboard function corresponding to a current function called in an application program exists in the dynamic link library based on the function identifiers.
For example, if the function identifier "My _ NSLog" of the springboard function corresponds to the function identifier "NSLog" of the overlay system function, the function identifier of the current function called in the application program is "NSLog", and if the function identifier "My _ NSLog" of the target springboard function corresponding to the function identifier of the current function is included in the dynamic link library, which indicates that the current function is the overlay system function, the springboard function with the function identifier "My _ NSLog" may be used as the target springboard function, and the target springboard function may call the system function through the function address.
In the above exemplary embodiment, whether the target springboard function corresponding to the current function exists is quickly determined through the function identifier, so that the calling of the system function can be quickly realized in the application program, and the calling efficiency of the system function is improved.
In an exemplary embodiment, before the step 102 of invoking the dynamic link library of the application program, the method may further include the steps of:
and if the dynamic link library contains a target function to be called corresponding to the current function, calling the target function to be called.
In a specific implementation, the executable file of the application program is obtained by compiling the source code of the application program by a compiler and linking the source code by a linker. Specifically, a file generated after the source code is compiled by the compiler is called an object file, and includes program instructions and program data, which are stored in the form of segments (segments) having a certain length, respectively, the program instructions are stored in the code segments, and the program data are stored in the data segments. In addition, the target file may further include a dynamic link library, and the dynamic link library may include a function identifier and a function address corresponding to a function to be called, where the function to be called may be a function defined by a third party or a user. And the linker links the object file generated by compiling to obtain the final executable file.
In the embodiment of the invention, when the application program calls the current function, if the dynamic link library contains the function to be called corresponding to the current function, the function to be called can be used as the target function to be called, and the target function to be called is called, so that the calling of the target function to be called in the application program is realized.
In an exemplary embodiment, if the target function to be called corresponding to the current function is included in the dynamic link library, the calling the target function to be called may include the following steps:
and if the function identification of the function to be called corresponding to the function identification of the current function is included in the dynamic link library, calling the function to be called.
In the embodiment of the present invention, when defining the overlay function and the function to be called in the application program, the function identifier of the overlay function and the function identifier of the function to be called may be corresponded, so that it may be determined whether a function to be called corresponding to a current function called in the application program exists in the dynamic link library based on the function identifiers. For example, assuming that the function identifier "func 2" of the function to be called corresponds to the function identifier "func 1" of the function in the application, the function identifier of the current function called in the application is "func 1", and if the function identifier "func 2" of the function to be called corresponding to the function identifier of the current function is included in the dynamic link library, the function to be called with the function identifier "func 2" may be called, so that the function defined by a third party or a user is called.
In the above exemplary embodiment, whether a function to be called corresponding to the current function exists in the dynamic link library is quickly determined through the function identifier, so that the function to be called can be quickly called in the application program, and the calling efficiency of the function to be called is improved.
In order to enable those skilled in the art to better understand the indirect calling process of the system function by the application program, a complete example is described below.
Referring to fig. 2, the structural block diagram for implementing system function call provided in the embodiment of the present invention relates to an App executable file, a customized dynamic library, and a system library, where the App executable file mainly bears main function codes of an App; the self-defined dynamic link library comprises a springboard function which is set for calling the system function. The function to be called in App is typically in a system library, for example a C-function in the system library.
Referring to fig. 3, which is a flowchart illustrating implementation of a system function call in an application according to an embodiment of the present invention, specifically, the method includes the following steps:
1. and defining a cover system function with the same name and the same reference return value in App.
Suppose that a system function NSLog in a system library needs to be called in an application, and NSLog is a C function of the system library, which is defined as void NSLog (NSString format). This step requires the definition of a cover system function in App, with the function name "NSLog", which is defined as NSLog in the system library, which is void NSLog (NSString format).
2. And (4) self-defining the dynamic link library.
The step is an open scheme, and only a dynamic link library which can be normally accessed to the App is created.
3. Defining springboard functions which are synonymously participated with the covering system functions in App in a dynamic link library
And adding a springboard function which has a different name with the NSLog in the App and has the same return value with the NSLog in the App in the dynamic link library, wherein the springboard function has the same information except that the function name is different from the NSLog in the App. Taking NSLog in APP as an example, at this time, a springboard function void My _ NSLog (NSString format) is created in the dynamic link library, as long as the function name is different from that of NSLog in APP.
4. A springboard function in the dynamic link library calls a system function.
The method comprises the steps of calling NSLog in a system library in a springboard function void My _ NSLog (NSString format), wherein a dynamic link library needs to be independently compiled and linked, and at the moment, the function address of the NSLog in the system library is recorded in bind information in the dynamic link library.
5. The springboard function which calls the system function is called in the App.
In the coverage system function NSLog defined in App, calling the springboard function My _ NSLog realizes the calling of NSLog in the system library. Because the App independently compiles the links, all places in the App where the NSLog in the system library needs to be called actually call the functions defined in the App, and do not directly call the system functions.
By applying the embodiment of the invention, the mode of calling the system function is indirectly called in the dynamic link library, so that the inefficient mode of searching and modifying the bind information in the App is avoided, and the calling efficiency of the system function is improved. In addition, the embodiment of the invention can modify the executable file of the application program without the help of a script, and has lower maintenance cost.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the illustrated order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments of the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
Referring to fig. 4, a block diagram of a structure of a system function call device provided in the embodiment of the present invention is shown, and specifically, the structure may include the following modules:
a current function calling module 402, configured to call a dynamic link library of an application program when a current function is called in the application program; the dynamic link library comprises a springboard function, the springboard function has a corresponding function address, and the function address is a function address of a system function in the system library;
a system function calling module 404, configured to, if a target springboard function corresponding to the current function is included in the dynamic link library, call, by the target springboard function, the system function in the dynamic link library through the function address;
a springboard function calling module 406, configured to call the target springboard function after the system function is called in the application program.
In an exemplary embodiment, the apparatus further comprises: the springboard function setting module is used for setting an overlay system function in an executable file of the application program; the covering system function and the system function in the system library have the same function identification and function attribute parameters; adding a springboard function corresponding to the coverage system function in a dynamic link library of the application program; the function identification of the springboard function is different from the function identification of the coverage system function, and the function attribute parameters are the same, and the springboard function is provided with a function address of the system function.
In an exemplary embodiment, the system function calling module 404 is configured to, if the function identifier of the target springboard function corresponding to the function identifier of the current function is included in the dynamic link library, call the system function in the dynamic link library by the target springboard function through the function address.
In an exemplary embodiment, the apparatus further comprises: and the function calling module to be called is used for calling the target function to be called if the dynamic link library contains the target function to be called corresponding to the current function.
In an exemplary embodiment, the function to be called calls the function to be called if the function identifier of the function to be called corresponding to the function identifier of the current function is included in the dynamic link library.
In an exemplary embodiment, the system function includes a library of C functions, a C function.
In summary, in the embodiment of the present invention, a springboard function is set in a dynamic link library of an application program, where a function address of the springboard function is a function address of a system function, when a current function is called in the application program, if a target springboard function corresponding to the current function is included in the dynamic link library, the target springboard function calls the system function in the dynamic link library through the function address, and then, the target springboard function after calling the system function may be called in the application program. According to the embodiment of the invention, when the system function needs to be called in the application program, the system function is indirectly called through the springboard function in the dynamic link library, and because the system function is not directly called in the application program, the bind information in the application program does not need to be searched and modified, and the calling efficiency of the system function is improved.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
Preferably, an embodiment of the present invention further provides an electronic device, including: the processor, the memory, and the computer program stored in the memory and capable of running on the processor, when executed by the processor, implement the processes of the above system function call method embodiment, and can achieve the same technical effects, and are not described herein again to avoid repetition.
The embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when being executed by a processor, the computer program implements each process of the above-mentioned system function call method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here. The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
Embodiments of the present invention provide a computer program product, which is stored in a storage medium and executed by at least one processor to implement the processes of the foregoing method embodiments, and achieve the same technical effects, and therefore, the details are not repeated herein to avoid repetition.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
While the present invention has been described with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, which are illustrative and not restrictive, and it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the appended claims.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units 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 embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a U disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A system function call method, the method comprising:
when a current function is called in an application program, a dynamic link library of the application program is called; the dynamic link library comprises a springboard function, the springboard function has a corresponding function address, and the function address is a function address of a system function in the system library;
if the dynamic link library comprises a target springboard function corresponding to the current function, the target springboard function calls the system function in the dynamic link library through the function address;
and calling the target springboard function after the system function is called in the application program.
2. The method of claim 1, wherein prior to said calling a dynamically linked library of an application when a current function is called in the application, the method further comprises:
setting an overlay system function in an executable file of an application program; the covering system function and the system function in the system library have the same function identification and function attribute parameters;
adding a springboard function corresponding to the coverage system function in a dynamic link library of the application program; the function identification of the springboard function is different from the function identification of the coverage system function, and the function attribute parameters are the same, and the springboard function is provided with a function address of the system function.
3. The method according to claim 2, wherein if the dynamic link library includes a target springboard function corresponding to the current function, the target springboard function calls the system function in the dynamic link library through the function address, and the method includes:
and if the function identification of the target springboard function corresponding to the function identification of the current function is contained in the dynamic link library, calling the system function by the target springboard function in the dynamic link library through the function address.
4. The method of claim 1, wherein after said invoking the dynamically linked library of the application, the method further comprises:
and if the dynamic link library contains a target function to be called corresponding to the current function, calling the target function to be called.
5. The method according to claim 4, wherein the calling the target function to be called if the target function to be called corresponding to the current function is included in the dynamic link library comprises:
and if the function identification of the function to be called corresponding to the function identification of the current function is included in the dynamic link library, calling the function to be called.
6. The method of claim 1, wherein the system function comprises a library of C functions.
7. A system function call apparatus, the apparatus comprising:
the current function calling module is used for calling a dynamic link library of the application program when the current function is called in the application program; the dynamic link library comprises a springboard function, the springboard function has a corresponding function address, and the function address is a function address of a system function in the system library;
a system function calling module, configured to, if a target springboard function corresponding to the current function is included in the dynamic link library, call, by the target springboard function, the system function in the dynamic link library through the function address;
and the springboard function calling module is used for calling the target springboard function after the system function is called in the application program.
8. The apparatus of claim 7, further comprising:
the springboard function setting module is used for setting an overlay system function in an executable file of the application program; the covering system function and the system function in the system library have the same function identification and function attribute parameters; adding a springboard function corresponding to the coverage system function in a dynamic link library of the application program; the function identification of the springboard function is different from the function identification of the coverage system function, and the function attribute parameters are the same, and the springboard function is provided with a function address of the system function.
9. An electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
the memory is used for storing a computer program;
the processor, when executing a program stored on the memory, implementing the method of any of claims 1-6.
10. One or more computer-readable media having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the method of any of claims 1-6.
CN202111678012.6A 2021-12-31 2021-12-31 System function calling method, device, electronic equipment and readable medium Active CN114416219B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111678012.6A CN114416219B (en) 2021-12-31 2021-12-31 System function calling method, device, electronic equipment and readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111678012.6A CN114416219B (en) 2021-12-31 2021-12-31 System function calling method, device, electronic equipment and readable medium

Publications (2)

Publication Number Publication Date
CN114416219A true CN114416219A (en) 2022-04-29
CN114416219B CN114416219B (en) 2023-05-23

Family

ID=81272083

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111678012.6A Active CN114416219B (en) 2021-12-31 2021-12-31 System function calling method, device, electronic equipment and readable medium

Country Status (1)

Country Link
CN (1) CN114416219B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6463583B1 (en) * 1999-04-08 2002-10-08 Novadigm, Inc. Dynamic injection of execution logic into main dynamic link library function of the original kernel of a windowed operating system
CN103150155A (en) * 2011-12-07 2013-06-12 金蝶软件(中国)有限公司 Data interception method and device
CN106502745A (en) * 2016-10-26 2017-03-15 腾讯科技(深圳)有限公司 A kind of function calling method and device
CN106959859A (en) * 2017-03-30 2017-07-18 北京奇虎科技有限公司 The call method and device of system call function
CN110007984A (en) * 2019-04-02 2019-07-12 苏州思必驰信息科技有限公司 Function calling relationship retrogressive method and system based on Xtensa DSP
CN111610966A (en) * 2019-02-22 2020-09-01 龙芯中科技术有限公司 Program running method and device and computing equipment
CN112306683A (en) * 2020-10-29 2021-02-02 北京字节跳动网络技术有限公司 Function hijacking method, device, medium and electronic equipment
CN113448655A (en) * 2021-07-09 2021-09-28 赞同科技股份有限公司 C standard dynamic library calling method and device

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6463583B1 (en) * 1999-04-08 2002-10-08 Novadigm, Inc. Dynamic injection of execution logic into main dynamic link library function of the original kernel of a windowed operating system
CN103150155A (en) * 2011-12-07 2013-06-12 金蝶软件(中国)有限公司 Data interception method and device
CN106502745A (en) * 2016-10-26 2017-03-15 腾讯科技(深圳)有限公司 A kind of function calling method and device
CN106959859A (en) * 2017-03-30 2017-07-18 北京奇虎科技有限公司 The call method and device of system call function
CN111610966A (en) * 2019-02-22 2020-09-01 龙芯中科技术有限公司 Program running method and device and computing equipment
CN110007984A (en) * 2019-04-02 2019-07-12 苏州思必驰信息科技有限公司 Function calling relationship retrogressive method and system based on Xtensa DSP
CN112306683A (en) * 2020-10-29 2021-02-02 北京字节跳动网络技术有限公司 Function hijacking method, device, medium and electronic equipment
CN113448655A (en) * 2021-07-09 2021-09-28 赞同科技股份有限公司 C standard dynamic library calling method and device

Also Published As

Publication number Publication date
CN114416219B (en) 2023-05-23

Similar Documents

Publication Publication Date Title
CN110134378B (en) Application program creating method and device, computer equipment and storage medium
CN108121594B (en) Process management method and device
CN111666096B (en) Hot updating method and device for target application, storage medium and electronic equipment
CN103970563B (en) The method of dynamic load Android class
JP6412276B2 (en) Virtual machine creation method and apparatus
CN106294113B (en) creation method and device based on programmable test service
CN104731622B (en) The loading method of a kind of application program, device and mobile terminal
CN111399840B (en) Module development method and device
CN111475227B (en) Business plug-in loading implementation method and device and terminal equipment
JP7106001B2 (en) SUB-APPLICATION DEVELOPMENT METHOD, APPARATUS, COMPUTER DEVICE, AND COMPUTER PROGRAM
CN105630518A (en) Method and device for updating resources of Android application software
CN104699503A (en) Method and device for replacing function execution logic in Android system
CN113986402A (en) Function calling method and device, electronic equipment and storage medium
CN111159301A (en) Data creating method, device, equipment and storage medium based on intelligent contract
CN108228266B (en) Method and device for starting Fragment component between different plug-ins under Android plug-in framework
CN110018831B (en) Program processing method, program processing apparatus, and computer-readable storage medium
US10606612B2 (en) Context check bypass to enable opening shared-object libraries
CN106778270B (en) Malicious application detection method and system
CN116342283A (en) Trusted intelligent contract implementation method, device, equipment and readable storage medium
CN115760391A (en) Intelligent contract changing method and device in block chain, electronic equipment and storage medium
CN114416219B (en) System function calling method, device, electronic equipment and readable medium
CN111708519B (en) Service component processing method, device, equipment and storage medium
CN114816418A (en) Method, device, equipment and medium for building embedded operating system
CN106775608B (en) Method and device for realizing independent system process
CN113282363A (en) Method and device for optimizing hybrid APP

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant