This is the beginning of one of the functions inside NTDLL of Windows XP:
MOV EDI,EDI
PUSH EBP
MOV EBP,ESP
...
The book on reverse engineering I am reading(Eldad Eilam - Reversing: Secrets of Reverse Engineering) says this about the first line:
It is essentially dead code that was put in place by the compiler as a placeholder, in case someone wanted to trap this function. Trapping means that some external component adds a JMP instruction that is used as a notification whenever the trapped function is called.
Can you show me how exactly can trapping be used in practice? I assume that trapping is just calling a function with trapping instruction inside the other function, but I don't realize how the outside function can get "notified" about the call... Is it possible the author meant by "some external component" the debugger? It can make sense because if I set a breakpoint for some strange assembly insruction like MOV EDI, EDI
, I'll get to where trapped function is...