For PE files, find_entry_by_id needs to be called again with the result of the 2nd LookupIconIdFromDirectoryEx. I have not checked the behavior for .ico files.