-2

This question already has an answer here:

Can anyone explain the following code as it's an array in assembly. I can't understand can you help me to figure it out line by line.

Thanks

enter image description here

Q.1) what does the 401024 & 40102E line does ?

marked as duplicate by 0xC0000022L Jul 11 '18 at 18:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

The explanation is given in the book immediately following the listing (Practical Malware Analysis Chapter 6 page 128 "Recognizing C Code Constructs in Assembly"):

In this listing, the base address of array b corresponds to dword_40A000 , and the base address of array a corresponds to var_14 . Since these are both arrays of integers, each element is of size 4, although the instructions at 1 and 2 differ for accessing the two arrays. In both cases, ecx is used as the index, which is multiplied by 4 to account for the size of the elements. The resulting value is added to the base address of the array to access the proper array element.

  • How did you know that was the book in screenshot? – Biswapriyo Jul 6 '18 at 16:00
  • 4
    @Biswapriyo I have the book – julian Jul 6 '18 at 16:02
  • 1
    Ah, exact same question than index of array in assembly?. Possible duplicate... – perror Jul 6 '18 at 16:36

Not the answer you're looking for? Browse other questions tagged or ask your own question.