开发者

What causes the differences between a driver on disk and a driver mapped to memory?

开发者 https://www.devze.com 2023-01-21 01:40 出处:网络
Hey, Today I tried to do a binary diffing of NDIS.sys, and I noticed something weird. I took a function, and began to diff it. The first 30 bytes were the same on the disk(using IDA) and on memory(usi

Hey, Today I tried to do a binary diffing of NDIS.sys, and I noticed something weird. I took a function, and began to diff it. The first 30 bytes were the same on the disk(using IDA) and on memory(using WinDbg). Then, something have changed. I saw something like "jmp _imp_XXXXX". the JMP bytes were the same, but the address was different.

My question is - what makes the difference? I think it has something to do with relocations. Altough the jump is to address in the same module, it's a long jump, which makes it relative to the module base address. If relocation occured, it needs to relocate this address too, altoug开发者_高级运维h its on the same module.

Am I right or totally wrong? :-) Thanks.


Yes, jump targets get re-written during relocation when a module is not loaded at it's preferred base address in memory. Actually, developers are advised to provide a non-default base address for their modules to avoid relocation cost, but many never do, so some modules will always get relocated and the loader has to re-write jump targets.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号