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

Expose methods to aid in converting address types #173

Open
Dewera opened this issue Oct 27, 2020 · 4 comments
Open

Expose methods to aid in converting address types #173

Dewera opened this issue Oct 27, 2020 · 4 comments

Comments

@Dewera
Copy link
Contributor

Dewera commented Oct 27, 2020

I think most people working with this library are likely to need to convert between file offsets, relative virtual address and virtual addresses. Whilst these can be computed manually using the information present in the headers, due to how often these conversions are needed I think it would a good idea to expose methods to do this for consumers of the library.

Proposed methods

public uint RvaToFileOffset(uint rva);

public uint VaToRva(uint va);

public uint VaToRva(ulong va);

Would be happy to do this as a pull request should you agree.

@secana
Copy link
Owner

secana commented Oct 27, 2020

Sure, contributions are always welcome. Did you check if the methods in ExtensionsMethods.cs are already what you need? If not, feel free to create a PR!

@Dewera
Copy link
Contributor Author

Dewera commented Oct 27, 2020

I actually didn't realise these existed - They're exactly what I was describing!

@Dewera Dewera closed this as completed Oct 27, 2020
@ZehMatt
Copy link

ZehMatt commented Oct 22, 2024

Sorry for posting on this old issue I was also looking for exactly that, I think it would be a lot better if the extension methods were moved into PeFile so its PeFile.VaToOffset rather than ulong.VaToOffset, its just a lot easier to discover as having ulong.VaToOffset seems very unusual to me. I wouldn't mind doing the PR for it.

@secana
Copy link
Owner

secana commented Oct 25, 2024

Hi! A PR is welcome :)

@secana secana reopened this Oct 25, 2024
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