News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

masm32 call to API

Started by malcode, February 11, 2013, 05:43:13 AM

Previous topic - Next topic

dedndave

i have used it on several apps with no problems
if you don't like the tool, don't use it

this is the campus, so i'll respect the op

malcode

Thanks everybody for welcome.

This thread very useful for me, but still little doubt.

Masm32 by default use jump table to call winapi.

Advantage of this approach and that Linker can generate PE file more faster than use direct call (call iat_address), becouse have less place for replace by address IAT.

Disadvantage of this approach is more inefficient in run time than direct call, because all call to winapi need two instruction: call and jmp.

My doubt is this affirmation about is correct.

this my reference: http://msdn.microsoft.com/en-us/magazine/cc301805.aspx

qWord

Quote from: malcode on February 19, 2013, 02:13:37 AMDisadvantage of this approach is more inefficient in run time than
that is a question of the proportionality: how much does the additional jump cost in compare to the API itself? I would say that only a very small minority of APIs calls would benefit from a "direct" call.
MREAL macros - when you need floating point arithmetic while assembling!

dedndave

it is less efficient
however, in most cases, the time required to execute the jump is reasonably small,
compared to the time required to execute the code of the function

for functions like BitBlt, the code takes much longer than the call
but, for functions like CreateDIBSection, the code is fast, so dereferencing can help a little
in a paint operation, you might use both of these functions together
so, the call overhead is small

you have to weigh the time of the call against the time of the function
and - it is much more meaningful if you execute the code in a loop
if you call an API function 100,000 times, the overhead may be substantial