flat assembler
Message board for the users of flat assembler.

Index > Windows > Converting binary values to decimal and hex

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
pearlz



Joined: 07 Jun 2010
Posts: 55
Location: Viet Nam
pearlz
I do not see the difference between invoke vs cinvoke?
invoke n cinvoke in my machine return one value
my asembler version is 1.69.25
Post 22 Oct 2010, 05:08
View user's profile Send private message Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1608
Location: Ukraine
shoorick
you definetly have to learn what is calling conventions and what kind of calling methods are using mostly.
to say fast, there are two main ways: stdcall and c-call. for stdcall called procedure must restore stack, for c-call caller must restore stack. c-call is used mostly for variable number of function parameters in stack.
if your improper code occasionally works - say thanks to uncle Billy, as system checks stack after return from window procedure and tries to restore it if improper Wink for console application of two function calls it may appear invisible, but may give hidden trouble somewhere if missed Wink
regards!
Post 22 Oct 2010, 05:50
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17663
Location: In your JS exploiting you and your system
revolution
pearlz: For that small example you are using the "c"invoke won't make any difference because you are immediately calling ExitProcess and the OS will clean everything up. But once you start to use that code in a real application then things can start to go haywire because your stack gets messed up.

BTW: wsprintf is the ONLY Win32 API function that needs cinvoke. All the others use invoke.
Post 22 Oct 2010, 07:15
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.