Skip to content

Unmanaged Relocations #706

Description

@QERT2002

AsmResolver Version

6.0.0 beta5

.NET Version

.NET Framework 4.8

Operating System

Windows

Describe the Bug

Dude, I don't know shit about DLLs and headers, but I had a task to change the exports (increasing the length of the original strings and rebuilding the export table in lexicographic order for GetProcAddress to work)

Even without making any changes, the library increases in size when rebuilt and the tls sections are broken (that's what my friend said) in relocations at the address of the tls directory members are duplicated

tls directory relocations duplicated
Image

address of callbacks invalid
Image

How To Reproduce

string inputPath = "GameAssembly.dll";
string outputPath = "GameAssembly_Patched.dll";

var peImage = PEImage.FromFile(inputPath);
UnmanagedPEFileBuilder builder = new UnmanagedPEFileBuilder();
var file = builder.CreateFile(peImage);
file.Write(outputPath);

Expected Behavior

Normal operation of the DLL

Actual Behavior

The DLL will not load via LoadLibraryA or W
with a read error at the address in ntdll.dll
LdrpAllocateTlsEntry

Additional Context

Dlls.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpeIssues related to AsmResolver.PE

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions