c++ - How does one pass on parameters in assembly? -
im working on the hook in C ++ and ASM and at present I have just made an easy inline hook which is already Jumps in the direction of the target function which in this case the output debug string is for testing purposes only.
This thing is that my hook fiancé works after about three days of research and how some things work, its bits and peaks are detected, but
As you can see in my code I have tried, there is a problem. I do not know how to change the parameters that come in my "dummy" function. To change the parameter in C ++, but of course it does not work as a pop in all registers later: /
Anyway this is my dummy function which is how to hook hook functions Jumps from:
Fixed zero __declspec (naked) MyDebugString (LPCTSTR lpOutputString) {__asm {PUSHAD} // Where I think I can run my code, but do not take anymore To interfere with the parameter: / lpOutputString = L "New Message!"; __asm {POPAD MOV EDI, EID Push EBP MOV EBP, ESP JMP Adrer} Original debugstring (LP overputstring); }
I understand why the code is not working as I said, I can not see the proper solution, no help is greatly appreciated.
Each compiler has a protocol to call functions using assembly language. The protocol can be said in depth in its manual.
Function is a fast way to find the protocol that the compiler prepares an assembly language list for your function.
The best way to write an inline assembly is to:
- Type the function in the first C ++ source code
- The assembly list function of the next print.
- Review and understand how the compiler-generated assembly works.
- In the end, modify the internal assembly according to your needs.
My priority can be written as C ++ as efficient as code (or compiler to help in optimal assembly language) I then review the assembly list Do I change the inline assembly only to start the processor's special features (like block-driving instructions).
Comments
Post a Comment