A
A
Andrey Sivukha2021-01-17 17:20:21
assembler
Andrey Sivukha, 2021-01-17 17:20:21

Why does atoi return 0 in EAX even though the string is supplied with a digit character?

lea esi, [dateString]
        lea edi, [month]

        cld
        lodsb
        lodsb
        lodsb
        lodsb
        stosb
        lodsb
        stosb

        invoke atoi, [month]

atoi returns zero and crashes, I can't figure out why

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mercury13, 2021-01-17
@Mercury13

I don't know what month is, but apparently this macro should be called invoke atoi, month.
Because [month] is a dereference. And we need an address.
So it returns zero or crashes, I don't understand? If there was a crash, anything can be in eax.
With lea edi, [month]everything is right - lea does not dereference, but loads the address. Although the assembler, in theory, should produce a regular mov edi, month.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question