Unlock instant, AI-driven research and patent intelligence for your innovation.

A method and terminal of a function in a hook virtual machine

A virtual machine and function technology, which is applied in the direction of electrical digital data processing, software simulation/interpretation/simulation, program control design, etc., can solve the problem of destroying the original data structure, unable to correctly hook the virtual machine function, and unable to correctly hook the virtual machine Machine functions and other issues to achieve the effect of performance monitoring

Inactive Publication Date: 2019-03-15
福建省天奕网络科技有限公司
View PDF5 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

However, in the prior art, the method of hooking the functions in the virtual machine is to statically modify the virtual machine instructions, that is, to directly modify the contents of the disk file and insert custom information into the disk file. This method cannot correctly hook the virtual machine. The function in the computer, because the original data structure of the original file will be destroyed after the content of the file is modified, and the operation of mainstream software or games will use verification technology, and the destruction of the original data structure of the original file will make the verification of the software or game fail. , causing the system to fail to operate
Therefore, the existing hook method of statically modifying virtual machine instructions cannot correctly achieve the purpose of hooking functions in the virtual machine

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • A method and terminal of a function in a hook virtual machine
  • A method and terminal of a function in a hook virtual machine
  • A method and terminal of a function in a hook virtual machine

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0062] A method for hooking a function in a virtual machine, comprising steps:

[0063] S1. Obtain the storage address of the function to be hooked in the virtual machine;

[0064] Wherein, step S1 specifically includes:

[0065] S11. Obtain the storage space of the virtual machine;

[0066] S12. Open the collection of functions and classes in the storage space of the virtual machine;

[0067] S13. Traverse the set of functions and classes, find the function to be hooked, and acquire the storage address of the function to be hooked.

[0068] Wherein, step S13 specifically includes:

[0069] Judging whether the function to be hooked is stored in the class, if not, traversing the function set to find the function to be hooked, if yes, traversing the class set to find the function to be hooked;

[0070] Obtain the storage address of the function to be hooked according to the found function to be hooked;

[0071] S2. Compile the function into a static function according to th...

Embodiment 2

[0077] Apply the method of the function in the hook virtual machine to the actual scene, hook the scene switching function LoadScene () in the Unity 3D engine, so that the output log is output when the function is called, wherein the Unity 3D engine is a 3D game The development engine is based on Mono, which is a cross-platform dot NET operating environment developed by Xamarin Corporation. Since the scene switching function LoadScene() is located in the Mono virtual machine, the dynamic modification method described in Embodiment 1 needs to be adopted To hook it, first find its address in the virtual machine, then according to the address, use JIT technology to compile the scene switching function LoadScene() into a native instruction code, obtain the address of the native instruction code returned by it, and convert the native instruction code The address of the instruction code is turned to a self-defined function to implement a hook to the scene switching function LoadScene...

Embodiment 3

[0080] A terminal 1 for hooking functions in a virtual machine, including a memory 2, a processor 3, and a computer program stored on the memory 2 and operable on the processor 3, and the processor 3 implements the computer program when executing the computer program Steps in Example 1.

[0081] To sum up, the method and terminal for hooking functions in the virtual machine provided by the present invention compile the function into a static function according to the address of the function to be hooked in the virtual machine, and obtain the address of the static function, Hook the address of the static function, so as to realize the hook of the function in the virtual machine, realize dynamic acquisition and dynamic compilation in the memory, realize the dynamic modification of the function in the virtual machine, and will not change the content of the disk file, so that the virtual machine can be correctly hooked The function in the machine realizes the performance monitorin...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention provides a method and a terminal of a function in a hook virtual machine, Gets the storage address of the function to hook in the virtual machine, in accordance with that storage address, compiling the function into a static function, obtaining an address of the static function, hook, so as to realize the hook of the functions in the virtual machine, obtain the dynamic compilation dynamically in the memory, realize the dynamic modification of the functions in the virtual machine, and do not change the contents of the disk file, so that the functions in the virtual machine can becorrectly hooked, and the performance of the system can be monitored.

Description

technical field [0001] The invention relates to the field of performance monitoring, in particular to a method for hooking a function in a virtual machine and a terminal. Background technique [0002] Hook technology is a technology used to change the execution result of the API. Hook can be translated as "hook" or "hook" in Chinese. Through the hook technology, the target function can be transferred to a custom function for processing, and the target function in the system can be realized. Monitoring, so as to realize the analysis of system performance. [0003] Due to the unique advantages of virtual machines, many software developments are now based on virtual machines, and if you want to monitor the performance of the developed system, you need to hook the functions in the virtual machine. However, in the prior art, the method of hooking the functions in the virtual machine is to statically modify the virtual machine instructions, that is, to directly modify the content...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
IPC IPC(8): G06F11/30G06F9/455
CPCG06F9/45558G06F11/301
Inventor 刘德建巩振烨周小白林陶钧曾捷
Owner 福建省天奕网络科技有限公司