Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Hooking functions using trampoline method is so common on Windows that sometimes we need to check Hooked Functions in specific modules and determine which module hooked them for troubleshooting or memory forensic analysis needs. If original unhooked modules are available (via symbol server, for example) this can be done by using !chkimg WinDbg extension command:
0:002> !chkimg -lo 50 -d !kernel32 -v
Searching for module with expression: !kernel32
Will apply relocation fixups to file used for comparison
Will ignore NOP/LOCK errors
Will ignore patched instructions
Image specific ignores will be applied
Comparison image path:
c:\symdownstream\kernel32.dll\44C60F39102000\kernel32.dll
No range specified
Scanning section: .text
Size: 564445
Range to scan: 77e41000-77ecacdd
77e44004-77e44008 5 bytes - kernel32!GetDateFormatA
[ 8b ff 55 8b ec:e9 f7 bf 08 c0 ]
77e4412e-77e44132 5 bytes - kernel32!GetTimeFormatA (+0x12a)
[ 8b ff 55 8b ec:e9 cd be 06 c0 ]
77e4e857-77e4e85b 5 bytes - kernel32!FileTimeToLocalFileTime
(+0xa729)
[ 8b ff 55 8b ec:e9 a4 17 00 c0 ]
77e56b5f-77e56b63 5 bytes - kernel32!GetTimeZoneInformation (+0x8308)
[ 8b ff 55 8b ec:e9 9c 94 00 c0 ]
77e579a9-77e579ad 5 bytes - kernel32!GetTimeFormatW (+0xe4a)
[ 8b ff 55 8b ec:e9 52 86 06 c0 ]
77e57fc8-77e57fcc 5 bytes - kernel32!GetDateFormatW (+0x61f)
[ 8b ff 55 8b ec:e9 33 80 08 c0 ]
77e6f32b-77e6f32f 5 bytes - kernel32!GetLocalTime (+0x17363)
[ 8b ff 55 8b ec:e9 d0 0c 00 c0 ]
77e6f891-77e6f895 5 bytes - kernel32!LocalFileTimeToFileTime (+0x566)
[ 8b ff 55 8b ec:e9 6a 07 01 c0 ]
77e83499-77e8349d 5 bytes - kernel32!SetLocalTime (+0x13c08)
[ 8b ff 55 8b ec:e9 62 cb 00 c0 ]
77e88c32-77e88c36 5 bytes - kernel32!SetTimeZoneInformation (+0x5799)
[ 8b ff 55 8b ec:e9 c9 73 01 c0 ]
Total bytes compared: 564445(100%)
Number of errors: 50
50 errors : !kernel32 (77e44004-77e88c36)