hzshuai / gperftools

Automatically exported from code.google.com/p/gperftools
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

[waiting patch] The more elegant and effective hook method on Windows 32/64 #571

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
tcmalloc using a "GangBoard" mechanism which need to change some opcodes at the 
begining of the hook function.

But at least on 32bit and 64bit windows, there is a more elegant and effective 
hook mechanism: we can change the module's (exe or dll) IAT (Import address 
table) entry directly to implement the hook. 

This method doesn't need the disassembler nor changing any opcode, Just rewrite 
the function pointer of corresponding IAT entries. 

And because the hooked function will be invocked directly, there is no need to 
do a "GangBoard" jump for each call, so it will gains more efficient.

Original issue reported on code.google.com by baiyang@gmail.com on 17 Sep 2013 at 10:56

GoogleCodeExporter commented 9 years ago
Changed title to reflect that there are no plans to work on that. But patch is 
welcome.

Original comment by alkondratenko on 17 Sep 2013 at 3:36