Search code examples
cvisual-studio-2022ida

I can't find a piece of data in IDA


I have this book I have to read for school and there's this exercise to create a program in Visual Studio in C language that prints "Hello!" and insert it into IDA. Then you need to find where the String "Hello!" that was defined in the program was saved, which I believe I found. Then it says:

Inside our main, we will focus on two lines. The first, aHello offset push. This line pushes into the stack the memory address of the Hello string. If we click on aHello we will be directed to the address of the string in memory", however, I cannot find this line nor the keyword "aHello" anywhere in the IDA.

After that, there's an example photo example photo and the following text:

It can be seen that the string is defined at the address 416B94 and after it is defined the character 0Ah (as remembered from the assembly studies, line drop) followed by the character 0 (as you remember, indicates the end of the string for printing functions).

I tried to go to that line but I couldn't find it. I was wondering if I could get some on understanding the IDA.

The code I used in the program is

#include <stdio.h>

int main() {
    printf("Hello!");
    return 0;
}

I'm sorry if I phrased anything wrong. The book is not in English an I'm new to IDA and C language.

the only main


Solution

  • Looks like your book is describing a 32-bit example where it pushes a pointer to your format string (automatically named aHello) onto the stack before calling printf.

    Your binary is 64-bit with a different calling convention where the rcx register is used to hold the pointer to your format string (automatically named _Format) instead of the stack (so no push instruction needed).

    If you go to where _Format is defined (perhaps use the XREF feature to find it), you will find the bytes that make up your string.

    (Looks like your version of IDA is using the function argument's name to generate a name, while the book's version used the contents of the string to generate the name.)