Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hypervisor opened this issue Feb 9, 2022 · 2 comments
Open

Comments

@hypervisor
Copy link

Steps to reproduce:

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

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

@Mbucari
Copy link

Mbucari commented Mar 27, 2022

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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants