PeNet icon indicating copy to clipboard operation
PeNet copied to clipboard

AddImport(s) doesn't handle the case where IAT doesn't already exist

Open hypervisor opened this issue 3 years ago • 2 comments

Steps to reproduce:

  1. Create a PE file without any imports
  2. Try using PeNet to add an import
  3. Exception

hypervisor avatar Feb 09 '22 14:02 hypervisor

Is there any plans to create the ability to parse .NET headers to extract information such as Directory Com Descriptor?

nurajbihari avatar Mar 14 '22 18:03 nurajbihari

If your PE doesn't already have imports, you'll need manually set the Import Directory RVA to something valid, and keep the size 0.

PeFile.ImageNtHeaders.OptionalHeader.DataDirectory[(int)DataDirectoryType.Import].VirtualAddress = [Valid RVA]

Mbucari avatar Mar 27 '22 20:03 Mbucari