5

Consider this code snippet:

sample

I'm trying to find the code that declares the global variable in Ollydbg.

I can't find where it is.

glampert
  • 158
  • 6
j1ni3
  • 51
  • 2
  • 1
    Please note that you can paste code directly in any StackExchange site, instead of a screenshot from your editor. To add code markup, put 4 spaces at the beginning of each line. – glampert Dec 16 '14 at 14:41

1 Answers1

7

The C compiler doesn't create any assembly code to declare and initialize global fundamental data types, so you won't see anything like MOV ..., 3 in OllyDbg for your program above.

In the disassembly of your program below, you can see that the global variable is stored at dword_402000, which is hardcoded to begin with a value of 3:

Disassembly

Jason Geffner
  • 20,681
  • 1
  • 36
  • 75