View Single Post
  #6  
Old 04-08-2013, 20:19
bilbo bilbo is offline
Friend
 
Join Date: Jul 2004
Posts: 103
Rept. Given: 36
Rept. Rcvd 15 Times in 12 Posts
Thanks Given: 15
Thanks Rcvd at 17 Times in 11 Posts
bilbo Reputation: 15
Quote:
Although still have errors, the metholodgy ragdog mentioned should be ok
not exactly...

again a problem of calling conventions...
newtolower() must be CDECL since the stack is adjusted on return by the caller.. Please google for calling conventions...

In first newtolower.asm you will obtain a decorated name _newtolower@0: that's not ok, it is a STDCALL decoration with 0 bytes as arguments

In second newtolower.asm you will obtain a decorated name _newtolower@4:
that's not ok, it is a STDCALL decoration with 4 bytes as arguments (it gots linked because the function declaration is coherent in both files, but the stack will be corrupted).

So the correct ASM must be:
Code:
newtolower proc near c
But also newtest.c is not correct, since newtolower must not declared as WINAPI (stdcall). Remove it (the default is CDECL):
Code:
extern int newtolower(int);
Finally, the program will yet trap because __getptd is calling
Code:
call dword_57E704
which is a call to 0!

Best regards, bilbo
Reply With Quote