Skip to content

PeHeaders FromUnmanagedPtr throws exception #6

@Critter79606

Description

@Critter79606

I had an instance where modulePtr was -1 when entering FromUnmanagedPtr(), which threw an exception.
I added the following code to ReadAssemblyDebugInfo()

PeHeaders^ peHdrs = PeHeaders::FromUnmanagedPtr(modulePtr);
if( !peHdrs )
return nullptr;
....

and the following to FromUnmanagedPtr

static PeHeaders^ FromUnmanagedPtr(IntPtr memoryPtr)
{
if( (int)memoryPtr == -1 )
{
return nullptr;
}
....

This resolved the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions