In a PE file
In the OptionaFilelheader64 the member NumberOfRvaAndSizes indicates the number of Data Directories. If we want to know how really there are data Directories we are obligned to cross them and to test if the VirtualAddress and the Size are equal to 0 or is there another way?
DWORD NumberOfRvaAndSizes
The number of entries in the DataDirectory array (below). This value is always set to 16 by the current tools.