Easyhook Library Series tutorial 4 hook startup and stop

Source: Internet
Author: User
This article takes a lot of time to get to know easyhook.
A simple comparison of the procedure after easyhook and detour are hooked
Detours: After the API function is hooked up, two addresses are generated. One address corresponds to the address of the real hook function, and the other corresponds to the actual API address easyhook: After the API function is hooked up, all APIs direct to the same address, use ACL to control whether to jump to a real API address
Detour: After the hook is obtained, it is related to an API becoming two functions: easyhook: After the hook is obtained, it is related to an API. You can control the ACL to determine whether to jump to the real API.
A special case in easyhook: You need to implement this function to intercept the createfile and getfilesize functions, and obtain the file size when opening the file, that is, both createfile and getfilesize are used in hookcreatefile. Now the problem arises. Createfile calls the real API, while getfilesize calls hookgetfilesize. If there are more functions, it will inevitably lead to problems.

Start and Stop easyhook
Easyhook is a two-way ACL table. One is the inclusion method (lhsetexclusiveacl), the other is the exclusion method (lhsetexclusiveacl), and the other is the inclusion method. For the line hooks added to the ACL, all are hook. Exclude method. For threads added to the ACL, cancel the hook.
You can enable and stop the hook by dynamically adjusting the switch status.

Easyhook Library Series tutorial 4 hook startup and stop

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.