View Single Post
  #182  
Old 05-24-2005, 14:26
Sergey R.
 
Posts: n/a
Quote:
Originally Posted by zdensys
Wiley.Reversing.Secrets.of.Reverse.Engineering.Apr.2005.eBook-DDU
...
Thank you for this book! It seems to be very interesting.

But alas I've found a mistake in this book.

p.570:
Quote:
... The cdecl calling convention is the standard C and C++ calling convention. The unique feature it has is that it allows functions to receive a dynamic number of parameters. This is possible because the caller is responsible for restoring the stack pointer after making a function call. Additionally, cdecl functions receive parameters in the reverse order compared to the rest of the calling conventions. The first parameter is pushed onto the stack first, and the last parameter is pushed last. ...
p.571:
Quote:
... stdcall is the opposite of cdecl in terms of argument passing method and order. stdcall functions receive parameters in the reverse order compared to cdecl, meaning that the last parameter an stdcall function takes is pushed to the stack first. ...
This is not correct! "cdecl" and "stdcall" calling conventions are equal in a method of arguments passing into the stack. They both push arguments in the stack from right to left. The only difference is the method of the stack clearance, it is made by caller with "cdecl" and by called function with "stdcall".

So be careful reading this book. There may be other mistakes in it...

Last edited by Sergey R.; 05-24-2005 at 14:43.
Reply With Quote