Skip to content

Compilers #644

Answered by Washi1337
The-Futurist asked this question in Q&A
Jun 10, 2025 · 2 comments · 1 reply
Discussion options

You must be logged in to vote

AsmResolver can create new PE files, which includes DLLs. Creating and writing a PE can be as simple as:

using AsmResolver;
using AsmResolver.PE.File;

// Create a new empty PE file (default target arch is i386).
var file = new PEFile();

// Add a section.
var section = new PESection(
   name: ".text",
   characteristics: SectionFlags.MemoryRead | SectionFlags.MemoryExecute | SectionFlags.ContentCode,
   contents: new DataSegment([1, 2, 3, 4, 5])
);
file.Sections.Add(section);

// Save it to the disk.
file.Write(@"C:\output.dll");

You probably want to start here or here for documentation for setting up the headers, creating sections, and interacting with standard data directories found in…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by The-Futurist
Comment options

You must be logged in to vote
1 reply
@Washi1337
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants