I have 2 questions:
The Pe32 header consists of many subheaders. One of them is the optional header. MSDN says that the last element of
IMAGE_OPTIONAL_HEADERis a pointer to the firstIMAGE_DATA_DIRECTORYstruct of the executable. When I look into theWIN32N.INCfor NASM everything is the same as listed in MSDN with the difference that the pointer to the first struct has the size 8 bytes instead of 4 (like a normal 32bit pointer):STRUCT IMAGE_OPTIONAL_HEADER .Magic RESW 1 ... .DataDirectory RESQ 1 <----- why RESQ? ENDSTRUCWhen I want to copy the 16 DataDirectories out of the binary data I stored as a "variable" in NASM into an struct: Is it ok to create a struct with 32 entries (Export Directory RVA + size, Import Directory RVA + size, etc...) and have the pointer to the first DataDirectory struct in the optional header point to its beginning? Because otherwise there would be no way to get from the first element to the other ones, wouldn't it?
Can someone explain this?